@ai-ecoverse/slicc-kernel 1.147.8 → 1.147.10

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.8" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.147.10" : "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
@@ -23305,8 +23305,9 @@ async function swapped2(op) {
23305
23305
  }
23306
23306
  var MAX_LINKS6 = 40;
23307
23307
  var CHECK_MS = 1e3;
23308
- var ABSENT_MS = 2;
23309
- var GLANCE_MS = 2;
23308
+ var ABSENT_LOOKUPS = 256;
23309
+ var GLANCE_LOOKUPS = 64;
23310
+ var GLANCE_CAP_MS = 100;
23310
23311
  var ABSENT_NAMES = 4096;
23311
23312
  var FILE_HANDLES = 4096;
23312
23313
  var STALE = /* @__PURE__ */ new Set(["NotFoundError", "TypeMismatchError"]);
@@ -23517,6 +23518,7 @@ var OpfsFs = class {
23517
23518
  dirs = new PathMap();
23518
23519
  files = new PathMap();
23519
23520
  absent = new PathMap();
23521
+ lookups = 0;
23520
23522
  changes = 0;
23521
23523
  replacing = Promise.resolve();
23522
23524
  replacements = 0;
@@ -23586,6 +23588,19 @@ var OpfsFs = class {
23586
23588
  for (const path of paths) this.forget(path);
23587
23589
  this.channel?.postMessage(paths);
23588
23590
  }
23591
+ heldUnder = () => [];
23592
+ heldBy(held) {
23593
+ this.heldUnder = held;
23594
+ }
23595
+ async pinHeld(dir) {
23596
+ const held = this.heldUnder(dir);
23597
+ if (held.length === 0) return;
23598
+ const known = await this.meta.get(held);
23599
+ const bare = held.filter((_, i) => known[i]?.ino === void 0);
23600
+ for (const p of bare) {
23601
+ await this.meta.update(p, (entry) => ({ ...occupied(entry), path: p, ino: inodeOf(p) }));
23602
+ }
23603
+ }
23589
23604
  remoteChanges(listener) {
23590
23605
  return this.remote?.listen(listener) ?? (() => {
23591
23606
  });
@@ -23862,7 +23877,7 @@ var OpfsFs = class {
23862
23877
  }
23863
23878
  missed(path) {
23864
23879
  if (this.absent.size >= ABSENT_NAMES) this.absent.clear();
23865
- this.absent.set(path, performance.now());
23880
+ this.absent.set(path, { at: performance.now(), op: this.lookups });
23866
23881
  }
23867
23882
  remember(path, handle, looked = false) {
23868
23883
  if (handle.kind !== "file") {
@@ -23903,7 +23918,11 @@ var OpfsFs = class {
23903
23918
  if (name2 === void 0) throw fsError("EBUSY", path);
23904
23919
  return [`/${parts2.join("/")}`, name2];
23905
23920
  }
23921
+ recent(seen, lookups) {
23922
+ return this.lookups - seen.op < lookups && performance.now() - seen.at < GLANCE_CAP_MS;
23923
+ }
23906
23924
  async handle(path) {
23925
+ this.lookups++;
23907
23926
  if (split2(path).length === 0) return this.root;
23908
23927
  const cached = this.files.get(path);
23909
23928
  const fresh2 = cached && performance.now() - (this.found.get(cached) ?? -CHECK_MS) < CHECK_MS;
@@ -23923,7 +23942,7 @@ var OpfsFs = class {
23923
23942
  const kept = this.dirs.get(path);
23924
23943
  if (kept && await this.current(path, kept)) return kept;
23925
23944
  const gone = this.absent.get(path);
23926
- if (gone !== void 0 && this.exact === 0 && performance.now() - gone < ABSENT_MS) {
23945
+ if (gone !== void 0 && this.exact === 0 && this.recent(gone, ABSENT_LOOKUPS)) {
23927
23946
  throw translate({ name: "NotFoundError" }, path);
23928
23947
  }
23929
23948
  const seen = this.changes;
@@ -24126,15 +24145,16 @@ var OpfsFs = class {
24126
24145
  glanced(handle) {
24127
24146
  if (this.exact > 0) return void 0;
24128
24147
  const seen = this.glances.get(handle);
24129
- const fresh2 = seen && seen.changes === this.changes && performance.now() - seen.at < GLANCE_MS;
24148
+ const fresh2 = seen && seen.changes === this.changes && this.recent(seen, GLANCE_LOOKUPS);
24130
24149
  return fresh2 ? seen.file : void 0;
24131
24150
  }
24132
24151
  async glance(handle) {
24133
24152
  const at = performance.now();
24153
+ const op = this.lookups;
24134
24154
  const before = this.changes;
24135
24155
  this.calls++;
24136
24156
  const file = await handle.getFile();
24137
- if (before === this.changes) this.glances.set(handle, { at, file, changes: before });
24157
+ if (before === this.changes) this.glances.set(handle, { at, op, file, changes: before });
24138
24158
  else this.glances.delete(handle);
24139
24159
  return file;
24140
24160
  }
@@ -24716,6 +24736,7 @@ var OpfsFs = class {
24716
24736
  if (targetStat?.isDirectory && (await this.readdir(destination)).length > 0) {
24717
24737
  throw fsError("ENOTEMPTY", to);
24718
24738
  }
24739
+ if (sourceStat.isDirectory) await this.pinHeld(source.path);
24719
24740
  const now = Date.now();
24720
24741
  const moving = await this.movedOwner(source);
24721
24742
  const carry = (entry2) => ({
@@ -28334,6 +28355,9 @@ var Launcher = class {
28334
28355
  this.watchers.heard("rename", change.trees ?? []);
28335
28356
  });
28336
28357
  const holders = [this.held, this.openFiles];
28358
+ options.fs.heldBy?.(
28359
+ (dir) => holders.flatMap((set3) => [...set3].flatMap((holder) => [...holder.held()])).filter((p) => p.startsWith(`${dir}/`) && this.mounts.locate(p) === void 0)
28360
+ );
28337
28361
  this.unlinked = new UnlinkedKeeper(
28338
28362
  fs,
28339
28363
  { [Symbol.iterator]: () => holders.flatMap((set3) => [...set3]).values() },