@ai-ecoverse/slicc-kernel 1.196.47 → 1.196.49

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.
@@ -5309,7 +5309,7 @@ function satisfies(version, range2) {
5309
5309
  }
5310
5310
 
5311
5311
  // src/version.ts
5312
- var KERNEL_VERSION = true ? "1.196.47" : "0.0.0-dev";
5312
+ var KERNEL_VERSION = true ? "1.196.49" : "0.0.0-dev";
5313
5313
  var OS_RELEASE = "6.0.0-slicc";
5314
5314
  function procVersion() {
5315
5315
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -33932,6 +33932,7 @@ var PrivateRename = class {
33932
33932
  };
33933
33933
 
33934
33934
  // src/fs/rename-cleanup.ts
33935
+ var MANIFEST_BATCH = 64;
33935
33936
  function cleanupId(handle) {
33936
33937
  return handle.getUniqueId?.();
33937
33938
  }
@@ -33947,9 +33948,8 @@ async function copiedEntry(handle, path, file) {
33947
33948
  function absent(err) {
33948
33949
  return err.name === "NotFoundError";
33949
33950
  }
33950
- async function removeOne(parent, name2, rest2, lookup2, signal) {
33951
+ async function removeOne(parent, name2, entry, children3, signal) {
33951
33952
  signal?.throwIfAborted();
33952
- const entry = await lookup2(rest2);
33953
33953
  if (!entry) return;
33954
33954
  try {
33955
33955
  const handle = entry.kind === "file" ? await parent.getFileHandle(name2) : await parent.getDirectoryHandle(name2);
@@ -33957,10 +33957,7 @@ async function removeOne(parent, name2, rest2, lookup2, signal) {
33957
33957
  if (handle.kind === "file") {
33958
33958
  const file = await handle.getFile();
33959
33959
  if (file.lastModified !== entry.mtime || file.size !== entry.size) return;
33960
- } else {
33961
- for await (const child2 of handle.keys())
33962
- await removeOne(handle, child2, rest2 + "/" + child2, lookup2, signal);
33963
- }
33960
+ } else await children3(handle, entry.path);
33964
33961
  signal?.throwIfAborted();
33965
33962
  await parent.removeEntry(name2);
33966
33963
  } catch (err) {
@@ -33969,18 +33966,52 @@ async function removeOne(parent, name2, rest2, lookup2, signal) {
33969
33966
  }
33970
33967
  function removeCopied(parent, name2, manifest, signal, overflow) {
33971
33968
  const entries = new Map(manifest.map((entry) => [entry.path, entry]));
33972
- return removeOne(parent, name2, "", (path) => entries.get(path) ?? overflow?.(path), signal);
33969
+ async function batch(dir, names2, parentPath) {
33970
+ signal?.throwIfAborted();
33971
+ const paths = names2.map((child2) => parentPath === void 0 ? "" : parentPath + "/" + child2);
33972
+ let extra;
33973
+ if (overflow) {
33974
+ const missing7 = paths.filter((path) => !entries.has(path));
33975
+ if (missing7.length) extra = await overflow(missing7);
33976
+ }
33977
+ for (const [i, path] of paths.entries())
33978
+ await removeOne(
33979
+ dir,
33980
+ names2[i],
33981
+ entries.get(path) ?? extra?.get(path),
33982
+ children3,
33983
+ signal
33984
+ );
33985
+ }
33986
+ async function children3(dir, path) {
33987
+ const names2 = [];
33988
+ for await (const child2 of dir.keys()) {
33989
+ signal?.throwIfAborted();
33990
+ names2.push(child2);
33991
+ if (names2.length === MANIFEST_BATCH) {
33992
+ await batch(dir, names2, path);
33993
+ names2.length = 0;
33994
+ }
33995
+ }
33996
+ if (names2.length) await batch(dir, names2, path);
33997
+ }
33998
+ return batch(parent, [name2]);
33973
33999
  }
33974
34000
 
33975
34001
  // src/fs/rename-manifest.ts
33976
34002
  var INLINE_BYTES = 256 * 1024;
33977
- var BATCH = 64;
33978
34003
  function manifestRoot(intent) {
33979
34004
  return "rename-manifest:" + intent;
33980
34005
  }
33981
- async function storedStamp(meta, intent, path) {
33982
- const [row] = await meta.get([manifestRoot(intent) + path]);
33983
- return row?.copyStamp && { path, ...row.copyStamp };
34006
+ async function storedStamps(meta, intent, paths) {
34007
+ const prefix = manifestRoot(intent);
34008
+ const rows = await meta.get(paths.map((path) => prefix + path));
34009
+ const found = /* @__PURE__ */ new Map();
34010
+ for (const [i, path] of paths.entries()) {
34011
+ const stamp = rows[i]?.copyStamp;
34012
+ if (stamp) found.set(path, { ...stamp, path });
34013
+ }
34014
+ return found;
33984
34015
  }
33985
34016
  var RenameManifest = class {
33986
34017
  meta;
@@ -34005,7 +34036,7 @@ var RenameManifest = class {
34005
34036
  const { path: relative2, ...copyStamp } = entry;
34006
34037
  const path = manifestRoot(this.intent) + relative2;
34007
34038
  this.pending.push({ path, change: () => ({ path, copyStamp }) });
34008
- if (this.pending.length === BATCH) await this.flush();
34039
+ if (this.pending.length === MANIFEST_BATCH) await this.flush();
34009
34040
  }
34010
34041
  async flush() {
34011
34042
  if (!this.pending.length) return;
@@ -36366,8 +36397,12 @@ var OpfsFs = class {
36366
36397
  }
36367
36398
  async removeReserved(intent, from, reservation, rename, signal) {
36368
36399
  if (rename.unverifiedSource) {
36369
- await this.sourceId(from);
36370
- throw fsError("EBUSY", from);
36400
+ const [dir, name2] = await this.parent(from);
36401
+ return this.inDir(dir, async (parent) => {
36402
+ await parent.getDirectoryHandle(name2);
36403
+ signal?.throwIfAborted();
36404
+ await parent.removeEntry(name2);
36405
+ });
36371
36406
  }
36372
36407
  const commit = reservation.copyCommit?.intent === intent ? reservation.copyCommit : void 0;
36373
36408
  const entries = commit?.entries ?? rename.copiedEntries;
@@ -36381,7 +36416,7 @@ var OpfsFs = class {
36381
36416
  name2,
36382
36417
  entries,
36383
36418
  signal,
36384
- commit?.indexed ? (path) => storedStamp(this.meta, intent, path) : void 0
36419
+ commit?.indexed ? (paths) => storedStamps(this.meta, intent, paths) : void 0
36385
36420
  ) : parent.removeEntry(name2);
36386
36421
  });
36387
36422
  }
@@ -45491,6 +45526,7 @@ function treeBindings(path) {
45491
45526
  return [encodeText(path), encodeText(`${path}/`), encodeText(`${path}0`)];
45492
45527
  }
45493
45528
  var CACHED = 8192;
45529
+ var READ_BATCH = 64;
45494
45530
  function within12(path, root) {
45495
45531
  return root === "/" || path === root || path.startsWith(`${root}/`);
45496
45532
  }
@@ -45551,7 +45587,23 @@ var SqliteMeta = class {
45551
45587
  for (const at of this.dirtyUnder(path)) this.write(at, void 0);
45552
45588
  }
45553
45589
  async get(paths) {
45554
- return paths.map((path) => this.read(path));
45590
+ if (paths.length < 2) return paths.map((path) => this.read(path));
45591
+ const found = /* @__PURE__ */ new Map(), missing7 = [];
45592
+ for (const path of new Set(paths)) {
45593
+ if (this.dirty.has(path) || this.cache.has(path)) found.set(path, this.read(path));
45594
+ else missing7.push(path);
45595
+ }
45596
+ for (let at = 0; at < missing7.length; at += READ_BATCH) {
45597
+ const keys2 = missing7.slice(at, at + READ_BATCH);
45598
+ const bind2 = keys2.map(() => "?").join(",");
45599
+ for (const row of this.store.rows(
45600
+ "SELECT path, entry FROM slicc_meta WHERE path IN (" + bind2 + ")",
45601
+ ...keys2.map(encodeText)
45602
+ ))
45603
+ found.set(decodeText2(row.path), entryOf(row));
45604
+ for (const key of keys2) this.remember(key, found.get(key) ?? null);
45605
+ }
45606
+ return paths.map((path) => found.get(path));
45555
45607
  }
45556
45608
  async fresh(paths) {
45557
45609
  return this.get(paths);