@ai-ecoverse/slicc-kernel 1.103.2 → 1.103.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.
@@ -2491,7 +2491,7 @@ var KERNEL_VERSION, OS_RELEASE;
2491
2491
  var init_version = __esm({
2492
2492
  "src/version.ts"() {
2493
2493
  "use strict";
2494
- KERNEL_VERSION = true ? "1.103.2" : "0.0.0-dev";
2494
+ KERNEL_VERSION = true ? "1.103.3" : "0.0.0-dev";
2495
2495
  OS_RELEASE = "6.0.0-slicc";
2496
2496
  }
2497
2497
  });
@@ -6263,15 +6263,37 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6263
6263
  const blind = shared !== void 0 && shared.length * 4 < SHARED_IDS_BYTES;
6264
6264
  const cache = new StatCache(blind ? void 0 : shared);
6265
6265
  const { stats, lstats } = cache;
6266
+ const view = bridge.changes;
6267
+ const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
6268
+ const seenAt = /* @__PURE__ */ new Map();
6269
+ const gone = (path) => {
6270
+ for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
6271
+ const up = path.slice(0, at);
6272
+ for (const map of [lstats, stats]) {
6273
+ const hit = map.get(up);
6274
+ const code2 = hit && "until" in hit ? hit.error.code : void 0;
6275
+ if (hit && "until" in hit && code2 === "ENOENT" && live(hit, up)) return hit;
6276
+ }
6277
+ }
6278
+ return void 0;
6279
+ };
6266
6280
  const cached = (map, path, get) => {
6267
6281
  if (blind) return get();
6268
6282
  cache.fresh();
6269
6283
  let hit = map.get(path);
6270
- if (hit === void 0 || "until" in hit && hit.until <= now()) {
6284
+ if (hit === void 0 || "until" in hit && !live(hit, path)) {
6285
+ const missing2 = gone(path);
6286
+ if (missing2) throw missing2.error;
6287
+ const gen = view?.now();
6271
6288
  try {
6272
6289
  hit = get();
6290
+ if (gen !== void 0 && map === lstats) seenAt.set(path, gen);
6273
6291
  } catch (e) {
6274
- hit = { error: e, until: now() + MISS_TTL_MS };
6292
+ hit = {
6293
+ error: e,
6294
+ until: now() + MISS_TTL_MS,
6295
+ ...gen !== void 0 ? { gen } : {}
6296
+ };
6275
6297
  }
6276
6298
  cache.put(map, path, hit);
6277
6299
  }
@@ -6327,7 +6349,15 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6327
6349
  }
6328
6350
  return list;
6329
6351
  },
6330
- readlink: (p) => bridge.readlink(p),
6352
+ readlink: (p) => {
6353
+ const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
6354
+ const gen = seenAt.get(p);
6355
+ const current = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
6356
+ if (known && current && !("until" in known) && !known.isSymbolicLink) {
6357
+ throw syncError("EINVAL", `'${p}' is not a symbolic link`);
6358
+ }
6359
+ return bridge.readlink(p);
6360
+ },
6331
6361
  stat: (p) => cached(stats, p, () => bridge.stat(p)),
6332
6362
  lstat: (p) => cached(lstats, p, () => bridge.lstat(p)),
6333
6363
  exists: (p) => {
@@ -6394,6 +6424,7 @@ var init_wasi_files = __esm({
6394
6424
  "src/process/wasi/wasi-files.ts"() {
6395
6425
  "use strict";
6396
6426
  init_ranged();
6427
+ init_sync_fs_wire();
6397
6428
  WasiError = class extends Error {
6398
6429
  code;
6399
6430
  constructor(code2) {