@ai-ecoverse/slicc-kernel 1.166.3 → 1.166.5

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/README.md CHANGED
@@ -424,7 +424,7 @@ The module's default export (or its `main` export) is called with a context and
424
424
  - `sync.promiseState(promise)` (#1531, slicc-jsh#974) tells a native promise's state synchronously, as Node's `util.inspect` does: `{ state: 'pending' | 'fulfilled' | 'rejected', value }`. `value` is the very fulfillment value or rejection reason (`undefined` while pending), and probing doesn't handle a rejection. On the Node entry it reads the promise through an inspector session the process worker opens on first use, one per process and per thread; the probe runs no program code. Anything that isn't a native promise (a thenable, a proxy) is a `TypeError`. It answers `undefined` in a browser, where a worker has no inspector, on a Node built without one, once a program has changed `Object.prototype` or put a `toJSON` on a built-in prototype, and when the global object can't take a new property (`Object.preventExtensions(globalThis)`, or a frozen global).
425
425
  - `sync.setStackFormatter(fn | null)` (#1612, slicc-jsh#1091) is Node only, so check it with `typeof ctx.sync.setStackFormatter === 'function'`. It returns the previous formatter, and `null` removes it.
426
426
  - **When `fn` runs:** it formats an error's `.stack` the way V8's prepare-stack-trace callback does, as `fn(error, callSites)` returning the string. It runs only when no own `Error.prepareStackTrace` function is set, as in Node, so `Error.prepareStackTrace` stays an ordinary property: after `delete` it's `undefined`, `Object.getPrototypeOf(Error)` stays `Function.prototype`, and an assignment to a frozen subclass throws in strict mode.
427
- - **What `fn` gets:** a fresh array of V8 CallSites holding only the program's own frames (its modules, `data:` imports, `sync.runScript` scripts, code they `eval`, `new Function` or `eval` code named by `//# sourceURL`, #1632, and code such a body `eval`s, #1648), `node:` frames and native frames. Kernel frames are dropped by script identity, so a script named like a kernel file doesn't let them through, and so are host files. A program's strict frames give `getFunction()` and `getThis()` as `undefined`.
427
+ - **What `fn` gets:** a fresh array of V8 CallSites holding only the program's own frames (its modules, `data:` imports, `sync.runScript` scripts, code they `eval`, `new Function` or `eval` code named by `//# sourceURL`, #1632, and code such a body `eval`s, #1648; the kernel remembers the 4096 sourceURL names it saw last, #1658), `node:` frames and native frames. Kernel frames are dropped by script identity, so a script named like a kernel file doesn't let them through, and so are host files. A program's strict frames give `getFunction()` and `getThis()` as `undefined`.
428
428
  - **Fallback:** if `fn` throws or returns a non-string, or an error is formatted while `fn` runs, the default stack is used.
429
429
  - **`{ own: true }`** (#1631): `setStackFormatter(fn, { own: true })` calls `fn(error, callSites, own)` for every stack. `own` is the program's own `Error.prepareStackTrace` (the realm's `Error`, then the main one, read as Node 26 reads it), or `undefined` when none is set or it's Node's default. `fn`'s result is the stack whatever its type, and a throw propagates out of the `.stack` read, as with Node's own callback.
430
430
  - **An own `Error.prepareStackTrace` on the Node entry** (#1631): the process worker replaces Node's stack callback with a copy of Node 26's order. A program's own `Error.prepareStackTrace`, and a host preload's, still gets V8's CallSites as in Node, kernel frames included (named `slicc-kernel:/node-process-worker.js`), with its `Error` as receiver; its result and throws are the stack. To hand it the filtered CallSites instead (no kernel frame, no host path), use `setStackFormatter(fn, { own: true })` and call `own` from `fn`. 1.165.0 filtered by default, which broke runtimes that read their own frames through an own `prepareStackTrace`; the release after it went back to V8's CallSites. Node's own internal overrides still come first with raw frames, and so do the kernel's own diagnostics: a crash report and a WASI trap backtrace still show kernel and wasm frames.
@@ -8464,7 +8464,7 @@ function satisfies(version, range2) {
8464
8464
  }
8465
8465
 
8466
8466
  // src/version.ts
8467
- var KERNEL_VERSION = true ? "1.166.3" : "0.0.0-dev";
8467
+ var KERNEL_VERSION = true ? "1.166.5" : "0.0.0-dev";
8468
8468
  var OS_RELEASE = "6.0.0-slicc";
8469
8469
  function procVersion() {
8470
8470
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -15509,6 +15509,14 @@ async function dispatchPath(entry, req) {
15509
15509
  }
15510
15510
 
15511
15511
  // src/realm/sync-sab-wire.ts
15512
+ var atomicLoad = Atomics.load;
15513
+ var atomicStore = Atomics.store;
15514
+ var atomicWaitAsync = Atomics.waitAsync;
15515
+ var setBytes = Uint8Array.prototype.set;
15516
+ var bytesPart = Uint8Array.prototype.subarray;
15517
+ var decodeText = TextDecoder.prototype.decode;
15518
+ var sabLoad = (a, i) => atomicLoad(a, i);
15519
+ var sabStore = (a, i, v) => atomicStore(a, i, v);
15512
15520
  var SAB_HEADER_I32 = 18;
15513
15521
  var SAB_CLOCK_OFFSET = SAB_HEADER_I32 * 4;
15514
15522
  var SAB_CLOCK_I64 = 3;
@@ -15532,17 +15540,17 @@ var SAB_I_STOP = 15;
15532
15540
  var SAB_I_BLOCKED = 16;
15533
15541
  var SAB_I_BLOCKED_HI = 17;
15534
15542
  function loadBlocked(header4) {
15535
- return [Atomics.load(header4, SAB_I_BLOCKED), Atomics.load(header4, SAB_I_BLOCKED_HI)];
15543
+ return [sabLoad(header4, SAB_I_BLOCKED), sabLoad(header4, SAB_I_BLOCKED_HI)];
15536
15544
  }
15537
15545
  function storeBlocked(header4, [low, high]) {
15538
- Atomics.store(header4, SAB_I_BLOCKED_HI, high);
15539
- Atomics.store(header4, SAB_I_BLOCKED, low);
15546
+ sabStore(header4, SAB_I_BLOCKED_HI, high);
15547
+ sabStore(header4, SAB_I_BLOCKED, low);
15540
15548
  }
15541
15549
  var anyBlocked = (mask) => mask !== void 0 && (mask[0] !== 0 || mask[1] !== 0);
15542
15550
  var U32 = 2 ** 32;
15543
15551
  function storeU53(header4, lo, hi, value2) {
15544
- Atomics.store(header4, hi, Math.floor(value2 / U32));
15545
- Atomics.store(header4, lo, value2 % U32 | 0);
15552
+ sabStore(header4, hi, Math.floor(value2 / U32));
15553
+ sabStore(header4, lo, value2 % U32 | 0);
15546
15554
  }
15547
15555
  var SAB_STATE_READY = 2;
15548
15556
  var SAB_STATUS_BYTES = 1;
@@ -16088,6 +16096,11 @@ var AsyncRangedFile = class {
16088
16096
  var UNCOUNTED_OPS = /* @__PURE__ */ new Set([...SYNC_FS_OPS, "cwd-check", "cwd-chdir"]);
16089
16097
  var SPIN_CORES = 4;
16090
16098
  var spinning = (globalThis.navigator?.hardwareConcurrency ?? 0) >= SPIN_CORES;
16099
+ var typed = Object.getPrototypeOf(Uint8Array.prototype);
16100
+ var getter = (name2) => Object.getOwnPropertyDescriptor(typed, name2)?.get;
16101
+ var bufferOf = getter("buffer");
16102
+ var offsetOf = getter("byteOffset");
16103
+ var lengthOf = getter("length");
16091
16104
 
16092
16105
  // src/realm/live-vfs-fs.ts
16093
16106
  var EARLY_WHOLE_FILE = 64 * 1024;