@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.
@@ -1091,7 +1091,7 @@ var RemoteWatch = class {
1091
1091
  if (data.ack !== void 0 && data.to === this.tab && data.from !== void 0) {
1092
1092
  this.acked(data.ack, data.from);
1093
1093
  }
1094
- if (data.changed !== void 0) this.emit({ paths: data.changed, trees: [] });
1094
+ if (data.changed !== void 0) this.emit({ paths: data.changed, trees: [], content: true });
1095
1095
  }
1096
1096
  arrived(peer) {
1097
1097
  this.peers.add(peer);
@@ -1400,6 +1400,18 @@ var Extent = class {
1400
1400
  };
1401
1401
  var LOCKED = /* @__PURE__ */ new Set(["NotReadableError", "NoModificationAllowedError", "InvalidStateError"]);
1402
1402
  var SYNC_BACKOFF_MS = [5, 10, 20, 40, 80];
1403
+ async function unlocked(name2, op) {
1404
+ for (let attempt = 0; ; attempt++) {
1405
+ try {
1406
+ return await op();
1407
+ } catch (err) {
1408
+ if (!LOCKED.has(err?.name)) throw err;
1409
+ const delay = SYNC_BACKOFF_MS[attempt];
1410
+ if (delay === void 0) throw fsError("EBUSY", name2);
1411
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
1412
+ }
1413
+ }
1414
+ }
1403
1415
  async function openSync(handle) {
1404
1416
  const sync = handle.createSyncAccessHandle;
1405
1417
  if (!sync) return void 0;
@@ -1526,7 +1538,12 @@ var OpfsFs = class {
1526
1538
  meta.listen?.((c) => {
1527
1539
  for (const path of [...c.paths ?? [], ...c.trees ?? []]) this.forget(path);
1528
1540
  const moved2 = movedOf(c.moved);
1529
- remote?.emit({ paths: c.paths ?? [], trees: c.trees ?? [], ...moved2 ? { moved: moved2 } : {} });
1541
+ remote?.emit({
1542
+ paths: c.paths ?? [],
1543
+ trees: c.trees ?? [],
1544
+ content: true,
1545
+ ...moved2 ? { moved: moved2 } : {}
1546
+ });
1530
1547
  });
1531
1548
  remote?.listen((c) => {
1532
1549
  for (const path of [...c.paths, ...c.trees]) this.forget(path);
@@ -2594,7 +2611,10 @@ var OpfsFs = class {
2594
2611
  try {
2595
2612
  await this.inDir(
2596
2613
  dir,
2597
- (parent) => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
2614
+ (parent) => unlocked(
2615
+ name2,
2616
+ () => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
2617
+ )
2598
2618
  );
2599
2619
  } catch (err) {
2600
2620
  throw translate(err, path);
@@ -7785,7 +7805,7 @@ function satisfies(version, range2) {
7785
7805
  }
7786
7806
 
7787
7807
  // src/version.ts
7788
- var KERNEL_VERSION = true ? "1.147.5" : "0.0.0-dev";
7808
+ var KERNEL_VERSION = true ? "1.147.6" : "0.0.0-dev";
7789
7809
  var OS_RELEASE = "6.0.0-slicc";
7790
7810
  function procVersion() {
7791
7811
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -10829,13 +10849,14 @@ var FsWatchers = class {
10829
10849
  this.watchers.delete(watcher);
10830
10850
  };
10831
10851
  }
10832
- typedWatch(root, recursive, alias) {
10852
+ typedWatch(root, recursive, alias, directory = recursive) {
10833
10853
  const main = normalizePath(root);
10834
10854
  const other = alias === void 0 ? main : normalizePath(alias);
10835
10855
  const watch = {
10836
10856
  roots: other === main ? [main] : [main, other],
10837
10857
  names: /* @__PURE__ */ new Map(),
10838
10858
  recursive,
10859
+ directory,
10839
10860
  notes: [],
10840
10861
  overflowed: false,
10841
10862
  ended: false,
@@ -10923,6 +10944,19 @@ var FsWatchers = class {
10923
10944
  if (!followed2.has(watch)) route(watch, "rename", at, seq2);
10924
10945
  }
10925
10946
  }
10947
+ heard(type, paths) {
10948
+ if (this.typed.size === 0) return;
10949
+ for (const path of paths) {
10950
+ const at = normalizePath(path);
10951
+ const seq2 = ++this.seq;
10952
+ for (const watch of [...this.typed]) {
10953
+ if (type === "rename" && watch.roots.some((root) => at === root || under3(root, at)))
10954
+ continue;
10955
+ if (type === "change" && watch.directory && watch.roots.includes(at)) continue;
10956
+ route(watch, type, at, seq2);
10957
+ }
10958
+ }
10959
+ }
10926
10960
  changed(...paths) {
10927
10961
  this.report(paths);
10928
10962
  this.emit("change", paths);
@@ -29278,6 +29312,8 @@ var Launcher = class {
29278
29312
  this.changes.flush();
29279
29313
  this.cwds.touched(change.paths, change.trees);
29280
29314
  this.rewritten(change.paths, change.trees);
29315
+ this.watchers.heard(change.content ? "change" : "rename", change.paths);
29316
+ this.watchers.heard("rename", change.trees ?? []);
29281
29317
  });
29282
29318
  const holders = [this.held, this.openFiles];
29283
29319
  this.unlinked = new UnlinkedKeeper(
@@ -30956,7 +30992,12 @@ var Launcher = class {
30956
30992
  if (g) await readable(g, "watch", at);
30957
30993
  const st = await this.fs.stat(at);
30958
30994
  const real = await this.fs.realpath?.(at, true).catch(() => at) ?? at;
30959
- const watch = this.watchers.typedWatch(real, recursive && st.isDirectory, at);
30995
+ const watch = this.watchers.typedWatch(
30996
+ real,
30997
+ recursive && st.isDirectory,
30998
+ at,
30999
+ st.isDirectory
31000
+ );
30960
31001
  if (!g || g.cred.euid === 0) return watch;
30961
31002
  return visibleTo2(watch, real, async (dir) => {
30962
31003
  const walked = await access(g.fs, g.cred, dir, R_OK | X_OK, { directory: true });