@ai-ecoverse/slicc-kernel 1.165.2 → 1.165.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.
- package/README.md +1 -1
- package/dist/kernel-worker.js +1 -1
- package/dist/node-driver-worker.js +16 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +17 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +1 -1
- package/dist/process-worker.js +1 -1
- package/package.json +2 -2
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`,
|
|
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`.
|
|
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.
|
package/dist/kernel-worker.js
CHANGED
|
@@ -8464,7 +8464,7 @@ function satisfies(version, range2) {
|
|
|
8464
8464
|
}
|
|
8465
8465
|
|
|
8466
8466
|
// src/version.ts
|
|
8467
|
-
var KERNEL_VERSION = true ? "1.165.
|
|
8467
|
+
var KERNEL_VERSION = true ? "1.165.3" : "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
|
|
@@ -1525,8 +1525,21 @@ var ownNames = /* @__PURE__ */ new Set([
|
|
|
1525
1525
|
var ownHash = apply(hashOf, self, []);
|
|
1526
1526
|
var programHashes = /* @__PURE__ */ new Set();
|
|
1527
1527
|
var programNames = /* @__PURE__ */ new Set();
|
|
1528
|
+
var SOURCE_NAMES = 4096;
|
|
1529
|
+
var sourceNames = /* @__PURE__ */ new Set();
|
|
1528
1530
|
function programName(name) {
|
|
1529
|
-
return apply(startsWith, name, ["data:"]) === true || apply(setHas, programNames, [name]) === true;
|
|
1531
|
+
return apply(startsWith, name, ["data:"]) === true || apply(setHas, programNames, [name]) === true || apply(setHas, sourceNames, [name]) === true;
|
|
1532
|
+
}
|
|
1533
|
+
function noteSourceUrls(trace) {
|
|
1534
|
+
for (let i = 0; i < trace.length; i++) {
|
|
1535
|
+
const site = trace[i];
|
|
1536
|
+
if (apply(isEval, site, []) !== true || apply(hashOf, site, []) === ownHash) continue;
|
|
1537
|
+
const origin = apply(originOf, site, []);
|
|
1538
|
+
if (typeof origin !== "string" || evalAt(origin)) continue;
|
|
1539
|
+
const name = apply(nameOf, site, []);
|
|
1540
|
+
if (typeof name !== "string" || apply(setHas, ownNames, [name]) === true) continue;
|
|
1541
|
+
if (sourceNames.size < SOURCE_NAMES) apply(setAdd, sourceNames, [name]);
|
|
1542
|
+
}
|
|
1530
1543
|
}
|
|
1531
1544
|
function rootOrigin(origin) {
|
|
1532
1545
|
let at = origin;
|
|
@@ -1574,6 +1587,7 @@ function keptFrame(site) {
|
|
|
1574
1587
|
return apply(startsWith, file, ["node:"]) === true || programName(file);
|
|
1575
1588
|
}
|
|
1576
1589
|
function keptFrames(trace) {
|
|
1590
|
+
noteSourceUrls(trace);
|
|
1577
1591
|
const out = [];
|
|
1578
1592
|
for (let i = 0; i < trace.length; i++) {
|
|
1579
1593
|
const site = trace[i];
|
|
@@ -1595,6 +1609,7 @@ function positionsAt(positions, error, site) {
|
|
|
1595
1609
|
}
|
|
1596
1610
|
function record(positions, error, trace) {
|
|
1597
1611
|
if (typeof error === "object" && error !== null && trace.length > 0) {
|
|
1612
|
+
noteSourceUrls(trace);
|
|
1598
1613
|
const site = trace[0];
|
|
1599
1614
|
apply(mapSet, seen, [error, { site, at: positionsAt(positions, error, site) }]);
|
|
1600
1615
|
}
|