@ai-ecoverse/slicc-kernel 1.160.1 → 1.160.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.
@@ -2207,8 +2207,8 @@ function createSyncFsSabBridge(transport, opts = {}) {
2207
2207
  };
2208
2208
  const io = (id) => ({
2209
2209
  readFile: (path) => bytes({ op: "read", path, ...id }, path),
2210
- writeFile: (path, data, open) => {
2211
- changing({ op: "write", path, body: data, ...open ? { mode: 1 } : {}, ...id }, path);
2210
+ writeFile: (path, data2, open) => {
2211
+ changing({ op: "write", path, body: data2, ...open ? { mode: 1 } : {}, ...id }, path);
2212
2212
  },
2213
2213
  pread: (path, offset, length, version) => bytes({ op: "pread", path, offset, length, ...version ? { version } : {}, ...id }, path),
2214
2214
  pwrite: (path, offset, body, transfer) => {
@@ -3116,12 +3116,12 @@ function streamFile(fd, path, io, access) {
3116
3116
  },
3117
3117
  read: (position, length) => readAsync(position, length),
3118
3118
  readInto: readingIntoAsync((position, length) => readAsync(position, length)),
3119
- async write(position, data) {
3119
+ async write(position, data2) {
3120
3120
  index2(position, "write");
3121
3121
  live();
3122
3122
  allowed(access.write, "write");
3123
- await io.write(fd, data);
3124
- return data.length;
3123
+ await io.write(fd, data2);
3124
+ return data2.length;
3125
3125
  },
3126
3126
  async truncate(size) {
3127
3127
  live();
@@ -3155,12 +3155,12 @@ function streamSyncFile(fd, path, io, access) {
3155
3155
  },
3156
3156
  read: (position, length) => readSync(position, length),
3157
3157
  readInto: readingInto((position, length) => readSync(position, length)),
3158
- write(position, data) {
3158
+ write(position, data2) {
3159
3159
  index2(position, "write");
3160
3160
  live();
3161
3161
  allowed(access.write, "write");
3162
- io.write(fd, data);
3163
- return data.length;
3162
+ io.write(fd, data2);
3163
+ return data2.length;
3164
3164
  },
3165
3165
  truncate(size) {
3166
3166
  live();
@@ -4572,12 +4572,12 @@ var init_wasi_memory = __esm({
4572
4572
  }
4573
4573
  return out;
4574
4574
  }
4575
- scatter(ptr, count, data) {
4575
+ scatter(ptr, count, data2) {
4576
4576
  let at = 0;
4577
4577
  for (const [base, len] of this.iovecs(ptr, count)) {
4578
- if (at >= data.length) break;
4579
- const n = capturedMath.min(len, data.length - at);
4580
- this.bytes(base, n).set(data.subarray(at, at + n));
4578
+ if (at >= data2.length) break;
4579
+ const n = capturedMath.min(len, data2.length - at);
4580
+ this.bytes(base, n).set(data2.subarray(at, at + n));
4581
4581
  at += n;
4582
4582
  }
4583
4583
  return at;
@@ -4980,8 +4980,8 @@ function wasixEpollImports(host) {
4980
4980
  kernelFd(fd, "EPERM");
4981
4981
  if (how !== "del" && event === 0) throw new WasiError("EINVAL");
4982
4982
  const events = event === 0 ? 0 : mem.view().getUint32(event, true);
4983
- const data = event === 0 ? [] : [...mem.bytes(event + DATA_OFFSET, DATA_SIZE)];
4984
- call3({ op: "epoll-ctl", epfd, how, fd, events, data });
4983
+ const data2 = event === 0 ? [] : [...mem.bytes(event + DATA_OFFSET, DATA_SIZE)];
4984
+ call3({ op: "epoll-ctl", epfd, how, fd, events, data: data2 });
4985
4985
  },
4986
4986
  epoll_wait: (epfd, ptr, maxevents, timeout, out) => {
4987
4987
  mem.view().setUint32(out, 0, true);
@@ -6111,12 +6111,12 @@ var init_wasi_host = __esm({
6111
6111
  return {
6112
6112
  fd_write: (fd, iovs, n, out) => void mem.view().setUint32(out, this.write(fd, mem.gather(iovs, n)), true),
6113
6113
  fd_read: (fd, iovs, n, out) => {
6114
- const data = this.read(fd, mem.capacity(iovs, n));
6115
- mem.view().setUint32(out, mem.scatter(iovs, n, data), true);
6114
+ const data2 = this.read(fd, mem.capacity(iovs, n));
6115
+ mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
6116
6116
  },
6117
6117
  fd_pread: (fd, iovs, n, at, out) => {
6118
- const data = this.positional(fd, "read").pread(mem.capacity(iovs, n), capturedNumber(at));
6119
- mem.view().setUint32(out, mem.scatter(iovs, n, data), true);
6118
+ const data2 = this.positional(fd, "read").pread(mem.capacity(iovs, n), capturedNumber(at));
6119
+ mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
6120
6120
  },
6121
6121
  fd_pwrite: (fd, iovs, n, at, out) => void mem.view().setUint32(
6122
6122
  out,
@@ -6287,8 +6287,8 @@ var init_wasi_host = __esm({
6287
6287
  }
6288
6288
  const peek = (riflags & RIFLAGS.PEEK) !== 0;
6289
6289
  const want = mem.capacity(iovs, n);
6290
- const data = (riflags & RIFLAGS.WAITALL) !== 0 && !peek ? this.recvAll(fd, want, e.nonblock) : o.kernel.sys.read(fd, capturedMath.min(want, MAX_READ), { nonblock: e.nonblock, peek });
6291
- mem.view().setUint32(outLen, mem.scatter(iovs, n, data), true);
6290
+ const data2 = (riflags & RIFLAGS.WAITALL) !== 0 && !peek ? this.recvAll(fd, want, e.nonblock) : o.kernel.sys.read(fd, capturedMath.min(want, MAX_READ), { nonblock: e.nonblock, peek });
6291
+ mem.view().setUint32(outLen, mem.scatter(iovs, n, data2), true);
6292
6292
  mem.view().setUint16(outFlags, 0, true);
6293
6293
  },
6294
6294
  sock_send: (fd, iovs, n, _flags, out) => {
@@ -6399,12 +6399,12 @@ var init_wasi_host = __esm({
6399
6399
  kernelStat(fd) {
6400
6400
  return this.o.kernel.call({ op: "fd-vfs-stat", fd });
6401
6401
  }
6402
- write(fd, data) {
6403
- if (this.muted?.(fd, data)) return data.length;
6402
+ write(fd, data2) {
6403
+ if (this.muted?.(fd, data2)) return data2.length;
6404
6404
  const e = this.fds.get(fd);
6405
6405
  if (e.type === "kernel") {
6406
6406
  try {
6407
- const n = this.o.kernel.sys.write(fd, data, { nonblock: e.nonblock });
6407
+ const n = this.o.kernel.sys.write(fd, data2, { nonblock: e.nonblock });
6408
6408
  return this.fds.kind(fd, e) === "file" ? this.changed(fd, e, n) : n;
6409
6409
  } catch (err) {
6410
6410
  const broken = err.code === "EPIPE";
@@ -6415,10 +6415,10 @@ var init_wasi_host = __esm({
6415
6415
  if (e.type === "device") {
6416
6416
  this.interrupted?.();
6417
6417
  if (e.access === "read") throw new WasiError("EBADF");
6418
- if (e.device === "full" && data.length > 0) throw new WasiError("ENOSPC");
6419
- return data.length;
6418
+ if (e.device === "full" && data2.length > 0) throw new WasiError("ENOSPC");
6419
+ return data2.length;
6420
6420
  }
6421
- return this.file(fd, "write").write(data);
6421
+ return this.file(fd, "write").write(data2);
6422
6422
  }
6423
6423
  brokenPipe() {
6424
6424
  let action;
@@ -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.160.1" : "0.0.0-dev";
7368
+ KERNEL_VERSION = true ? "1.160.3" : "0.0.0-dev";
7369
7369
  OS_RELEASE = "6.0.0-slicc";
7370
7370
  }
7371
7371
  });
@@ -7589,10 +7589,10 @@ function restoreMode(lane, { terminal, fd, termios }) {
7589
7589
  lane({ op: "tty-set", fd: opened2, termios });
7590
7590
  lane({ op: "fd-close", fd: opened2 });
7591
7591
  }
7592
- function writeOut(lane, fd, data) {
7592
+ function writeOut(lane, fd, data2) {
7593
7593
  let at = 0;
7594
- while (at < data.length) {
7595
- const body = data.subarray(at, at + MAX_IO);
7594
+ while (at < data2.length) {
7595
+ const body = data2.subarray(at, at + MAX_IO);
7596
7596
  const r = lane({ op: "fd-write", fd, body });
7597
7597
  if (!r.ok && r.errno === "EINTR") continue;
7598
7598
  if (!r.ok) return false;
@@ -10662,13 +10662,13 @@ function useFileMmap(Fs, deps) {
10662
10662
  if (stream.stream_ops.mmap && kfd === void 0 || !memalign || !memory || length <= 0 || shared || (stream.flags & O_ACCMODE3) === O_WRONLY5 || !Fs.isFile(stream.node.mode)) {
10663
10663
  return mmap.call(fs, stream, length, position, prot, flags);
10664
10664
  }
10665
- const data = staging(Fs, length);
10665
+ const data2 = staging(Fs, length);
10666
10666
  let done = 0;
10667
10667
  try {
10668
- if (kfd !== void 0) done = readInto(deps.sys, kfd, data, position);
10668
+ if (kfd !== void 0) done = readInto(deps.sys, kfd, data2, position);
10669
10669
  else {
10670
10670
  for (let got = 1; done < length && got > 0; done += got) {
10671
- got = Fs.read(stream, data, done, length - done, position + done);
10671
+ got = Fs.read(stream, data2, done, length - done, position + done);
10672
10672
  }
10673
10673
  }
10674
10674
  } catch (err) {
@@ -10679,7 +10679,7 @@ function useFileMmap(Fs, deps) {
10679
10679
  if (!ptr) throw new Fs.ErrnoError(wasiErrno("ENOMEM"));
10680
10680
  const target = new capturedUint8Array(memory.buffer, ptr, size);
10681
10681
  target.fill(0);
10682
- target.set(data.subarray(0, done));
10682
+ target.set(data2.subarray(0, done));
10683
10683
  return { ptr, allocated: true };
10684
10684
  };
10685
10685
  }
@@ -11476,8 +11476,8 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
11476
11476
  stream.sliccProc = new capturedTextEncoder().encode(content());
11477
11477
  },
11478
11478
  read: (stream, buffer, offset, length, at) => {
11479
- const data = stream.sliccProc ?? new capturedUint8Array(0);
11480
- const chunk = data.subarray(at, at + length);
11479
+ const data2 = stream.sliccProc ?? new capturedUint8Array(0);
11480
+ const chunk = data2.subarray(at, at + length);
11481
11481
  buffer.set(chunk, offset);
11482
11482
  return chunk.length;
11483
11483
  },
@@ -12319,11 +12319,11 @@ var init_js_proc = __esm({
12319
12319
  });
12320
12320
 
12321
12321
  // src/process/js/js-rights.ts
12322
- function sendmsgRequest(fd, data, options = {}) {
12322
+ function sendmsgRequest(fd, data2, options = {}) {
12323
12323
  return {
12324
12324
  op: "sock-sendmsg",
12325
12325
  fd,
12326
- body: typeof data === "string" ? encoder2.encode(data) : data,
12326
+ body: typeof data2 === "string" ? encoder2.encode(data2) : data2,
12327
12327
  fds: options.fds ?? [],
12328
12328
  nonblock: options.nonblock === true
12329
12329
  };
@@ -12360,7 +12360,7 @@ async function blocked(kernel, watch, req) {
12360
12360
  function rightsAsync(kernel, forget, watch) {
12361
12361
  return {
12362
12362
  socketpair: async () => await kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
12363
- sendmsg: async (fd, data, options) => jsonOf(await blocked(kernel, watch, sendmsgRequest(fd, data, options))),
12363
+ sendmsg: async (fd, data2, options) => jsonOf(await blocked(kernel, watch, sendmsgRequest(fd, data2, options))),
12364
12364
  async recvmsg(fd, max, options) {
12365
12365
  const got = decodeReceived2(
12366
12366
  bytesOf2(await blocked(kernel, watch, recvmsgRequest(fd, max, options)))
@@ -12507,8 +12507,8 @@ function syncOps(kernel, shared) {
12507
12507
  const r = kernel.blocking({ op: "fd-read", fd, max: capturedMath.min(max, MAX_IO) });
12508
12508
  return r.ok && r.kind === "bytes" ? r.bytes : new capturedUint8Array(0);
12509
12509
  };
12510
- const write2 = (fd, data, options) => {
12511
- const bytes = typeof data === "string" ? encoder4.encode(data) : data;
12510
+ const write2 = (fd, data2, options) => {
12511
+ const bytes = typeof data2 === "string" ? encoder4.encode(data2) : data2;
12512
12512
  const i = info(fd);
12513
12513
  if (writeDevice(i)) return bytes.length;
12514
12514
  const nonblock = options?.nonblock === true;
@@ -12599,7 +12599,7 @@ function syncOps(kernel, shared) {
12599
12599
  kernel.call({ op: "fd-close", fd });
12600
12600
  },
12601
12601
  socketpair: () => kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
12602
- sendmsg: (fd, data, options) => kernel.json(sendmsgRequest(fd, data, options)),
12602
+ sendmsg: (fd, data2, options) => kernel.json(sendmsgRequest(fd, data2, options)),
12603
12603
  recvmsg(fd, max, options) {
12604
12604
  const got = decodeReceived2(kernel.bytes(recvmsgRequest(fd, max, options)));
12605
12605
  for (const n of got.fds) infos.delete(n);
@@ -12648,17 +12648,17 @@ function syncFile(kernel, fd, path, append, forget) {
12648
12648
  read(position, length) {
12649
12649
  return pread(position, length);
12650
12650
  },
12651
- write(position, data) {
12651
+ write(position, data2) {
12652
12652
  index2(position, "write");
12653
12653
  let at = 0;
12654
12654
  do {
12655
12655
  live();
12656
- if (at >= data.length) break;
12657
- const body = data.subarray(at, at + MAX_IO);
12656
+ if (at >= data2.length) break;
12657
+ const body = data2.subarray(at, at + MAX_IO);
12658
12658
  const n = kernel.json(fileWrite(fd, append, position + at, body));
12659
12659
  if (!(n > 0)) throw new JsCallError("EIO", "write");
12660
12660
  at += n;
12661
- } while (at < data.length);
12661
+ } while (at < data2.length);
12662
12662
  return at;
12663
12663
  },
12664
12664
  truncate(size) {
@@ -12743,7 +12743,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
12743
12743
  return readWholeSync(open(devPath));
12744
12744
  }
12745
12745
  },
12746
- writeFile(path, data, options) {
12746
+ writeFile(path, data2, options) {
12747
12747
  const mode = options?.mode;
12748
12748
  const file = open(path, {
12749
12749
  write: true,
@@ -12752,7 +12752,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
12752
12752
  ...mode !== void 0 ? { mode } : {}
12753
12753
  });
12754
12754
  try {
12755
- file.write(0, typeof data === "string" ? encoder4.encode(data) : data);
12755
+ file.write(0, typeof data2 === "string" ? encoder4.encode(data2) : data2);
12756
12756
  } finally {
12757
12757
  file.close();
12758
12758
  }
@@ -14226,8 +14226,8 @@ function createProcessKernel(deps) {
14226
14226
  },
14227
14227
  pause: () => status(call3({ op: "sig-pause" }, "pause")),
14228
14228
  sigInherited: () => inheritedOf(call3({ op: "sig-inherited" }, "sig-inherited")),
14229
- mount(source, target, type, flags, data) {
14230
- const req = { op: "mount", source, target: at(target), type, flags, data };
14229
+ mount(source, target, type, flags, data2) {
14230
+ const req = { op: "mount", source, target: at(target), type, flags, data: data2 };
14231
14231
  return status(call3(req, `mount ${target}`));
14232
14232
  },
14233
14233
  umount2(target, flags) {
@@ -15933,9 +15933,9 @@ function includesSelf(kernel, self, pid) {
15933
15933
  }
15934
15934
  function writer(kernel, info, pid) {
15935
15935
  const writes = new capturedSet();
15936
- const sendAll = async (fd, data, i, w, signal) => {
15937
- while (w.at < data.length) {
15938
- const body = data.subarray(w.at, w.at + MAX_IO);
15936
+ const sendAll = async (fd, data2, i, w, signal) => {
15937
+ while (w.at < data2.length) {
15938
+ const body = data2.subarray(w.at, w.at + MAX_IO);
15939
15939
  w.len = body.length;
15940
15940
  try {
15941
15941
  w.at += signal ? await sendSome(kernel, fd, body, signal) : written(
@@ -15953,21 +15953,21 @@ function writer(kernel, info, pid) {
15953
15953
  }
15954
15954
  }
15955
15955
  };
15956
- const writeAll = async (fd, data, signal) => {
15957
- const w = { fd, data, at: 0, len: 0 };
15956
+ const writeAll = async (fd, data2, signal) => {
15957
+ const w = { fd, data: data2, at: 0, len: 0 };
15958
15958
  if (!signal) writes.add(w);
15959
15959
  try {
15960
15960
  const i = await info(fd);
15961
15961
  if (writeDevice(i)) return;
15962
- await sendAll(fd, data, i, w, signal);
15962
+ await sendAll(fd, data2, i, w, signal);
15963
15963
  } finally {
15964
15964
  writes.delete(w);
15965
15965
  }
15966
15966
  };
15967
- const writeSome = async (fd, data) => {
15967
+ const writeSome = async (fd, data2) => {
15968
15968
  const i = await info(fd);
15969
- if (writeDevice(i)) return data.length;
15970
- const body = data.subarray(0, MAX_IO);
15969
+ if (writeDevice(i)) return data2.length;
15970
+ const body = data2.subarray(0, MAX_IO);
15971
15971
  const r = await kernel.raw({ op: "fd-write", fd, body, nonblock: true });
15972
15972
  if (r.ok) return written(r, body.length);
15973
15973
  if (brokenPipe(callError(r, "fd-write"), i))
@@ -16051,10 +16051,10 @@ async function fifoOpen(kernel, abs, options, io) {
16051
16051
  seekless(position, "read");
16052
16052
  return io.read(fd, length);
16053
16053
  }),
16054
- async write(position, data) {
16054
+ async write(position, data2) {
16055
16055
  seekless(position, "write");
16056
- await io.write(fd, data);
16057
- return data.length;
16056
+ await io.write(fd, data2);
16057
+ return data2.length;
16058
16058
  },
16059
16059
  async truncate() {
16060
16060
  live();
@@ -16145,10 +16145,10 @@ function pendingReads(kernel, info, random2) {
16145
16145
  return { read: read2, closing, watch };
16146
16146
  }
16147
16147
  function tracked2(pending, writeAll, writeSome, failed5) {
16148
- return (fd, data, options) => {
16148
+ return (fd, data2, options) => {
16149
16149
  const status2 = failed5?.();
16150
16150
  if (status2 !== void 0) return capturedPromise.reject(new JsExit(status2));
16151
- const bytes = typeof data === "string" ? encoder5.encode(data) : data;
16151
+ const bytes = typeof data2 === "string" ? encoder5.encode(data2) : data2;
16152
16152
  let settle;
16153
16153
  const settled2 = new capturedPromise((resolve2) => settle = resolve2);
16154
16154
  pending.add(settled2);
@@ -16415,17 +16415,17 @@ function fileHandle(kernel, fd, path, append, forget) {
16415
16415
  async read(position, length) {
16416
16416
  return await pread(position, length);
16417
16417
  },
16418
- async write(position, data) {
16418
+ async write(position, data2) {
16419
16419
  index2(position, "write");
16420
16420
  let at = 0;
16421
16421
  do {
16422
16422
  live();
16423
- if (at >= data.length) break;
16424
- const body = data.subarray(at, at + MAX_IO);
16423
+ if (at >= data2.length) break;
16424
+ const body = data2.subarray(at, at + MAX_IO);
16425
16425
  const n = await kernel.json(fileWrite(fd, append, position + at, body));
16426
16426
  if (!(n > 0)) throw new JsCallError("EIO", "write");
16427
16427
  at += n;
16428
- } while (at < data.length);
16428
+ } while (at < data2.length);
16429
16429
  return at;
16430
16430
  },
16431
16431
  async truncate(size) {
@@ -16535,7 +16535,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
16535
16535
  return readWhole(await open(devPath));
16536
16536
  }
16537
16537
  },
16538
- async writeFile(path, data, options) {
16538
+ async writeFile(path, data2, options) {
16539
16539
  const mode = options?.mode;
16540
16540
  const file = await open(
16541
16541
  path,
@@ -16543,7 +16543,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
16543
16543
  true
16544
16544
  );
16545
16545
  try {
16546
- await file.write(0, typeof data === "string" ? encoder5.encode(data) : data);
16546
+ await file.write(0, typeof data2 === "string" ? encoder5.encode(data2) : data2);
16547
16547
  } finally {
16548
16548
  await file.close();
16549
16549
  }
@@ -16796,7 +16796,8 @@ async function runJs(init, port3, deps, thread) {
16796
16796
  });
16797
16797
  try {
16798
16798
  (deps.lockdown ?? lockdown)();
16799
- const { url, glue } = init.program;
16799
+ const { url, glue, source } = init.program;
16800
+ if (url && source !== void 0) deps.moduleSource?.(url, source);
16800
16801
  main = mainOf(await (url ? import(url) : (deps.load ?? importSource)(glue)));
16801
16802
  deps.imported?.();
16802
16803
  } catch (err) {
@@ -17131,9 +17132,9 @@ var init_wasi_signals = __esm({
17131
17132
  this.libcDefault = outer.libc;
17132
17133
  }
17133
17134
  }
17134
- muted(fd, data) {
17135
+ muted(fd, data2) {
17135
17136
  if (fd !== 2 || this.delivering === void 0) return false;
17136
- if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(data))) return false;
17137
+ if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(data2))) return false;
17137
17138
  this.libcDefault = true;
17138
17139
  return true;
17139
17140
  }
@@ -17305,8 +17306,8 @@ var init_wasix_fork = __esm({
17305
17306
  fork(fork) {
17306
17307
  const sp = this.stackPointer();
17307
17308
  const globals = this.globals();
17308
- return this.unwind((data) => {
17309
- this.answer = fork(data, globals, sp);
17309
+ return this.unwind((data2) => {
17310
+ this.answer = fork(data2, globals, sp);
17310
17311
  });
17311
17312
  }
17312
17313
  checkpoint(snapPtr, retPtr) {
@@ -17316,9 +17317,9 @@ var init_wasix_fork = __esm({
17316
17317
  v.setBigUint64(snapPtr + 8, capturedBigInt(id), true);
17317
17318
  v.setBigUint64(snapPtr + 16, 0x51cc5117n, true);
17318
17319
  const globals = this.globals();
17319
- return this.unwind((data) => {
17320
- const end = this.mem.view().getUint32(data, true);
17321
- this.snapshots.set(id, { frames: this.mem.bytes(data + 8, end - data - 8).slice(), globals });
17320
+ return this.unwind((data2) => {
17321
+ const end = this.mem.view().getUint32(data2, true);
17322
+ this.snapshots.set(id, { frames: this.mem.bytes(data2 + 8, end - data2 - 8).slice(), globals });
17322
17323
  this.answer = 0;
17323
17324
  });
17324
17325
  }
@@ -17326,9 +17327,9 @@ var init_wasix_fork = __esm({
17326
17327
  const id = capturedNumber(this.mem.view().getBigUint64(snapPtr + 8, true));
17327
17328
  const snap = this.snapshots.get(id);
17328
17329
  if (!snap) throw new capturedError(`WASIX: longjmp to an unknown setjmp (${id})`);
17329
- return this.unwind((data) => {
17330
- this.mem.bytes(data + 8, snap.frames.length).set(snap.frames);
17331
- this.mem.view().setUint32(data, data + 8 + snap.frames.length, true);
17330
+ return this.unwind((data2) => {
17331
+ this.mem.bytes(data2 + 8, snap.frames.length).set(snap.frames);
17332
+ this.mem.view().setUint32(data2, data2 + 8 + snap.frames.length, true);
17332
17333
  this.restoreGlobals(snap.globals);
17333
17334
  this.answer = capturedNumber(val) || 1;
17334
17335
  });
@@ -17356,15 +17357,15 @@ var init_wasix_fork = __esm({
17356
17357
  }
17357
17358
  unwind(then) {
17358
17359
  if (!this.supported) return E.NOSYS;
17359
- const data = this.dataPointer();
17360
+ const data2 = this.dataPointer();
17360
17361
  const v = this.mem.view();
17361
- v.setUint32(data, data + 8, true);
17362
- v.setUint32(data + 4, this.stackPointer() - 16, true);
17362
+ v.setUint32(data2, data2 + 8, true);
17363
+ v.setUint32(data2 + 4, this.stackPointer() - 16, true);
17363
17364
  this.pending = () => {
17364
- then(data);
17365
- return data;
17365
+ then(data2);
17366
+ return data2;
17366
17367
  };
17367
- this.exports.asyncify_start_unwind?.(data);
17368
+ this.exports.asyncify_start_unwind?.(data2);
17368
17369
  return E.SUCCESS;
17369
17370
  }
17370
17371
  restoreGlobals(globals) {
@@ -19283,7 +19284,7 @@ async function runWasiProcess(init, port3) {
19283
19284
  host.signals = signals;
19284
19285
  wireSignals(host, gate);
19285
19286
  host.onRaise = (sig) => signals.raised(sig);
19286
- host.muted = (fd, data) => signals.muted(fd, data);
19287
+ host.muted = (fd, data2) => signals.muted(fd, data2);
19287
19288
  const exports = instance.exports;
19288
19289
  driver.bind(instance.exports);
19289
19290
  const entry = fork?.entry;
@@ -19619,15 +19620,26 @@ var BASE64_MODULE = "data:text/javascript;base64,";
19619
19620
  var fromBase64 = capturedBuffer.from.bind(capturedBuffer);
19620
19621
  var toText = capturedFunction.prototype.call.bind(capturedBuffer.prototype.toString);
19621
19622
  var PLAIN_BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
19623
+ var SOURCE_MODULE = "slicc-module:";
19624
+ var sources = new capturedMap();
19625
+ function moduleSource(url, source) {
19626
+ sources.set(url, source);
19627
+ }
19622
19628
  function refuseModules() {
19623
19629
  registerHooks({
19624
19630
  resolve(specifier, context, next2) {
19631
+ if (specifier.startsWith(SOURCE_MODULE)) {
19632
+ if (!sources.has(specifier)) throw refused(specifier);
19633
+ return { url: specifier, shortCircuit: true };
19634
+ }
19625
19635
  if (isBuiltin(specifier)) throw refused(specifier);
19626
19636
  const resolved2 = next2(specifier, context);
19627
19637
  if (!resolved2.url.startsWith("data:")) throw refused(resolved2.url);
19628
19638
  return resolved2;
19629
19639
  },
19630
19640
  load(url, context, next2) {
19641
+ const known = sources.get(url);
19642
+ if (known !== void 0) return { format: "module", source: known, shortCircuit: true };
19631
19643
  const payload = url.startsWith(BASE64_MODULE) ? url.slice(BASE64_MODULE.length) : "";
19632
19644
  const typed = capturedObject.keys(context.importAttributes ?? {}).length > 0;
19633
19645
  if (typed || payload.length % 4 !== 0 || !PLAIN_BASE64.test(payload))
@@ -19681,10 +19693,11 @@ function workerShaped(scope2, href) {
19681
19693
  location: slot2(capturedObject.freeze({ href }))
19682
19694
  });
19683
19695
  }
19684
- function ownCache(dir, result) {
19696
+ function ownCache(dir, result, optional = false) {
19685
19697
  const active = result.directory;
19686
19698
  if (active === void 0) return false;
19687
19699
  if (!`${resolve(active)}${sep}`.startsWith(`${resolve(dir)}${sep}`)) {
19700
+ if (optional) return false;
19688
19701
  throw new capturedError(
19689
19702
  `slicc-kernel: compileCache ${dir} was asked for, but this worker already caches in ${active} (a host preload enabled it): refusing to run programs`
19690
19703
  );
@@ -19939,30 +19952,30 @@ function processEntry(port3, run = runWasmProcess, wasi = loadWasi, js = loadJs,
19939
19952
  }
19940
19953
  return refused3;
19941
19954
  };
19942
- return (data) => {
19943
- const type = data?.type;
19955
+ return (data2) => {
19956
+ const type = data2?.type;
19944
19957
  if (type !== WASM_THREAD_INIT && type !== WASM_PROCESS_INIT && type !== JS_THREAD_INIT) return;
19945
19958
  const refusal2 = sealOnce();
19946
19959
  if (type === JS_THREAD_INIT) {
19947
19960
  if (refusal2) return failed5(refusal2.error);
19948
19961
  js().then((m) => {
19949
19962
  if (!m.runJsThread) throw new capturedError("this process worker runs no JS threads");
19950
- return m.runJsThread(data, port3);
19963
+ return m.runJsThread(data2, port3);
19951
19964
  }).then(
19952
19965
  (code2) => port3.postMessage({ type: JS_THREAD_EXIT, code: code2 }),
19953
19966
  failed5
19954
19967
  );
19955
19968
  return;
19956
19969
  }
19957
- const init = data;
19970
+ const init = data2;
19958
19971
  if (type === WASM_THREAD_INIT || init?.program?.abi !== "js") useLocalClock(init?.sab);
19959
19972
  if (type === WASM_THREAD_INIT) {
19960
19973
  if (refusal2) return failed5(refusal2.error);
19961
- wasi().then((m) => m.runWasiThread(data, port3)).catch(failed5);
19974
+ wasi().then((m) => m.runWasiThread(data2, port3)).catch(failed5);
19962
19975
  return;
19963
19976
  }
19964
19977
  if (refusal2) return failed5(refusal2.error, NOT_RUNNABLE2);
19965
- started2(data, port3, run, wasi, js).then(
19978
+ started2(data2, port3, run, wasi, js).then(
19966
19979
  (code2) => port3.postMessage({ type: WASM_PROCESS_EXIT, code: code2 }),
19967
19980
  failed5
19968
19981
  );
@@ -19976,8 +19989,9 @@ var scope = capturedGlobalThis;
19976
19989
  scope.require ??= createRequire(import.meta.url);
19977
19990
  scope.__filename ??= new capturedURL(import.meta.url).pathname;
19978
19991
  scope.__dirname ??= new capturedURL(".", import.meta.url).pathname;
19979
- var cacheDir = workerData?.compileCache;
19980
- var cached = typeof cacheDir === "string" && ownCache(cacheDir, enableCompileCache(cacheDir));
19992
+ var data = workerData;
19993
+ var cacheDir = data?.compileCache;
19994
+ var cached = typeof cacheDir === "string" && ownCache(cacheDir, enableCompileCache(cacheDir), data?.ownedCache === true);
19981
19995
  var imported = cached ? () => flushCompileCache() : void 0;
19982
19996
  var port2 = parentPort;
19983
19997
  var post2 = {
@@ -19998,6 +20012,7 @@ var onMessage = processEntry(
19998
20012
  memory: nodeMemory,
19999
20013
  asyncContext: nodeAsyncContext,
20000
20014
  runScript: nodeRunScript,
20015
+ moduleSource,
20001
20016
  promiseState: nodePromiseState,
20002
20017
  imported
20003
20018
  }),
@@ -20007,6 +20022,7 @@ var onMessage = processEntry(
20007
20022
  memory: nodeMemory,
20008
20023
  asyncContext: nodeAsyncContext,
20009
20024
  runScript: nodeRunScript,
20025
+ moduleSource,
20010
20026
  promiseState: nodePromiseState,
20011
20027
  imported
20012
20028
  })