@ai-ecoverse/slicc-kernel 1.142.2 → 1.143.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.
@@ -2866,9 +2866,9 @@ var init_wasi_cred = __esm({
2866
2866
  }
2867
2867
  return this.cred;
2868
2868
  }
2869
- change(apply2) {
2869
+ change(apply3) {
2870
2870
  const seen = this.gen();
2871
- const cred = apply2();
2871
+ const cred = apply3();
2872
2872
  if (!this.shared) {
2873
2873
  this.cred = cred;
2874
2874
  return cred;
@@ -4127,7 +4127,7 @@ var init_wasi_poll = __esm({
4127
4127
  });
4128
4128
 
4129
4129
  // src/process/wasi/wasi-sigmask.ts
4130
- var UNBLOCKABLE, LIBC_UNBLOCKABLE, FOREVER, NS_PER_MS2, POLL_MS, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK, kernelBits, libcBits, apply, WasiSigmask;
4130
+ var UNBLOCKABLE, LIBC_UNBLOCKABLE, FOREVER, NS_PER_MS2, POLL_MS, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK, kernelBits, libcBits, apply2, WasiSigmask;
4131
4131
  var init_wasi_sigmask = __esm({
4132
4132
  "src/process/wasi/wasi-sigmask.ts"() {
4133
4133
  "use strict";
@@ -4144,7 +4144,7 @@ var init_wasi_sigmask = __esm({
4144
4144
  SIG_SETMASK = 2;
4145
4145
  kernelBits = (lo) => lo << 1 & ~UNBLOCKABLE;
4146
4146
  libcBits = (bits) => bits >>> 1 & ~LIBC_UNBLOCKABLE;
4147
- apply = (how, mask, set) => {
4147
+ apply2 = (how, mask, set) => {
4148
4148
  if (how === SIG_BLOCK) return mask | set;
4149
4149
  if (how === SIG_UNBLOCK) return mask & ~set;
4150
4150
  return set;
@@ -4170,8 +4170,8 @@ var init_wasi_sigmask = __esm({
4170
4170
  set(how, setLo, setHi, old) {
4171
4171
  if (how !== SIG_BLOCK && how !== SIG_UNBLOCK && how !== SIG_SETMASK) return E.INVAL;
4172
4172
  old(this.lo >>> 0, this.hi >>> 0);
4173
- this.lo = apply(how, this.lo, setLo | 0) & ~LIBC_UNBLOCKABLE;
4174
- this.hi = apply(how, this.hi, setHi | 0);
4173
+ this.lo = apply2(how, this.lo, setLo | 0) & ~LIBC_UNBLOCKABLE;
4174
+ this.hi = apply2(how, this.hi, setHi | 0);
4175
4175
  const now = kernelBits(this.lo);
4176
4176
  storeBlocked(this.header, [now, this.hi]);
4177
4177
  if ((Atomics.load(this.header, SAB_I_SIGNALS) & ~now) !== 0) this.deliver();
@@ -6725,7 +6725,7 @@ var KERNEL_VERSION, OS_RELEASE;
6725
6725
  var init_version = __esm({
6726
6726
  "src/version.ts"() {
6727
6727
  "use strict";
6728
- KERNEL_VERSION = true ? "1.142.2" : "0.0.0-dev";
6728
+ KERNEL_VERSION = true ? "1.143.0" : "0.0.0-dev";
6729
6729
  OS_RELEASE = "6.0.0-slicc";
6730
6730
  }
6731
6731
  });
@@ -15264,6 +15264,12 @@ function measured(measure) {
15264
15264
  }
15265
15265
  return out;
15266
15266
  }
15267
+ function hostExtras(o) {
15268
+ return {
15269
+ memory: () => measured(o.memory),
15270
+ ...o.asyncContext ? { asyncContext: o.asyncContext() } : {}
15271
+ };
15272
+ }
15267
15273
  function createContext(o) {
15268
15274
  const { kernel } = o;
15269
15275
  const infos = /* @__PURE__ */ new Map();
@@ -15404,7 +15410,7 @@ function createContext(o) {
15404
15410
  tty: terminal.tty,
15405
15411
  exit,
15406
15412
  thread: o.thread,
15407
- memory: () => measured(o.memory),
15413
+ ...hostExtras(o),
15408
15414
  onUncaught: (listener) => listen(strays.exception, listener),
15409
15415
  onUnhandledRejection: (listener) => listen(strays.rejection, listener)
15410
15416
  };
@@ -15812,6 +15818,7 @@ async function runJs(init, port3, deps, thread) {
15812
15818
  strays,
15813
15819
  thread: threadContext(port3, thread),
15814
15820
  memory: deps.memory,
15821
+ asyncContext: deps.asyncContext,
15815
15822
  ...thread?.owned ? { owned: thread.owned } : {},
15816
15823
  held: init.held,
15817
15824
  failed: () => failedWith
@@ -18584,6 +18591,7 @@ import { parentPort, workerData } from "node:worker_threads";
18584
18591
 
18585
18592
  // src/node-lockdown.ts
18586
18593
  init_lockdown();
18594
+ import { AsyncLocalStorage } from "node:async_hooks";
18587
18595
  import { isBuiltin, registerHooks } from "node:module";
18588
18596
  import { resolve, sep } from "node:path";
18589
18597
  import { getHeapStatistics } from "node:v8";
@@ -18688,6 +18696,24 @@ function ownCache(dir, result) {
18688
18696
  }
18689
18697
  return true;
18690
18698
  }
18699
+ var Storage = AsyncLocalStorage;
18700
+ var apply = Reflect.apply;
18701
+ var freeze = Object.freeze;
18702
+ var blank = Object.create;
18703
+ function nodeAsyncContext() {
18704
+ const storage = new Storage();
18705
+ const run = storage.run.bind(storage);
18706
+ const getStore = storage.getStore.bind(storage);
18707
+ const enterWith = storage.enterWith.bind(storage);
18708
+ const api = blank(null);
18709
+ api.run = freeze((store, fn, ...args) => {
18710
+ if (typeof fn !== "function") throw new TypeError("asyncContext.run needs a function");
18711
+ return run(store, () => apply(fn, void 0, args));
18712
+ });
18713
+ api.getStore = freeze(() => getStore());
18714
+ api.enterWith = freeze((store) => enterWith(store));
18715
+ return freeze(api);
18716
+ }
18691
18717
 
18692
18718
  // src/node-process-worker.ts
18693
18719
  init_js_runtime();
@@ -18784,12 +18810,14 @@ var onMessage = processEntry(
18784
18810
  lockdown: () => nodeLockdown(),
18785
18811
  scope: strayScope,
18786
18812
  memory: nodeMemory,
18813
+ asyncContext: nodeAsyncContext,
18787
18814
  imported
18788
18815
  }),
18789
18816
  runJsThread: (init, at) => runJsThread(init, at, {
18790
18817
  lockdown: () => nodeLockdown(),
18791
18818
  scope: strayScope,
18792
18819
  memory: nodeMemory,
18820
+ asyncContext: nodeAsyncContext,
18793
18821
  imported
18794
18822
  })
18795
18823
  }),