@ai-ecoverse/slicc-kernel 1.141.0 → 1.141.2

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
@@ -7514,7 +7514,7 @@ function satisfies(version, range2) {
7514
7514
  }
7515
7515
 
7516
7516
  // src/version.ts
7517
- var KERNEL_VERSION = true ? "1.141.0" : "0.0.0-dev";
7517
+ var KERNEL_VERSION = true ? "1.141.2" : "0.0.0-dev";
7518
7518
  var OS_RELEASE = "6.0.0-slicc";
7519
7519
  function procVersion() {
7520
7520
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8452,6 +8452,8 @@ var CronService = class {
8452
8452
  }
8453
8453
  }
8454
8454
  async pass() {
8455
+ if (this.wake.signal.aborted) this.wake = new AbortController();
8456
+ const wake = this.wake;
8455
8457
  let until;
8456
8458
  try {
8457
8459
  until = await this.tick();
@@ -8460,8 +8462,7 @@ var CronService = class {
8460
8462
  until = this.clock.now() + WAKE_MS;
8461
8463
  }
8462
8464
  if (this.stopping.signal.aborted) return;
8463
- if (this.wake.signal.aborted) this.wake = new AbortController();
8464
- await this.clock.sleep(until, this.wake.signal);
8465
+ await this.clock.sleep(until, wake.signal);
8465
8466
  }
8466
8467
  async provision() {
8467
8468
  const { fs, owners } = this.host;
@@ -13608,6 +13609,10 @@ function mayTrace(viewer, target) {
13608
13609
  const uid = of.ruid === by.euid && of.euid === by.euid && of.suid === by.euid;
13609
13610
  return uid && of.rgid === by.egid && of.egid === by.egid && of.sgid === by.egid;
13610
13611
  }
13612
+ function fileIdentity(ino, mtimeMs) {
13613
+ if (ino === void 0 || mtimeMs === void 0 || !Number.isFinite(mtimeMs)) return void 0;
13614
+ return `${ino}:${Math.trunc(mtimeMs)}`;
13615
+ }
13611
13616
 
13612
13617
  // src/fs/pages.ts
13613
13618
  var PAGE = 64 * 1024;
@@ -14168,12 +14173,7 @@ var ProcTree = class {
14168
14173
  const exe = () => this.info(Number(top))?.exe === void 0 ? [] : ["exe"];
14169
14174
  return { kind: "dir", names: () => [...PID_NAMES, ...exe(), "task"] };
14170
14175
  }
14171
- if (leaf === "exe") {
14172
- const info = this.info(Number(top));
14173
- if (info?.exe === void 0) return void 0;
14174
- const denied2 = !mayTrace(this.ownInfo(), info);
14175
- return { kind: "link", target: info.exe, ...denied2 ? { denied: denied2 } : {} };
14176
- }
14176
+ if (leaf === "exe") return this.exe(Number(top));
14177
14177
  if (!PID_NAMES.includes(leaf)) return void 0;
14178
14178
  return {
14179
14179
  kind: "file",
@@ -14185,6 +14185,13 @@ var ProcTree = class {
14185
14185
  }
14186
14186
  };
14187
14187
  }
14188
+ exe(pid) {
14189
+ const info = this.info(pid);
14190
+ if (info?.exe === void 0) return void 0;
14191
+ const denied2 = !mayTrace(this.ownInfo(), info);
14192
+ const id2 = info.exeId === void 0 ? {} : { id: info.exeId };
14193
+ return { kind: "link", target: info.exe, ...denied2 ? { denied: denied2 } : {}, ...id2 };
14194
+ }
14188
14195
  ownInfo() {
14189
14196
  const processes2 = this.listing().processes;
14190
14197
  return processes2.find((p) => p.tid === this.pid) ?? processes2.find((p) => p.pid === this.pid);
@@ -14250,10 +14257,18 @@ var ProcTree = class {
14250
14257
  return node.names();
14251
14258
  }
14252
14259
  escape(path) {
14260
+ return this.escapeTo(path)?.target;
14261
+ }
14262
+ escapeTo(path) {
14253
14263
  const node = this.node(this.parts(path, true));
14254
14264
  if (node?.kind !== "link" || !node.target.startsWith("/")) return void 0;
14255
14265
  if (node.denied) throw syncError("EACCES", path);
14256
- return node.target;
14266
+ return node.id === void 0 ? { target: node.target } : { target: node.target, id: node.id };
14267
+ }
14268
+ linkTo(path) {
14269
+ const node = this.node(this.parts(path, false));
14270
+ if (node?.kind !== "link" || node.id === void 0 || node.denied) return void 0;
14271
+ return { target: node.target, id: node.id };
14257
14272
  }
14258
14273
  readlink(path) {
14259
14274
  const node = this.find(path, false);
@@ -27843,8 +27858,14 @@ function dataModuleUrl(source) {
27843
27858
  return { url: `data:text/javascript;base64,${btoa(binary2)}`, revoke: () => {
27844
27859
  } };
27845
27860
  }
27861
+ function exeIdOf(exeId) {
27862
+ return exeId === void 0 ? {} : { exeId };
27863
+ }
27846
27864
  function describe(req, tty) {
27847
- const exe = req.exe === void 0 ? {} : { exe: req.exe };
27865
+ const exe = {
27866
+ ...req.exe === void 0 ? {} : { exe: req.exe },
27867
+ ...req.exeId === void 0 ? {} : { exeId: req.exeId }
27868
+ };
27848
27869
  return { argv: [req.argv0, ...req.args], tty, started: Date.now(), ...exe };
27849
27870
  }
27850
27871
  function linksOf2(req) {
@@ -28990,6 +29011,15 @@ var Launcher = class {
28990
29011
  const optional = `${root}-names${beside.slice(root.length)}`;
28991
29012
  return await this.base.exists(optional) ? optional : void 0;
28992
29013
  }
29014
+ exeId(target) {
29015
+ if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
29016
+ return Promise.resolve({});
29017
+ }
29018
+ return this.base.stat(target.wasm).then(
29019
+ (st) => exeIdOf(fileIdentity(st.ino, st.mtime.getTime())),
29020
+ () => ({})
29021
+ );
29022
+ }
28993
29023
  async program(target, env, caller) {
28994
29024
  if (target.abi === "js" && target.wasm === SUDO_PATH) {
28995
29025
  return { abi: "js", glue: SUDO_SOURCE, path: SUDO_PATH };
@@ -29037,11 +29067,12 @@ var Launcher = class {
29037
29067
  const planned = chosen(asked, env);
29038
29068
  const { target, args } = planned;
29039
29069
  let program;
29070
+ let exeId;
29040
29071
  await this.pnpmReady();
29041
29072
  try {
29042
29073
  const caller = { pid: req.ppid ?? 0, uid: req.cred.euid, tag: req.tag };
29043
29074
  if (this.integrity) await this.checkedSources(planned, caller);
29044
- program = await this.program(target, env, caller);
29075
+ [program, exeId] = await Promise.all([this.program(target, env, caller), this.exeId(target)]);
29045
29076
  } catch (err) {
29046
29077
  await req.fds.closeAll();
29047
29078
  throw err;
@@ -29060,6 +29091,7 @@ var Launcher = class {
29060
29091
  program,
29061
29092
  argv0: target.argv0,
29062
29093
  exe: target.copy ?? target.glue,
29094
+ ...exeId,
29063
29095
  args,
29064
29096
  env,
29065
29097
  cwdSlot