@ai-ecoverse/slicc-kernel 1.99.0 → 1.99.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/dist/node.js CHANGED
@@ -3272,7 +3272,7 @@ function serveClient(port, host) {
3272
3272
  case "umount":
3273
3273
  return { result: await l.umountAs(clientCred(self), req.target).then(() => true) };
3274
3274
  case "mounts":
3275
- return { result: l.mounts.list() };
3275
+ return { result: l.mounts.listed() };
3276
3276
  case "dial":
3277
3277
  return dialFor(l, req, watches);
3278
3278
  case "serve-cdp":
@@ -7479,6 +7479,18 @@ function withCommandDirs(fs, names, userDir = async () => void 0, owners = false
7479
7479
  };
7480
7480
  }
7481
7481
 
7482
+ // src/fs/dev-removal.ts
7483
+ var SHM = "/dev/shm";
7484
+ function inDevTree(path) {
7485
+ if (path.startsWith(`${SHM}/`)) return false;
7486
+ return path === "/dev" || path.startsWith("/dev/");
7487
+ }
7488
+ function devRemoval(path, cred) {
7489
+ if (!inDevTree(path)) return void 0;
7490
+ if (cred && cred.euid !== 0) return "EACCES";
7491
+ return path === "/dev" ? "EBUSY" : "EPERM";
7492
+ }
7493
+
7482
7494
  // src/fs/fresh-modules.ts
7483
7495
  var MAGIC = [0, 97, 115, 109];
7484
7496
  var MAX_FRESH = 65536;
@@ -8605,6 +8617,7 @@ var MountTable = class {
8605
8617
  devices = 0;
8606
8618
  pending = /* @__PURE__ */ new Set();
8607
8619
  notes = /* @__PURE__ */ new Map();
8620
+ system = /* @__PURE__ */ new Set();
8608
8621
  deps;
8609
8622
  constructor(deps) {
8610
8623
  this.deps = deps;
@@ -8626,6 +8639,13 @@ var MountTable = class {
8626
8639
  const noted = [...this.notes.values()].filter((note) => !this.mounts.has(note.target));
8627
8640
  return [...mounted, ...noted.map((note) => ({ ...note, options: { ...note.options } }))];
8628
8641
  }
8642
+ listed() {
8643
+ return this.list().filter((entry) => !this.system.has(entry.target));
8644
+ }
8645
+ async mountSystem(spec, fs) {
8646
+ await this.mount(spec, fs);
8647
+ this.system.add(normalizePath(spec.target));
8648
+ }
8629
8649
  note(spec, state, error) {
8630
8650
  const target = normalizePath(spec.target);
8631
8651
  this.notes.set(target, {
@@ -8732,6 +8752,7 @@ var MountTable = class {
8732
8752
  if (!mount && this.notes.delete(at)) return;
8733
8753
  if (!mount) throw errnoError("EINVAL", `${at} is not mounted`);
8734
8754
  if (!detach && this.deps.busy(at)) throw errnoError("EBUSY", `${at} has open files`);
8755
+ this.system.delete(at);
8735
8756
  this.notes.delete(at);
8736
8757
  this.mounts.delete(at);
8737
8758
  this.deps.reshaped?.();
@@ -9640,16 +9661,6 @@ var MountFs = class _MountFs {
9640
9661
  }
9641
9662
  };
9642
9663
 
9643
- // src/fs/dev-removal.ts
9644
- function inDevTree(path) {
9645
- return path === "/dev" || path.startsWith("/dev/");
9646
- }
9647
- function devRemoval(path, cred) {
9648
- if (!inDevTree(path)) return void 0;
9649
- if (cred && cred.euid !== 0) return "EACCES";
9650
- return path === "/dev" ? "EBUSY" : "EPERM";
9651
- }
9652
-
9653
9664
  // src/realm/sync-fs-token-registry.ts
9654
9665
  var registry = /* @__PURE__ */ new Map();
9655
9666
  function mintSyncFsToken(entry) {
@@ -11078,7 +11089,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11078
11089
  var EARLY_WHOLE_FILE = 64 * 1024;
11079
11090
 
11080
11091
  // src/version.ts
11081
- var KERNEL_VERSION = true ? "1.99.0" : "0.0.0-dev";
11092
+ var KERNEL_VERSION = true ? "1.99.1" : "0.0.0-dev";
11082
11093
  var OS_RELEASE = "6.0.0-slicc";
11083
11094
  function procVersion() {
11084
11095
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -20307,6 +20318,9 @@ var NOT_EXECUTABLE = 126;
20307
20318
  var DECIDE_MS = 100;
20308
20319
  var INIT_PID = 1;
20309
20320
  var SHARED_DIRS = ["/tmp", "/home"];
20321
+ function unref2(port) {
20322
+ port.unref?.();
20323
+ }
20310
20324
  var LAYOUT = [
20311
20325
  ["/", 493],
20312
20326
  ["/root", 448],
@@ -20517,6 +20531,7 @@ var Launcher = class {
20517
20531
  pnpmMade;
20518
20532
  pnpmEpoch = 0;
20519
20533
  mounts;
20534
+ shmPorts = [];
20520
20535
  createDriverWorker;
20521
20536
  media;
20522
20537
  onMountPending;
@@ -21781,6 +21796,7 @@ var Launcher = class {
21781
21796
  },
21782
21797
  { owned: true }
21783
21798
  );
21799
+ if (spec.target === SHM) this.shmPorts = [port1, port2];
21784
21800
  return {
21785
21801
  port: port1,
21786
21802
  dispose: () => {
@@ -21883,6 +21899,12 @@ var Launcher = class {
21883
21899
  this.pnpmStale();
21884
21900
  return entry;
21885
21901
  }
21902
+ async mountShm() {
21903
+ await this.base.mkdir(SHM, { recursive: true });
21904
+ await this.mounts.mountSystem({ type: "tmpfs", source: "shm", target: SHM }, this.fs);
21905
+ for (const port of this.shmPorts) unref2(port);
21906
+ await this.fs.chmod(SHM, 1023);
21907
+ }
21886
21908
  async ownTmp() {
21887
21909
  const real = await this.realLayoutPath("/tmp");
21888
21910
  const st = real === void 0 ? void 0 : await this.base.lstat(real).catch(() => void 0);
@@ -22039,6 +22061,7 @@ var Launcher = class {
22039
22061
  await this.resolvePrefixes();
22040
22062
  for (const dir of SHARED_DIRS) await this.base.mkdir(dir, { recursive: true });
22041
22063
  if (this.owners) await this.ownTmp();
22064
+ await this.mountShm();
22042
22065
  await this.pnpmReady();
22043
22066
  await this.users.ensure();
22044
22067
  if (this.owners) await this.stampLayout();
@@ -23779,7 +23802,7 @@ async function createNodeKernel(options = {}) {
23779
23802
  readFile: async (path) => launcher.fs.readFileBuffer(path),
23780
23803
  mount: (spec) => guard2(() => launcher.mount(spec)),
23781
23804
  umount: (target) => guard2(async () => launcher.umount(target)),
23782
- mounts: async () => launcher.mounts.list(),
23805
+ mounts: async () => launcher.mounts.listed(),
23783
23806
  setRoutes: (routes) => guard2(async () => launcher.setRoutes(routes)),
23784
23807
  updateTransportTraits: () => guard2(async () => launcher.updateTransportTraits()),
23785
23808
  users: {