@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.
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.7" : "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
@@ -5539,6 +5539,7 @@ var RealmProxy = class {
5539
5539
  const stopping = () => socket.close(1001, "the proxy is stopping");
5540
5540
  stop.addEventListener("abort", stopping, { once: true });
5541
5541
  let guestDone = false;
5542
+ let guestClosed = false;
5542
5543
  let closeSent = false;
5543
5544
  const outbound2 = (async () => {
5544
5545
  for await (const data of socket.messages) {
@@ -5552,6 +5553,7 @@ var RealmProxy = class {
5552
5553
  if (guestDone) return;
5553
5554
  closeSent = true;
5554
5555
  await toGuest(closeFrame(wireCode(closed.code), closed.reason));
5556
+ if (guestClosed) return;
5555
5557
  AbortSignal.timeout(this.limits.closeWaitMs).addEventListener("abort", () => done4.abort(), {
5556
5558
  once: true
5557
5559
  });
@@ -5566,15 +5568,13 @@ var RealmProxy = class {
5566
5568
  continue;
5567
5569
  }
5568
5570
  if (event.kind === "close") {
5569
- guestDone = true;
5570
5571
  if (closeSent) break;
5572
+ guestClosed = true;
5571
5573
  const code = wireCode(event.code);
5572
5574
  socket.close(code, event.reason);
5573
- const reply = await Promise.race([
5574
- socket.closed,
5575
- quietly(this.limits.closeWaitMs).then(() => ({ code, reason: event.reason }))
5576
- ]);
5577
- await toGuest(closeFrame(wireCode(reply.code), reply.reason));
5575
+ await Promise.race([outbound2, quietly(this.limits.closeWaitMs)]);
5576
+ guestDone = true;
5577
+ if (!closeSent) await toGuest(closeFrame(code, event.reason));
5578
5578
  break;
5579
5579
  }
5580
5580
  while (socket.buffered > SEND_BUFFER && !reading.aborted) await quietly(10);
@@ -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(
@@ -29109,9 +29145,18 @@ var Launcher = class {
29109
29145
  return id2().then(
29110
29146
  (before) => read().then(
29111
29147
  (first) => id2().then(
29112
- (after) => after.exeId === before.exeId ? [first, after] : this.reread(target, read).then(
29113
- (again) => id2().then((last) => [again, last])
29114
- )
29148
+ (after) => {
29149
+ if (after.exeId === before.exeId) return [first, after];
29150
+ const gone = [
29151
+ first,
29152
+ { exeId: `gone:${crypto.randomUUID()}` }
29153
+ ];
29154
+ if (after.exeId === void 0) return gone;
29155
+ return this.reread(target, read).then(
29156
+ (again) => id2().then((last) => [again, last]),
29157
+ () => gone
29158
+ );
29159
+ }
29115
29160
  )
29116
29161
  )
29117
29162
  );
@@ -29973,7 +30018,12 @@ var Launcher = class {
29973
30018
  if (g) await readable(g, "watch", at);
29974
30019
  const st = await this.fs.stat(at);
29975
30020
  const real = await this.fs.realpath?.(at, true).catch(() => at) ?? at;
29976
- const watch = this.watchers.typedWatch(real, recursive && st.isDirectory, at);
30021
+ const watch = this.watchers.typedWatch(
30022
+ real,
30023
+ recursive && st.isDirectory,
30024
+ at,
30025
+ st.isDirectory
30026
+ );
29977
30027
  if (!g || g.cred.euid === 0) return watch;
29978
30028
  return visibleTo(watch, real, async (dir) => {
29979
30029
  const walked = await access(g.fs, g.cred, dir, R_OK | X_OK, { directory: true });