@ai-ecoverse/slicc-kernel 1.147.5 → 1.147.6

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
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.147.5" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.147.6" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -6913,13 +6913,14 @@ var FsWatchers = class {
6913
6913
  this.watchers.delete(watcher);
6914
6914
  };
6915
6915
  }
6916
- typedWatch(root, recursive, alias) {
6916
+ typedWatch(root, recursive, alias, directory = recursive) {
6917
6917
  const main = normalizePath(root);
6918
6918
  const other = alias === void 0 ? main : normalizePath(alias);
6919
6919
  const watch = {
6920
6920
  roots: other === main ? [main] : [main, other],
6921
6921
  names: /* @__PURE__ */ new Map(),
6922
6922
  recursive,
6923
+ directory,
6923
6924
  notes: [],
6924
6925
  overflowed: false,
6925
6926
  ended: false,
@@ -7007,6 +7008,19 @@ var FsWatchers = class {
7007
7008
  if (!followed2.has(watch)) route(watch, "rename", at, seq2);
7008
7009
  }
7009
7010
  }
7011
+ heard(type, paths) {
7012
+ if (this.typed.size === 0) return;
7013
+ for (const path of paths) {
7014
+ const at = normalizePath(path);
7015
+ const seq2 = ++this.seq;
7016
+ for (const watch of [...this.typed]) {
7017
+ if (type === "rename" && watch.roots.some((root) => at === root || under2(root, at)))
7018
+ continue;
7019
+ if (type === "change" && watch.directory && watch.roots.includes(at)) continue;
7020
+ route(watch, type, at, seq2);
7021
+ }
7022
+ }
7023
+ }
7010
7024
  changed(...paths) {
7011
7025
  this.report(paths);
7012
7026
  this.emit("change", paths);
@@ -21795,7 +21809,7 @@ var RemoteWatch = class {
21795
21809
  if (data.ack !== void 0 && data.to === this.tab && data.from !== void 0) {
21796
21810
  this.acked(data.ack, data.from);
21797
21811
  }
21798
- if (data.changed !== void 0) this.emit({ paths: data.changed, trees: [] });
21812
+ if (data.changed !== void 0) this.emit({ paths: data.changed, trees: [], content: true });
21799
21813
  }
21800
21814
  arrived(peer) {
21801
21815
  this.peers.add(peer);
@@ -23413,6 +23427,18 @@ var Extent = class {
23413
23427
  };
23414
23428
  var LOCKED = /* @__PURE__ */ new Set(["NotReadableError", "NoModificationAllowedError", "InvalidStateError"]);
23415
23429
  var SYNC_BACKOFF_MS = [5, 10, 20, 40, 80];
23430
+ async function unlocked(name2, op) {
23431
+ for (let attempt = 0; ; attempt++) {
23432
+ try {
23433
+ return await op();
23434
+ } catch (err) {
23435
+ if (!LOCKED.has(err?.name)) throw err;
23436
+ const delay = SYNC_BACKOFF_MS[attempt];
23437
+ if (delay === void 0) throw fsError("EBUSY", name2);
23438
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
23439
+ }
23440
+ }
23441
+ }
23416
23442
  async function openSync(handle) {
23417
23443
  const sync = handle.createSyncAccessHandle;
23418
23444
  if (!sync) return void 0;
@@ -23535,7 +23561,12 @@ var OpfsFs = class {
23535
23561
  meta.listen?.((c) => {
23536
23562
  for (const path of [...c.paths ?? [], ...c.trees ?? []]) this.forget(path);
23537
23563
  const moved2 = movedOf(c.moved);
23538
- remote?.emit({ paths: c.paths ?? [], trees: c.trees ?? [], ...moved2 ? { moved: moved2 } : {} });
23564
+ remote?.emit({
23565
+ paths: c.paths ?? [],
23566
+ trees: c.trees ?? [],
23567
+ content: true,
23568
+ ...moved2 ? { moved: moved2 } : {}
23569
+ });
23539
23570
  });
23540
23571
  remote?.listen((c) => {
23541
23572
  for (const path of [...c.paths, ...c.trees]) this.forget(path);
@@ -24603,7 +24634,10 @@ var OpfsFs = class {
24603
24634
  try {
24604
24635
  await this.inDir(
24605
24636
  dir,
24606
- (parent) => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
24637
+ (parent) => unlocked(
24638
+ name2,
24639
+ () => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
24640
+ )
24607
24641
  );
24608
24642
  } catch (err) {
24609
24643
  throw translate(err, path);
@@ -28295,6 +28329,8 @@ var Launcher = class {
28295
28329
  this.changes.flush();
28296
28330
  this.cwds.touched(change.paths, change.trees);
28297
28331
  this.rewritten(change.paths, change.trees);
28332
+ this.watchers.heard(change.content ? "change" : "rename", change.paths);
28333
+ this.watchers.heard("rename", change.trees ?? []);
28298
28334
  });
28299
28335
  const holders = [this.held, this.openFiles];
28300
28336
  this.unlinked = new UnlinkedKeeper(
@@ -29973,7 +30009,12 @@ var Launcher = class {
29973
30009
  if (g) await readable(g, "watch", at);
29974
30010
  const st = await this.fs.stat(at);
29975
30011
  const real = await this.fs.realpath?.(at, true).catch(() => at) ?? at;
29976
- const watch = this.watchers.typedWatch(real, recursive && st.isDirectory, at);
30012
+ const watch = this.watchers.typedWatch(
30013
+ real,
30014
+ recursive && st.isDirectory,
30015
+ at,
30016
+ st.isDirectory
30017
+ );
29977
30018
  if (!g || g.cred.euid === 0) return watch;
29978
30019
  return visibleTo(watch, real, async (dir) => {
29979
30020
  const walked = await access(g.fs, g.cred, dir, R_OK | X_OK, { directory: true });