@ai-ecoverse/slicc-kernel 1.163.0 → 1.164.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.
- package/README.md +4 -0
- package/dist/kernel-worker.js +19 -2
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-driver-worker.js +40 -3
- package/dist/node-driver-worker.js.map +3 -3
- package/dist/node-process-worker.js +86 -20
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +19 -2
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +5 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/mount/mount-fs.d.ts +2 -0
- package/dist/types/process/js/js-context.d.ts +7 -0
- package/dist/types/process/js/js-sync.d.ts +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -427,6 +427,10 @@ The module's default export (or its `main` export) is called with a context and
|
|
|
427
427
|
- **What `fn` gets:** a fresh array of V8 CallSites holding only the program's own frames (its modules, `data:` imports, `sync.runScript` scripts and code they `eval`), `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
|
- **How it works:** process workers start with `--expose-internals`, so the worker can install the formatter before the lockdown. Host flags a worker refuses are dropped. If the worker still can't start with the flag, the method is absent. Every `internal/*` and `node:internal/*` module stays refused to programs, as do `node:module` and `node:worker_threads`.
|
|
430
|
+
- `sync.errorSource(error)` (#1610, slicc-jsh#1082) is Node only, so check it with `typeof ctx.sync.errorSource === 'function'`. It gives `{ sourceLine, lineNumber, startColumn }` (null-prototype and frozen), the source line Node prints over an uncaught error, for an error V8 raised in the program's own code. That includes a direct `eval` of a value that isn't a string literal (`const s = 'null.d'; eval(s)` gives `null.d` and line 1) and a `sync.runScript` script.
|
|
431
|
+
- **Only the program's own code:** it answers only when the error's top frame is a program frame and the position V8 kept is in that same script and line.
|
|
432
|
+
- **`undefined` cases:** kernel-made errors; values that aren't native errors; an error V8 kept no position for (a `new Error()` the program constructs); a script that borrows the kernel worker's name; and an error an own `Error.prepareStackTrace` formats.
|
|
433
|
+
- **How it works:** it reads V8's message through Node's internal errors binding, which the worker loads at start-up through the same `--expose-internals` as `setStackFormatter`. It prints no warning and needs no inspector.
|
|
430
434
|
- **Kernel frames in a program's stacks** (#1583): on the Node entry, the process worker's bundle names itself `slicc-kernel:/node-process-worker.js` (a `sourceURL`), so the kernel's own frames in an error a program sees (its own errors, a failed `ctx` call, `runScript`) show that name and not the host directory the kernel is installed in. The same holds in `CallSite.toString()` and `getScriptNameOrSourceURL()`, which a program's own `Error.prepareStackTrace` gets; `getFileName()` still returns the bundle's file URL. Line and column numbers are unchanged, so they still point into `dist/node-process-worker.js`. Don't run an embedder with `--enable-source-maps` if program-visible paths matter: Node then maps the kernel's frames back to the absolute paths of its sources. In a browser the frames keep the bundle's URL, because Chrome ignores `sourceURL` in a module worker loaded by URL.
|
|
431
435
|
- `module` (#1598, slicc-jsh#566) is a frozen `{ path }` with the command module's own path in the kernel's file system (e.g. `/usr/lib/node_modules/jsh/dist/jsh.mjs`), so a program can read its package's other files through `ctx.fs` on first use. It's the path the kernel found the package under, with symlinks left as they are (a pnpm-style `node_modules/<name>` link stays in it), and reads the same files through `ctx.fs`. It's a kernel path, never a host one, and a thread gets the same. It's absent for the kernel's built-in programs (`sudo`, `crontab`) and for a program run from inline source with no file.
|
|
432
436
|
- `memory()`, synchronous and without a kernel call, measures the calling isolate: each `thread` answers for its own (#1240, slicc-jsh#397). It returns a fresh plain object of numbers in bytes, each field only where it's measured: `heapUsed`, `heapTotal`, `heapLimit` (V8's heap size limit), `external`, `arrayBuffers` and `rss`. On the Node entry they come from V8's heap statistics and Node's memory usage, through functions the worker captured before its lockdown, so nothing reachable from the program leads back to `process` or `v8`. `rss` is the host process's resident set size, as a Node worker thread reports it in `process.memoryUsage().rss`: it isn't per process, but shared by every process and thread of the kernel, and by any other kernel in that host process (#1563, slicc-jsh#539). In a browser `memory()` answers `{}` for now, with no `rss`.
|
package/dist/kernel-worker.js
CHANGED
|
@@ -8437,7 +8437,7 @@ function satisfies(version, range2) {
|
|
|
8437
8437
|
}
|
|
8438
8438
|
|
|
8439
8439
|
// src/version.ts
|
|
8440
|
-
var KERNEL_VERSION = true ? "1.
|
|
8440
|
+
var KERNEL_VERSION = true ? "1.164.0" : "0.0.0-dev";
|
|
8441
8441
|
var OS_RELEASE = "6.0.0-slicc";
|
|
8442
8442
|
function procVersion() {
|
|
8443
8443
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -13230,6 +13230,11 @@ var HeldSet = class extends Set {
|
|
|
13230
13230
|
async bindIds(id2) {
|
|
13231
13231
|
for (const holds2 of [...this]) await holds2.bindIds(id2);
|
|
13232
13232
|
}
|
|
13233
|
+
heldIds() {
|
|
13234
|
+
const out = /* @__PURE__ */ new Map();
|
|
13235
|
+
for (const holds2 of this) for (const [path, fid] of holds2.heldIds()) out.set(path, fid);
|
|
13236
|
+
return [...out];
|
|
13237
|
+
}
|
|
13233
13238
|
delete(holds2) {
|
|
13234
13239
|
const removed = super.delete(holds2);
|
|
13235
13240
|
for (const path of /* @__PURE__ */ new Set([...holds2.keys(), ...holds2.opens.keys()])) this.idle(path);
|
|
@@ -13296,6 +13301,14 @@ var HeldPaths = class extends Map {
|
|
|
13296
13301
|
this.bound.set(handle, { ...bound3, fid });
|
|
13297
13302
|
}
|
|
13298
13303
|
}
|
|
13304
|
+
heldIds() {
|
|
13305
|
+
const out = [];
|
|
13306
|
+
for (const [handle, key] of this.handles) {
|
|
13307
|
+
if (this.keptHandles.has(handle)) continue;
|
|
13308
|
+
out.push([key, this.bound.get(handle)?.fid]);
|
|
13309
|
+
}
|
|
13310
|
+
return out;
|
|
13311
|
+
}
|
|
13299
13312
|
trust(handle, doubt) {
|
|
13300
13313
|
if (this.doubted.get(handle) === doubt) this.doubted.delete(handle);
|
|
13301
13314
|
}
|
|
@@ -33504,6 +33517,10 @@ var Launcher = class {
|
|
|
33504
33517
|
for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
|
|
33505
33518
|
void this.rootFs.announceHolds?.([], [path, hidden], false);
|
|
33506
33519
|
}
|
|
33520
|
+
announceHeld() {
|
|
33521
|
+
const held = this.held.heldIds().filter(([path]) => this.mounts.locate(path) === void 0);
|
|
33522
|
+
return held.length === 0 ? void 0 : this.rootFs.announceHolds?.(held, [], false);
|
|
33523
|
+
}
|
|
33507
33524
|
rootFileId(path) {
|
|
33508
33525
|
return this.mounts.locate(path) === void 0 ? this.rootFs.bindId?.(path) : void 0;
|
|
33509
33526
|
}
|
|
@@ -33514,7 +33531,7 @@ var Launcher = class {
|
|
|
33514
33531
|
this.changes.flush();
|
|
33515
33532
|
this.changes.foreign(crowded);
|
|
33516
33533
|
if (crowded) {
|
|
33517
|
-
void this.held?.bindIds((path) => this.rootFileId(path));
|
|
33534
|
+
void this.held?.bindIds((path) => this.rootFileId(path)).then(() => this.announceHeld());
|
|
33518
33535
|
for (const nodes of this.openFiles) nodes.shared();
|
|
33519
33536
|
}
|
|
33520
33537
|
});
|