@ai-ecoverse/slicc-kernel 1.139.1 → 1.140.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
@@ -3740,8 +3740,9 @@ var MemoryMeta = class {
3740
3740
  this.entries.set(to, moved(root(carried.find((entry) => entry.path === from)), to));
3741
3741
  if (left) this.entries.set(from, left);
3742
3742
  }
3743
- async remove(paths) {
3743
+ async remove(paths, left) {
3744
3744
  for (const path of paths) this.entries.deleteTree(path);
3745
+ if (left) this.entries.set(left.path, left);
3745
3746
  }
3746
3747
  absent(path) {
3747
3748
  return !this.entries.has(path);
@@ -5590,10 +5591,10 @@ var OpfsFs = class {
5590
5591
  return;
5591
5592
  }
5592
5593
  }
5593
- await this.meta.remove([found.path]);
5594
- if (found.handle?.kind === "directory") {
5595
- await this.meta.update(found.path, (entry) => entry ?? vacatedAt(found.path));
5596
- }
5594
+ await this.meta.remove(
5595
+ [found.path],
5596
+ found.handle?.kind === "directory" ? vacatedAt(found.path) : void 0
5597
+ );
5597
5598
  this.touch(Date.now(), parentOf4(found.path));
5598
5599
  }
5599
5600
  links() {
@@ -7513,7 +7514,7 @@ function satisfies(version, range2) {
7513
7514
  }
7514
7515
 
7515
7516
  // src/version.ts
7516
- var KERNEL_VERSION = true ? "1.139.1" : "0.0.0-dev";
7517
+ var KERNEL_VERSION = true ? "1.140.1" : "0.0.0-dev";
7517
7518
  var OS_RELEASE = "6.0.0-slicc";
7518
7519
  function procVersion() {
7519
7520
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -9815,6 +9816,70 @@ function devCreation(path, cred) {
9815
9816
  return cred && cred.euid !== 0 ? "EACCES" : "EPERM";
9816
9817
  }
9817
9818
 
9819
+ // src/fs/etc-files.ts
9820
+ var HOSTNAME_PATH = "/etc/hostname";
9821
+ var S_IFREG3 = 32768;
9822
+ function missing4(err) {
9823
+ return err?.code === "ENOENT";
9824
+ }
9825
+ function statOf(path, bytes) {
9826
+ const epoch = /* @__PURE__ */ new Date(0);
9827
+ return {
9828
+ isFile: true,
9829
+ isDirectory: false,
9830
+ isSymbolicLink: false,
9831
+ size: bytes.length,
9832
+ mode: S_IFREG3 | 420,
9833
+ mtime: epoch,
9834
+ atime: epoch,
9835
+ ctime: epoch,
9836
+ ino: inodeOf(path),
9837
+ nlink: 1,
9838
+ uid: 0,
9839
+ gid: 0
9840
+ };
9841
+ }
9842
+ function withEtcFiles(fs, files) {
9843
+ const bytesOf4 = (path) => {
9844
+ const text = files.get(path)?.();
9845
+ return text === void 0 ? void 0 : new TextEncoder().encode(text);
9846
+ };
9847
+ const absent2 = (path) => fs.lstat(path).then(() => false, missing4);
9848
+ const fallback = (path, make) => async (err) => {
9849
+ const bytes = missing4(err) && files.has(path) && await absent2(path) ? bytesOf4(path) : void 0;
9850
+ if (bytes === void 0) throw err;
9851
+ return make(bytes);
9852
+ };
9853
+ const ranged2 = rangedOps(fs);
9854
+ const own = {
9855
+ stat: (path) => fs.stat(path).catch(fallback(path, (b) => statOf(path, b))),
9856
+ lstat: (path) => fs.lstat(path).catch(fallback(path, (b) => statOf(path, b))),
9857
+ exists: async (path) => await fs.exists(path) || files.has(path) && await absent2(path),
9858
+ ...fs.createExclusive ? {
9859
+ createExclusive: async (path, owner) => {
9860
+ if (files.has(path) && await absent2(path)) throw fsError("EEXIST", path);
9861
+ return fs.createExclusive.call(
9862
+ fs,
9863
+ path,
9864
+ owner
9865
+ );
9866
+ }
9867
+ } : {},
9868
+ readFile: (path) => fs.readFile(path).catch(fallback(path, (b) => new TextDecoder().decode(b))),
9869
+ readFileBuffer: (path) => fs.readFileBuffer(path).catch(fallback(path, (b) => b)),
9870
+ ...ranged2 ? {
9871
+ pread: (path, offset, length2, version) => ranged2.pread(path, offset, length2, version).catch(fallback(path, (b) => b.slice(offset, offset + length2)))
9872
+ } : {}
9873
+ };
9874
+ return new Proxy(fs, {
9875
+ get(target, key, receiver) {
9876
+ if (Object.hasOwn(own, key)) return own[key];
9877
+ const value2 = Reflect.get(target, key, receiver);
9878
+ return typeof value2 === "function" ? value2.bind(target) : value2;
9879
+ }
9880
+ });
9881
+ }
9882
+
9818
9883
  // src/fs/fresh-modules.ts
9819
9884
  var MAGIC = [0, 97, 115, 109];
9820
9885
  var MAX_FRESH = 65536;
@@ -11270,7 +11335,7 @@ function inodeless(mount, attr2) {
11270
11335
  if (mount.caps.links) mount.caps = { ...mount.caps, links: false };
11271
11336
  return true;
11272
11337
  }
11273
- function statOf(attr2, path, mount) {
11338
+ function statOf2(attr2, path, mount) {
11274
11339
  const mtime = new Date(attr2.mtime);
11275
11340
  const fallback = attr2.kind === "directory" ? 16877 : attr2.kind === "symlink" ? 41471 : attr2.kind === "fifo" ? 4516 : 33188;
11276
11341
  return {
@@ -11742,7 +11807,7 @@ var MountFs = class _MountFs {
11742
11807
  const { mount, rel: rel2 } = found;
11743
11808
  if (!owner || !mount.owners || !mount.caps.owners) return void 0;
11744
11809
  const dir = parentOf7(real);
11745
- const above = statOf(await this.table.getattr(mount, dir, parentOf7(rel2)), dir, mount);
11810
+ const above = statOf2(await this.table.getattr(mount, dir, parentOf7(rel2)), dir, mount);
11746
11811
  const setgid = (above.mode & S_ISGID4) !== 0;
11747
11812
  let mode = owner.mode;
11748
11813
  if (directory && setgid) mode = (mode ?? 493) | S_ISGID4;
@@ -12074,7 +12139,7 @@ var MountFs = class _MountFs {
12074
12139
  }
12075
12140
  statWriting(attr2, real, mount) {
12076
12141
  const ends = (this.table.writing(real)?.extents ?? []).map(([, end]) => end);
12077
- return statOf({ ...attr2, size: Math.max(attr2.size, ...ends) }, real, mount);
12142
+ return statOf2({ ...attr2, size: Math.max(attr2.size, ...ends) }, real, mount);
12078
12143
  }
12079
12144
  async stat(path, redirects = 0) {
12080
12145
  const real = await this.follow(path);
@@ -15485,11 +15550,11 @@ function ipv6(host) {
15485
15550
  const back = halves.length === 2 ? groups(halves[1]) : [];
15486
15551
  if (![...head, ...back].every((g) => /^[0-9A-Fa-f]{1,4}$/.test(g))) return void 0;
15487
15552
  const words2 = [...head, ...back].map((g) => Number.parseInt(g, 16));
15488
- const missing4 = 8 - words2.length - tail2.length;
15489
- if (halves.length === 2 ? missing4 < 1 : missing4 !== 0) return void 0;
15553
+ const missing5 = 8 - words2.length - tail2.length;
15554
+ if (halves.length === 2 ? missing5 < 1 : missing5 !== 0) return void 0;
15490
15555
  const all = [
15491
15556
  ...head.map((g) => Number.parseInt(g, 16)),
15492
- ...new Array(halves.length === 2 ? missing4 : 0).fill(0),
15557
+ ...new Array(halves.length === 2 ? missing5 : 0).fill(0),
15493
15558
  ...back.map((g) => Number.parseInt(g, 16)),
15494
15559
  ...tail2
15495
15560
  ];
@@ -27806,13 +27871,13 @@ function interpreter(head) {
27806
27871
  function expandDefaults(defaults2, env) {
27807
27872
  const out = {};
27808
27873
  for (const [key, value2] of Object.entries(defaults2 ?? {})) {
27809
- let missing4 = false;
27874
+ let missing5 = false;
27810
27875
  const expanded = value2.replace(ENV_REFERENCE, (_, name2) => {
27811
27876
  const set3 = Object.hasOwn(env, name2) ? env[name2] : void 0;
27812
- if (set3 === void 0) missing4 = true;
27877
+ if (set3 === void 0) missing5 = true;
27813
27878
  return set3 ?? "";
27814
27879
  });
27815
- if (!missing4) out[key] = expanded;
27880
+ if (!missing5) out[key] = expanded;
27816
27881
  }
27817
27882
  return out;
27818
27883
  }
@@ -29983,7 +30048,8 @@ var Launcher = class {
29983
30048
  }
29984
30049
  commandFs(root) {
29985
30050
  return withCommandDirs(
29986
- root,
30051
+ withEtcFiles(root, /* @__PURE__ */ new Map([[HOSTNAME_PATH, () => `${this.hostname}
30052
+ `]])),
29987
30053
  async () => this.commandNames(await this.commands()),
29988
30054
  (dir) => this.userCommandDir(dir),
29989
30055
  this.owners,