@ai-ecoverse/slicc-kernel 1.122.2 → 1.122.3

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.
@@ -5432,7 +5432,7 @@ var KERNEL_VERSION, OS_RELEASE;
5432
5432
  var init_version = __esm({
5433
5433
  "src/version.ts"() {
5434
5434
  "use strict";
5435
- KERNEL_VERSION = true ? "1.122.2" : "0.0.0-dev";
5435
+ KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
5436
5436
  OS_RELEASE = "6.0.0-slicc";
5437
5437
  }
5438
5438
  });
@@ -8336,6 +8336,7 @@ function liveRoot(Fs, bridge) {
8336
8336
  guardRenames(Fs);
8337
8337
  guardKeptNodes(Fs, plugin.handled);
8338
8338
  guardStaleNodes(Fs, plugin);
8339
+ guardVanished(Fs);
8339
8340
  guardStatfs(Fs);
8340
8341
  const memfs = root.memfs ?? root.node_ops;
8341
8342
  const live = plugin.node_ops;
@@ -8443,6 +8444,44 @@ function guardStaleNodes(Fs, plugin) {
8443
8444
  return fresh;
8444
8445
  };
8445
8446
  }
8447
+ function guardVanished(Fs) {
8448
+ const forget = Fs.hashRemoveNode?.bind(Fs);
8449
+ if (!forget || !Fs.lookupPath || Fs.sliccVanished) return;
8450
+ Fs.sliccVanished = true;
8451
+ const drop = forget;
8452
+ const lookupPath = Fs.lookupPath.bind(Fs);
8453
+ const ops = Fs;
8454
+ const cached = (path, follow2) => {
8455
+ try {
8456
+ const node = lookupPath(path, { follow: follow2 }).node;
8457
+ return node.live && node.live.openCount === 0 && !node.live.dirty ? node : void 0;
8458
+ } catch {
8459
+ return void 0;
8460
+ }
8461
+ };
8462
+ let open;
8463
+ for (const [name2, follows] of RESOLVING) {
8464
+ const op = ops[name2]?.bind(Fs);
8465
+ if (name2 === "open") open = op;
8466
+ if (op) ops[name2] = vanishing(op, follows);
8467
+ }
8468
+ function vanishing(op, follows) {
8469
+ return (...args) => {
8470
+ try {
8471
+ return op(...args);
8472
+ } catch (err) {
8473
+ const path = args[0];
8474
+ const code2 = err.errno;
8475
+ const taken = code2 === wasiErrno("EEXIST") && op === open;
8476
+ if (code2 !== wasiErrno("ENOENT") && !taken || typeof path !== "string") throw err;
8477
+ const node = cached(path, follows(args));
8478
+ if (!node) throw err;
8479
+ drop(node);
8480
+ return op(...args);
8481
+ }
8482
+ };
8483
+ }
8484
+ }
8446
8485
  function guardRenames(Fs) {
8447
8486
  const rename = Fs.rename?.bind(Fs);
8448
8487
  if (!rename || Fs.sliccRename) return;
@@ -8556,7 +8595,7 @@ function readingLinks(Fs) {
8556
8595
  }
8557
8596
  };
8558
8597
  }
8559
- var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFIFO2, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
8598
+ var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFIFO2, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING;
8560
8599
  var init_live_vfs_fs = __esm({
8561
8600
  "src/realm/live-vfs-fs.ts"() {
8562
8601
  "use strict";
@@ -8584,6 +8623,16 @@ var init_live_vfs_fs = __esm({
8584
8623
  O_PATH = 2097152;
8585
8624
  stale = (s) => !!s.orphan && !s.kept;
8586
8625
  opening = /* @__PURE__ */ new WeakMap();
8626
+ O_NOFOLLOW = 131072;
8627
+ RESOLVING = [
8628
+ ["open", (args) => (args[1] & O_NOFOLLOW) === 0],
8629
+ ["stat", (args) => !args[1]],
8630
+ ["lstat", () => false],
8631
+ ["unlink", () => false],
8632
+ ["rename", () => false],
8633
+ ["readlink", () => false],
8634
+ ["truncate", () => true]
8635
+ ];
8587
8636
  }
8588
8637
  });
8589
8638