@ai-ecoverse/slicc-kernel 1.73.2 → 1.74.0

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
@@ -3713,13 +3713,10 @@ var OpfsFs = class {
3713
3713
  this.dirDirty.delete(path);
3714
3714
  const ms = this.dirTimes.get(path);
3715
3715
  if (ms === void 0) continue;
3716
- await this.meta.update(path, (entry) => ({
3717
- ...entry,
3716
+ await this.meta.update(
3718
3717
  path,
3719
- mtimeMs: ms,
3720
- mtimeFor: 0,
3721
- ctimeMs: ms
3722
- }));
3718
+ (entry) => (entry?.timesAt ?? -1) >= ms ? entry : { ...entry, path, mtimeMs: ms, mtimeFor: 0, ctimeMs: ms }
3719
+ );
3723
3720
  if (this.dirTimes.get(path) === ms) this.dirTimes.delete(path);
3724
3721
  }
3725
3722
  }
@@ -4173,7 +4170,8 @@ var OpfsFs = class {
4173
4170
  atimeMs: atime.getTime(),
4174
4171
  mtimeMs: mtime.getTime(),
4175
4172
  mtimeFor: file?.lastModified ?? 0,
4176
- ctimeMs
4173
+ ctimeMs,
4174
+ timesAt: ctimeMs
4177
4175
  }));
4178
4176
  }
4179
4177
  async reconcile() {
@@ -7201,6 +7199,36 @@ function revokeSyncFsToken(token) {
7201
7199
  }
7202
7200
 
7203
7201
  // src/realm/sync-fs-wire.ts
7202
+ var SYNC_FS_OPS = [
7203
+ "read",
7204
+ "write",
7205
+ "exists",
7206
+ "stat",
7207
+ "lstat",
7208
+ "readdir",
7209
+ "readdir-stat",
7210
+ "mkdir",
7211
+ "rm",
7212
+ "rename",
7213
+ "link",
7214
+ "unlink",
7215
+ "rmdir",
7216
+ "symlink",
7217
+ "readlink",
7218
+ "chmod",
7219
+ "utimes",
7220
+ "lutimes",
7221
+ "statfs",
7222
+ "hold",
7223
+ "create",
7224
+ "kept",
7225
+ "pread",
7226
+ "pwrite",
7227
+ "truncate",
7228
+ "chown",
7229
+ "lchown",
7230
+ "access"
7231
+ ];
7204
7232
  var HOLD_READ = 4;
7205
7233
  var HOLD_WRITE = 8;
7206
7234
  var HOLD_CREATED = 16;
@@ -8090,6 +8118,9 @@ var AsyncRangedFile = class {
8090
8118
  }
8091
8119
  };
8092
8120
 
8121
+ // src/realm/sync-sab-bridge.ts
8122
+ var PATH_OPS = new Set(SYNC_FS_OPS);
8123
+
8093
8124
  // src/realm/live-vfs-fs.ts
8094
8125
  var EARLY_WHOLE_FILE = 64 * 1024;
8095
8126
 
@@ -10908,7 +10939,14 @@ async function runChild(req, deps) {
10908
10939
  ];
10909
10940
  try {
10910
10941
  pid = await deps.children.spawn(
10911
- { file: req.file, argv: req.argv, env: req.env, cwd: req.cwd },
10942
+ {
10943
+ file: req.file,
10944
+ argv: req.argv,
10945
+ env: req.env,
10946
+ cwd: req.cwd,
10947
+ ...req.pgid !== void 0 ? { pgid: req.pgid } : {},
10948
+ ...req.session ? { session: req.session } : {}
10949
+ },
10912
10950
  stdio
10913
10951
  );
10914
10952
  } catch (e) {
@@ -11861,8 +11899,9 @@ var WasmProcess = class {
11861
11899
  return "deliver";
11862
11900
  }
11863
11901
  async spawn(req) {
11864
- const { file, argv, env, cwd, stdio, inherit: inherit2, exec } = req;
11865
- const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
11902
+ const { file, argv, env, cwd, stdio, inherit: inherit2, exec, pgid, session } = req;
11903
+ const group = { ...pgid !== void 0 ? { pgid } : {}, ...session ? { session } : {} };
11904
+ const spawned = { file, argv, env, cwd, ...group, ...exec ? { exec } : {} };
11866
11905
  const pid = await this.children.spawn(spawned, stdio, inherit2);
11867
11906
  if (!exec) return pid;
11868
11907
  if (this.killed) void Promise.allSettled([this.options.kill?.(pid, SIG.KILL)]);
@@ -13156,6 +13195,9 @@ var JobTable = class {
13156
13195
  member.pgid = pgid;
13157
13196
  member.sid = sid;
13158
13197
  }
13198
+ lead(pid) {
13199
+ this.member(pid).pgid = this.idOf(pid);
13200
+ }
13159
13201
  pgidOf(pid) {
13160
13202
  return this.members.get(pid)?.pgid;
13161
13203
  }
@@ -16244,7 +16286,7 @@ var Launcher = class {
16244
16286
  start(req) {
16245
16287
  this.sampling();
16246
16288
  if (req.pgid !== void 0 && this.jobs.sessionOf(req.pgid) === void 0) {
16247
- throw fsError("ESRCH", `no process group ${req.pgid}`);
16289
+ throw new SpawnError("ESRCH");
16248
16290
  }
16249
16291
  const pid = this.nextPid++;
16250
16292
  const stack = this.stackFor(req.tag);
@@ -16319,6 +16361,8 @@ var Launcher = class {
16319
16361
  this.jobs.add(pid, req.ppid, (sig) => handle.signal(sig), terminal);
16320
16362
  if (req.exec && req.ppid !== void 0) this.jobs.exec(req.ppid, pid, true);
16321
16363
  if (req.pgid !== void 0) this.jobs.join(pid, req.pgid);
16364
+ if (req.group === "lead") this.jobs.lead(pid);
16365
+ if (req.group === "session") this.jobs.setsid(pid);
16322
16366
  this.described.set(pid, {
16323
16367
  argv: [req.argv0, ...req.args],
16324
16368
  tty: terminal?.name ?? null,
@@ -16480,6 +16524,11 @@ var Launcher = class {
16480
16524
  await fds.closeAll();
16481
16525
  throw new SpawnError("EACCES");
16482
16526
  }
16527
+ const group = this.childGroup(ppid, req);
16528
+ if (typeof group === "string") {
16529
+ await fds.closeAll();
16530
+ throw new SpawnError(group);
16531
+ }
16483
16532
  const cred = grant ? grant.cred : this.credOf(ppid);
16484
16533
  const scope = grant ? "" : await this.scopeOf(cred.euid);
16485
16534
  const planned = await this.plan(req.file, req.argv, req.cwd, scope);
@@ -16506,6 +16555,7 @@ var Launcher = class {
16506
16555
  umask: this.umaskOf(ppid),
16507
16556
  cred,
16508
16557
  tag: this.tagOf(ppid),
16558
+ ...group,
16509
16559
  ...exec
16510
16560
  });
16511
16561
  deciding?.attach();
@@ -16513,6 +16563,17 @@ var Launcher = class {
16513
16563
  return childHandle(handle);
16514
16564
  };
16515
16565
  }
16566
+ childGroup(ppid, req) {
16567
+ const { pgid, session } = req;
16568
+ if (pgid === void 0 && session === void 0) return {};
16569
+ const valid2 = pgid === void 0 || Number.isInteger(pgid) && pgid >= 0;
16570
+ if (req.exec || !valid2 || session !== void 0 && session !== true) return "EINVAL";
16571
+ if (session) return pgid === void 0 ? { group: "session" } : "EINVAL";
16572
+ if (pgid === 0) return { group: "lead" };
16573
+ const sid = this.jobs.sessionOf(pgid);
16574
+ if (sid === void 0) return "ESRCH";
16575
+ return sid === this.jobs.sidOf(ppid) ? { pgid } : "EPERM";
16576
+ }
16516
16577
  undecided(ppid) {
16517
16578
  const decided = Promise.withResolvers();
16518
16579
  return {
@@ -16543,7 +16604,7 @@ var Launcher = class {
16543
16604
  }, 0);
16544
16605
  }
16545
16606
  forker(ppid, parent) {
16546
- const { exec: _exec, ...image } = parent;
16607
+ const { exec: _exec, pgid: _pgid, group: _group, ...image } = parent;
16547
16608
  return async (state, fds) => childHandle(
16548
16609
  this.start({
16549
16610
  ...image,