@ai-ecoverse/slicc-kernel 1.138.1 → 1.139.1

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
@@ -402,6 +402,7 @@ The module's default export (or its `main` export) is called with a context and
402
402
  - **Only the named descriptors reach the child.** Others the program holds, the other end of a pair included, don't, and a grandchild gets fd 3 only if the child names it again.
403
403
  - **The parent's copy:** the program keeps `f` and closes it itself when it no longer needs it, so the child sees end of file once it's the only one left.
404
404
  - **Why a `Record`:** it can't name a child fd twice, and it reads like Node's `stdio` index, so it's this rather than a list of `{ fd, from }`.
405
+ - `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` and `arrayBuffers`. 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`; there is no `rss`, which is the whole host's. In a browser `memory()` answers `{}` for now.
405
406
  - **`thread`, kernel threads of the same process** ([#1094](https://github.com/ai-ecoverse/slicc-kernel/issues/1094)), the base for Node's `worker_threads` (tinypool, piscina, vitest's and jest's thread pools, eslint's concurrency). `thread.spawn({ data, transfer })` resolves with `{ tid, port, exited, terminate() }`.
406
407
  - **What a thread is:** a new process worker in the **same process**. It has the same pid, descriptor table, cwd, umask, credentials and lockdown, and a sync lane of its own, so `sync` calls in one thread don't hold another.
407
408
  - **What it runs:** the program's same default export, called with a context whose `thread` is `{ tid, port, data }`. In the main thread `thread.tid` is `0` and `thread.port` is `undefined`. Threads are numbered from 1 per process, and a thread can spawn threads too.
@@ -1234,7 +1235,7 @@ Releases are cut by semantic-release on every push to `main`, in two jobs, and o
1234
1235
 
1235
1236
  Every change is certified in its pull request, before it merges (`cert-review-pr.yml`, next section), and `cert-review` is a required check of the merge queue, so every commit on `main`, and every release built from it, was certified first. A release is then **verified on npm** (`release / verify on npm` in `release.yml`, `tools/cert-review/verify.mjs`), in code, for every tag the run made:
1236
1237
 
1237
- - It waits up to an hour for npm to serve the version (an accepted publish can take a while to appear; 1.125.4 took 55 min). `release-recover` logs `npm publish`'s own output every time, and says PASS for a version it published only once npm serves it (the tarball answers) with `dist.integrity` equal to the tarball it packed; the reference is the `integrity` of `npm publish --json`'s own report, the bytes npm uploaded (a separate pack isn't byte-identical; 1.136.1 was served fine and still read as not served), and it publishes from the folder, never a tarball, so the packument keeps `gitHead`; an exit 0 without a report fails, and a version npm says is already published has no report, so it's only checked for being served; a version npm took but doesn't serve so after 25 min is `release-recover: INCOMPLETE`, and the publish job fails (#1228: 1.134.2 was taken, never served, and still read as PASS). A version semantic-release itself just published is handed to this job instead. A version npm still doesn't serve after the hour, and doesn't list, while a newer one of ours is its `latest`, ends with `verify: SKIPPED <name>@<version>: never served by npm; superseded by <latest>` (the gate takes SKIPPED like PASS); only after the whole wait, since a slow version can appear late and must not go unverified. SKIPPED writes no certified line, so nothing downstream reads it as certified; if npm serves a skipped version later, the coordinator's merge watchdog notes it within 10 min (any version that appears below npm's `latest`), and the coordinator re-runs `release / verify on npm` in that version's Release run for the normal verdict, the certified line or the supply-chain alert. One npm still doesn't serve, with nothing newer or a version list it can't read, is a "not served yet, re-run" failure, never a supply-chain alert. It then downloads the tarball and checks `dist.integrity` (sha512), the SLSA v1 provenance (the tarball's sha512 is its subject; `release.yml` on `refs/heads/main`, a GitHub-hosted builder; `gitCommit` = `gitHead` = the tag, on `main`), and `npm audit signatures`. npm serves a version's attestations a little after the version itself, so a 404 from the attestations, a missing `dist.attestations`, an `npm view` or network error while looking for them, or `npm audit signatures`' E404 on them, is retried within the same hour: it's a supply-chain alert only once the version has been served for 30 min, its packument has stopped changing for 10, and the attestations still answer 404, or the hour has run out. Any other status, or attestations that don't match, fail at once. A version that `release-recover.mjs` skipped because npm's `latest` is newer (#837) has nothing to verify.
1238
+ - It waits up to an hour for npm to serve the version (an accepted publish can take a while to appear; 1.125.4 took 55 min). `release-recover` publishes a version it has to recover with a plain `npm publish --provenance` from the folder (so the packument keeps `gitHead`) and logs npm's own exit code and output; it fails only on npm's own non-zero exit, and npm's "cannot publish over the previously published version" on a re-run counts as already done. Whether npm serves the version is this job's to check. A version npm still doesn't serve after the hour, and doesn't list, while a newer one of ours is its `latest`, ends with `verify: SKIPPED <name>@<version>: never served by npm; superseded by <latest>` (the gate takes SKIPPED like PASS); only after the whole wait, since a slow version can appear late and must not go unverified. SKIPPED writes no certified line, so nothing downstream reads it as certified; if npm serves a skipped version later, the coordinator's merge watchdog notes it within 10 min (any version that appears below npm's `latest`), and the coordinator re-runs `release / verify on npm` in that version's Release run for the normal verdict, the certified line or the supply-chain alert. One npm still doesn't serve, with nothing newer or a version list it can't read, is a "not served yet, re-run" failure, never a supply-chain alert. It then downloads the tarball and checks `dist.integrity` (sha512), the SLSA v1 provenance (the tarball's sha512 is its subject; `release.yml` on `refs/heads/main`, a GitHub-hosted builder; `gitCommit` = `gitHead` = the tag, on `main`), and `npm audit signatures`. npm serves a version's attestations a little after the version itself, so a 404 from the attestations, a missing `dist.attestations`, an `npm view` or network error while looking for them, or `npm audit signatures`' E404 on them, is retried within the same hour: it's a supply-chain alert only once the version has been served for 30 min, its packument has stopped changing for 10, and the attestations still answer 404, or the hour has run out. Any other status, or attestations that don't match, fail at once. A version that `release-recover.mjs` skipped because npm's `latest` is newer (#837) has nothing to verify.
1238
1239
  - It then writes `certified @ai-ecoverse/slicc-kernel@<v> sha256=<64 hex> (covers <first>–<v>; ci: <run>; pr-certified: <each merged pull request's cert-review at its merge>; known: <open known-issue issues>)` into the GitHub release's notes, between `<!-- cert-verify -->` markers. homescoop's ci reads exactly that prefix and re-hashes the npm tarball against it. `covers` starts after the last version npm serves, so a skipped version is covered by the next. Notes that already carry the identical line stay unchanged. A pull request's `cert-review` is the newest finished one (success, failure or error) on its head at or before its merge, or the newest pending one if none had finished. A re-review that a later `ready_for_review`, `reopened` or `cert-review-approved` event starts on the same head, still pending at the merge or ending after it, doesn't change what the merge queue saw, and a status posted after the merge can't change a release's line.
1239
1240
  - A mismatch writes no line. The job is red with a `supply-chain alert`, and so is a line already in the notes with another sha256.
1240
1241
 
@@ -7125,7 +7125,7 @@ function satisfies(version, range2) {
7125
7125
  }
7126
7126
 
7127
7127
  // src/version.ts
7128
- var KERNEL_VERSION = true ? "1.138.1" : "0.0.0-dev";
7128
+ var KERNEL_VERSION = true ? "1.139.1" : "0.0.0-dev";
7129
7129
  var OS_RELEASE = "6.0.0-slicc";
7130
7130
  function procVersion() {
7131
7131
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -1390,6 +1390,10 @@ function refused(specifier) {
1390
1390
  code: "ERR_ACCESS_DENIED"
1391
1391
  });
1392
1392
  }
1393
+ var BASE64_MODULE = "data:text/javascript;base64,";
1394
+ var fromBase64 = Buffer.from.bind(Buffer);
1395
+ var toText = Function.prototype.call.bind(Buffer.prototype.toString);
1396
+ var PLAIN_BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
1393
1397
  function refuseModules() {
1394
1398
  registerHooks({
1395
1399
  resolve(specifier, context, next) {
@@ -1397,11 +1401,18 @@ function refuseModules() {
1397
1401
  const resolved = next(specifier, context);
1398
1402
  if (!resolved.url.startsWith("data:")) throw refused(resolved.url);
1399
1403
  return resolved;
1404
+ },
1405
+ load(url, context, next) {
1406
+ const payload = url.startsWith(BASE64_MODULE) ? url.slice(BASE64_MODULE.length) : "";
1407
+ if (payload.length % 4 !== 0 || !PLAIN_BASE64.test(payload)) return next(url, context);
1408
+ const source = toText(fromBase64(payload, "base64"), "utf8");
1409
+ return { format: "module", source, shortCircuit: true };
1400
1410
  }
1401
1411
  });
1402
1412
  }
1403
1413
  var locked = /* @__PURE__ */ new WeakSet();
1404
1414
  var nodeProcess = typeof globalThis.process === "object" && globalThis.process !== null ? globalThis.process : void 0;
1415
+ var memoryUsage = process.memoryUsage.bind(process);
1405
1416
  function nodeLockdown(scope = globalThis) {
1406
1417
  if (locked.has(scope)) return;
1407
1418
  locked.add(scope);