@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.
@@ -2185,6 +2185,7 @@ function liveRoot(Fs, bridge) {
2185
2185
  guardRenames(Fs);
2186
2186
  guardKeptNodes(Fs, plugin.handled);
2187
2187
  guardStaleNodes(Fs, plugin);
2188
+ guardVanished(Fs);
2188
2189
  guardStatfs(Fs);
2189
2190
  const memfs = root.memfs ?? root.node_ops;
2190
2191
  const live = plugin.node_ops;
@@ -2292,6 +2293,44 @@ function guardStaleNodes(Fs, plugin) {
2292
2293
  return fresh;
2293
2294
  };
2294
2295
  }
2296
+ function guardVanished(Fs) {
2297
+ const forget = Fs.hashRemoveNode?.bind(Fs);
2298
+ if (!forget || !Fs.lookupPath || Fs.sliccVanished) return;
2299
+ Fs.sliccVanished = true;
2300
+ const drop = forget;
2301
+ const lookupPath = Fs.lookupPath.bind(Fs);
2302
+ const ops = Fs;
2303
+ const cached = (path, follow2) => {
2304
+ try {
2305
+ const node = lookupPath(path, { follow: follow2 }).node;
2306
+ return node.live && node.live.openCount === 0 && !node.live.dirty ? node : void 0;
2307
+ } catch {
2308
+ return void 0;
2309
+ }
2310
+ };
2311
+ let open;
2312
+ for (const [name2, follows] of RESOLVING) {
2313
+ const op = ops[name2]?.bind(Fs);
2314
+ if (name2 === "open") open = op;
2315
+ if (op) ops[name2] = vanishing(op, follows);
2316
+ }
2317
+ function vanishing(op, follows) {
2318
+ return (...args) => {
2319
+ try {
2320
+ return op(...args);
2321
+ } catch (err) {
2322
+ const path = args[0];
2323
+ const code2 = err.errno;
2324
+ const taken = code2 === wasiErrno("EEXIST") && op === open;
2325
+ if (code2 !== wasiErrno("ENOENT") && !taken || typeof path !== "string") throw err;
2326
+ const node = cached(path, follows(args));
2327
+ if (!node) throw err;
2328
+ drop(node);
2329
+ return op(...args);
2330
+ }
2331
+ };
2332
+ }
2333
+ }
2295
2334
  function guardRenames(Fs) {
2296
2335
  const rename = Fs.rename?.bind(Fs);
2297
2336
  if (!rename || Fs.sliccRename) return;
@@ -2405,7 +2444,7 @@ function readingLinks(Fs) {
2405
2444
  }
2406
2445
  };
2407
2446
  }
2408
- var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
2447
+ var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING;
2409
2448
  var init_live_vfs_fs = __esm({
2410
2449
  "src/realm/live-vfs-fs.ts"() {
2411
2450
  "use strict";
@@ -2433,6 +2472,16 @@ var init_live_vfs_fs = __esm({
2433
2472
  O_PATH = 2097152;
2434
2473
  stale = (s) => !!s.orphan && !s.kept;
2435
2474
  opening = /* @__PURE__ */ new WeakMap();
2475
+ O_NOFOLLOW = 131072;
2476
+ RESOLVING = [
2477
+ ["open", (args) => (args[1] & O_NOFOLLOW) === 0],
2478
+ ["stat", (args) => !args[1]],
2479
+ ["lstat", () => false],
2480
+ ["unlink", () => false],
2481
+ ["rename", () => false],
2482
+ ["readlink", () => false],
2483
+ ["truncate", () => true]
2484
+ ];
2436
2485
  }
2437
2486
  });
2438
2487
 
@@ -2553,7 +2602,7 @@ var KERNEL_VERSION, OS_RELEASE;
2553
2602
  var init_version = __esm({
2554
2603
  "src/version.ts"() {
2555
2604
  "use strict";
2556
- KERNEL_VERSION = true ? "1.122.2" : "0.0.0-dev";
2605
+ KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
2557
2606
  OS_RELEASE = "6.0.0-slicc";
2558
2607
  }
2559
2608
  });