@ai-ecoverse/slicc-kernel 1.147.5 → 1.147.7

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.7" : "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
@@ -9938,6 +9958,7 @@ var RealmProxy = class {
9938
9958
  const stopping = () => socket.close(1001, "the proxy is stopping");
9939
9959
  stop.addEventListener("abort", stopping, { once: true });
9940
9960
  let guestDone = false;
9961
+ let guestClosed = false;
9941
9962
  let closeSent = false;
9942
9963
  const outbound2 = (async () => {
9943
9964
  for await (const data of socket.messages) {
@@ -9951,6 +9972,7 @@ var RealmProxy = class {
9951
9972
  if (guestDone) return;
9952
9973
  closeSent = true;
9953
9974
  await toGuest(closeFrame(wireCode(closed.code), closed.reason));
9975
+ if (guestClosed) return;
9954
9976
  AbortSignal.timeout(this.limits.closeWaitMs).addEventListener("abort", () => done5.abort(), {
9955
9977
  once: true
9956
9978
  });
@@ -9965,15 +9987,13 @@ var RealmProxy = class {
9965
9987
  continue;
9966
9988
  }
9967
9989
  if (event.kind === "close") {
9968
- guestDone = true;
9969
9990
  if (closeSent) break;
9991
+ guestClosed = true;
9970
9992
  const code = wireCode(event.code);
9971
9993
  socket.close(code, event.reason);
9972
- const reply = await Promise.race([
9973
- socket.closed,
9974
- quietly(this.limits.closeWaitMs).then(() => ({ code, reason: event.reason }))
9975
- ]);
9976
- await toGuest(closeFrame(wireCode(reply.code), reply.reason));
9994
+ await Promise.race([outbound2, quietly(this.limits.closeWaitMs)]);
9995
+ guestDone = true;
9996
+ if (!closeSent) await toGuest(closeFrame(code, event.reason));
9977
9997
  break;
9978
9998
  }
9979
9999
  while (socket.buffered > SEND_BUFFER2 && !reading.aborted) await quietly(10);
@@ -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(
@@ -30092,9 +30128,18 @@ var Launcher = class {
30092
30128
  return id2().then(
30093
30129
  (before) => read().then(
30094
30130
  (first) => id2().then(
30095
- (after) => after.exeId === before.exeId ? [first, after] : this.reread(target, read).then(
30096
- (again) => id2().then((last) => [again, last])
30097
- )
30131
+ (after) => {
30132
+ if (after.exeId === before.exeId) return [first, after];
30133
+ const gone = [
30134
+ first,
30135
+ { exeId: `gone:${crypto.randomUUID()}` }
30136
+ ];
30137
+ if (after.exeId === void 0) return gone;
30138
+ return this.reread(target, read).then(
30139
+ (again) => id2().then((last) => [again, last]),
30140
+ () => gone
30141
+ );
30142
+ }
30098
30143
  )
30099
30144
  )
30100
30145
  );
@@ -30956,7 +31001,12 @@ var Launcher = class {
30956
31001
  if (g) await readable(g, "watch", at);
30957
31002
  const st = await this.fs.stat(at);
30958
31003
  const real = await this.fs.realpath?.(at, true).catch(() => at) ?? at;
30959
- const watch = this.watchers.typedWatch(real, recursive && st.isDirectory, at);
31004
+ const watch = this.watchers.typedWatch(
31005
+ real,
31006
+ recursive && st.isDirectory,
31007
+ at,
31008
+ st.isDirectory
31009
+ );
30960
31010
  if (!g || g.cred.euid === 0) return watch;
30961
31011
  return visibleTo2(watch, real, async (dir) => {
30962
31012
  const walked = await access(g.fs, g.cred, dir, R_OK | X_OK, { directory: true });