@ai-ecoverse/slicc-kernel 1.147.9 → 1.148.0

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.9" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.148.0" : "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
@@ -9489,6 +9489,7 @@ function statJson(s) {
9489
9489
  atimeMs: s.atime.getTime(),
9490
9490
  ctimeMs: s.ctime.getTime(),
9491
9491
  ino: s.ino,
9492
+ ...s.fid !== void 0 ? { fid: s.fid } : {},
9492
9493
  ...s.nlink !== void 0 ? { nlink: s.nlink } : {},
9493
9494
  ...s.dev !== void 0 ? { dev: s.dev } : {},
9494
9495
  ...s.readonly ? { readonly: true } : {},
@@ -23305,8 +23306,9 @@ async function swapped2(op) {
23305
23306
  }
23306
23307
  var MAX_LINKS6 = 40;
23307
23308
  var CHECK_MS = 1e3;
23308
- var ABSENT_MS = 2;
23309
- var GLANCE_MS = 2;
23309
+ var ABSENT_LOOKUPS = 256;
23310
+ var GLANCE_LOOKUPS = 64;
23311
+ var GLANCE_CAP_MS = 100;
23310
23312
  var ABSENT_NAMES = 4096;
23311
23313
  var FILE_HANDLES = 4096;
23312
23314
  var STALE = /* @__PURE__ */ new Set(["NotFoundError", "TypeMismatchError"]);
@@ -23517,6 +23519,7 @@ var OpfsFs = class {
23517
23519
  dirs = new PathMap();
23518
23520
  files = new PathMap();
23519
23521
  absent = new PathMap();
23522
+ lookups = 0;
23520
23523
  changes = 0;
23521
23524
  replacing = Promise.resolve();
23522
23525
  replacements = 0;
@@ -23586,6 +23589,19 @@ var OpfsFs = class {
23586
23589
  for (const path of paths) this.forget(path);
23587
23590
  this.channel?.postMessage(paths);
23588
23591
  }
23592
+ async fileId(path) {
23593
+ const found = await this.locate(path, true);
23594
+ const [entry] = await this.meta.get([found.path]);
23595
+ if (entry?.fid !== void 0) return entry.fid;
23596
+ const fid = crypto.randomUUID();
23597
+ await this.meta.update(found.path, (now) => ({
23598
+ ...occupied(now),
23599
+ path: found.path,
23600
+ fid: now?.fid ?? fid
23601
+ }));
23602
+ const [stored] = await this.meta.get([found.path]);
23603
+ return stored?.fid ?? fid;
23604
+ }
23589
23605
  heldUnder = () => [];
23590
23606
  heldBy(held) {
23591
23607
  this.heldUnder = held;
@@ -23875,7 +23891,7 @@ var OpfsFs = class {
23875
23891
  }
23876
23892
  missed(path) {
23877
23893
  if (this.absent.size >= ABSENT_NAMES) this.absent.clear();
23878
- this.absent.set(path, performance.now());
23894
+ this.absent.set(path, { at: performance.now(), op: this.lookups });
23879
23895
  }
23880
23896
  remember(path, handle, looked = false) {
23881
23897
  if (handle.kind !== "file") {
@@ -23916,7 +23932,11 @@ var OpfsFs = class {
23916
23932
  if (name2 === void 0) throw fsError("EBUSY", path);
23917
23933
  return [`/${parts2.join("/")}`, name2];
23918
23934
  }
23935
+ recent(seen, lookups) {
23936
+ return this.lookups - seen.op < lookups && performance.now() - seen.at < GLANCE_CAP_MS;
23937
+ }
23919
23938
  async handle(path) {
23939
+ this.lookups++;
23920
23940
  if (split2(path).length === 0) return this.root;
23921
23941
  const cached = this.files.get(path);
23922
23942
  const fresh2 = cached && performance.now() - (this.found.get(cached) ?? -CHECK_MS) < CHECK_MS;
@@ -23936,7 +23956,7 @@ var OpfsFs = class {
23936
23956
  const kept = this.dirs.get(path);
23937
23957
  if (kept && await this.current(path, kept)) return kept;
23938
23958
  const gone = this.absent.get(path);
23939
- if (gone !== void 0 && this.exact === 0 && performance.now() - gone < ABSENT_MS) {
23959
+ if (gone !== void 0 && this.exact === 0 && this.recent(gone, ABSENT_LOOKUPS)) {
23940
23960
  throw translate({ name: "NotFoundError" }, path);
23941
23961
  }
23942
23962
  const seen = this.changes;
@@ -24139,15 +24159,16 @@ var OpfsFs = class {
24139
24159
  glanced(handle) {
24140
24160
  if (this.exact > 0) return void 0;
24141
24161
  const seen = this.glances.get(handle);
24142
- const fresh2 = seen && seen.changes === this.changes && performance.now() - seen.at < GLANCE_MS;
24162
+ const fresh2 = seen && seen.changes === this.changes && this.recent(seen, GLANCE_LOOKUPS);
24143
24163
  return fresh2 ? seen.file : void 0;
24144
24164
  }
24145
24165
  async glance(handle) {
24146
24166
  const at = performance.now();
24167
+ const op = this.lookups;
24147
24168
  const before = this.changes;
24148
24169
  this.calls++;
24149
24170
  const file = await handle.getFile();
24150
- if (before === this.changes) this.glances.set(handle, { at, file, changes: before });
24171
+ if (before === this.changes) this.glances.set(handle, { at, op, file, changes: before });
24151
24172
  else this.glances.delete(handle);
24152
24173
  return file;
24153
24174
  }
@@ -24178,6 +24199,7 @@ var OpfsFs = class {
24178
24199
  atime: new Date(meta?.atimeMs ?? mtime),
24179
24200
  ctime: new Date(Math.max(touched ?? meta?.ctimeMs ?? mtime, modified)),
24180
24201
  ino: meta?.ino ?? inodeOf(path),
24202
+ ...meta?.fid !== void 0 ? { fid: meta.fid } : {},
24181
24203
  ...this.ranged && !directory ? { ranged: true } : {}
24182
24204
  };
24183
24205
  }
@@ -29171,7 +29193,9 @@ var Launcher = class {
29171
29193
  ];
29172
29194
  if (after.exeId === void 0) return gone;
29173
29195
  return this.reread(target, read).then(
29174
- (again) => id2().then((last) => [again, last]),
29196
+ (again) => id2().then(
29197
+ (last) => [again, last.exeId === after.exeId ? last : gone[1]]
29198
+ ),
29175
29199
  () => gone
29176
29200
  );
29177
29201
  }
@@ -29189,8 +29213,13 @@ var Launcher = class {
29189
29213
  if (target.abi !== "wasi" || (target.copy ?? target.glue) !== target.wasm) {
29190
29214
  return Promise.resolve({});
29191
29215
  }
29216
+ const assign = this.mounts.locate(target.wasm) === void 0 ? this.rootFs.fileId : void 0;
29192
29217
  return this.base.stat(target.wasm).then(
29193
- (st) => exeIdOf(fileIdentity(st.ino, st.mtime.getTime())),
29218
+ async (st) => {
29219
+ const fid = st.fid ?? await assign?.call(this.rootFs, target.wasm);
29220
+ if (fid === void 0) return exeIdOf(fileIdentity(st.ino, st.mtime.getTime()));
29221
+ return { exeId: `fid:${fid}:${st.mtime.getTime()}` };
29222
+ },
29194
29223
  () => ({})
29195
29224
  );
29196
29225
  }