@ai-ecoverse/slicc-kernel 1.162.0 → 1.162.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.
@@ -7365,7 +7365,7 @@ var init_version = __esm({
7365
7365
  "src/version.ts"() {
7366
7366
  "use strict";
7367
7367
  init_captured_globals();
7368
- KERNEL_VERSION = true ? "1.162.0" : "0.0.0-dev";
7368
+ KERNEL_VERSION = true ? "1.162.1" : "0.0.0-dev";
7369
7369
  OS_RELEASE = "6.0.0-slicc";
7370
7370
  }
7371
7371
  });
package/dist/node.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/node.ts
2
2
  import { createHash } from "node:crypto";
3
- import { lstatSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
3
+ import { lstatSync, mkdirSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { isAbsolute, join } from "node:path";
6
6
  import { MessageChannel as MessageChannel2, Worker } from "node:worker_threads";
@@ -2212,7 +2212,9 @@ var KernelSocket = class _KernelSocket {
2212
2212
  throw new KernelError("ECONNRESET", "read ECONNRESET");
2213
2213
  return bytes.length > 0 ? bytes : null;
2214
2214
  },
2215
- write: (bytes) => raw2.tx.write(bytes),
2215
+ write: (bytes) => raw2.tx.write(bytes).catch((err) => {
2216
+ throw this.refused ? new KernelError("ECONNRESET", "read ECONNRESET") : err;
2217
+ }),
2216
2218
  closeWrite: () => raw2.tx.closeWrite(),
2217
2219
  close: () => {
2218
2220
  raw2.rx.closeRead();
@@ -3675,7 +3677,7 @@ function satisfies(version, range2) {
3675
3677
  }
3676
3678
 
3677
3679
  // src/version.ts
3678
- var KERNEL_VERSION = true ? "1.162.0" : "0.0.0-dev";
3680
+ var KERNEL_VERSION = true ? "1.162.1" : "0.0.0-dev";
3679
3681
  var OS_RELEASE = "6.0.0-slicc";
3680
3682
  function procVersion() {
3681
3683
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -35355,25 +35357,38 @@ function ownCacheDir(make = privateCacheDir) {
35355
35357
  }
35356
35358
  }
35357
35359
  var swept = false;
35358
- function privateCacheDir(base = tmpdir(), alive = pidAlive) {
35360
+ function privateCacheDir(base = tmpdir(), alive = pidAlive, uid = process.getuid?.()) {
35361
+ const parent = cacheParent(base, uid);
35359
35362
  if (!swept) {
35360
35363
  swept = true;
35361
- sweepCacheDirs(base, alive);
35364
+ sweepCacheDirs(parent, alive, uid);
35365
+ }
35366
+ return mkdtempSync(join(parent, `${process.pid}-`));
35367
+ }
35368
+ function cacheParent(base, uid) {
35369
+ const parent = join(base, uid === void 0 ? "slicc-kernel-cc" : `${CACHE_PREFIX}u${uid}`);
35370
+ try {
35371
+ mkdirSync(parent, { mode: 448 });
35372
+ } catch (err) {
35373
+ if (err.code !== "EEXIST") throw err;
35374
+ }
35375
+ const st = lstatSync(parent);
35376
+ if (!st.isDirectory() || uid !== void 0 && (st.uid !== uid || (st.mode & 63) !== 0)) {
35377
+ throw new Error(`slicc-kernel: ${parent} is not a private directory of this user`);
35362
35378
  }
35363
- return mkdtempSync(join(base, `${CACHE_PREFIX}${process.pid}-`));
35379
+ return parent;
35364
35380
  }
35365
- function sweepCacheDirs(base, alive = pidAlive, uid = process.getuid?.()) {
35381
+ function sweepCacheDirs(parent, alive = pidAlive, uid = process.getuid?.()) {
35366
35382
  let names2;
35367
35383
  try {
35368
- names2 = readdirSync(base);
35384
+ names2 = readdirSync(parent);
35369
35385
  } catch {
35370
35386
  return;
35371
35387
  }
35372
35388
  for (const name2 of names2) {
35373
- if (!name2.startsWith(CACHE_PREFIX)) continue;
35374
- const pid = Number(name2.slice(CACHE_PREFIX.length).split("-")[0]);
35389
+ const pid = Number(name2.split("-")[0]);
35375
35390
  if (!Number.isInteger(pid) || pid <= 0 || alive(pid)) continue;
35376
- removeOurs(join(base, name2), uid);
35391
+ removeOurs(join(parent, name2), uid);
35377
35392
  }
35378
35393
  }
35379
35394
  function removeOurs(path, uid) {