@ai-ecoverse/slicc-kernel 1.196.48 → 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.
@@ -1868,6 +1868,7 @@ var RemoteWatch = class {
1868
1868
  };
1869
1869
 
1870
1870
  // src/fs/rename-cleanup.ts
1871
+ var MANIFEST_BATCH = 64;
1871
1872
  function cleanupId(handle) {
1872
1873
  return handle.getUniqueId?.();
1873
1874
  }
@@ -1883,9 +1884,8 @@ async function copiedEntry(handle, path, file) {
1883
1884
  function absent(err) {
1884
1885
  return err.name === "NotFoundError";
1885
1886
  }
1886
- async function removeOne(parent, name2, rest2, lookup2, signal) {
1887
+ async function removeOne(parent, name2, entry, children3, signal) {
1887
1888
  signal?.throwIfAborted();
1888
- const entry = await lookup2(rest2);
1889
1889
  if (!entry) return;
1890
1890
  try {
1891
1891
  const handle = entry.kind === "file" ? await parent.getFileHandle(name2) : await parent.getDirectoryHandle(name2);
@@ -1893,10 +1893,7 @@ async function removeOne(parent, name2, rest2, lookup2, signal) {
1893
1893
  if (handle.kind === "file") {
1894
1894
  const file = await handle.getFile();
1895
1895
  if (file.lastModified !== entry.mtime || file.size !== entry.size) return;
1896
- } else {
1897
- for await (const child2 of handle.keys())
1898
- await removeOne(handle, child2, rest2 + "/" + child2, lookup2, signal);
1899
- }
1896
+ } else await children3(handle, entry.path);
1900
1897
  signal?.throwIfAborted();
1901
1898
  await parent.removeEntry(name2);
1902
1899
  } catch (err) {
@@ -1905,18 +1902,52 @@ async function removeOne(parent, name2, rest2, lookup2, signal) {
1905
1902
  }
1906
1903
  function removeCopied(parent, name2, manifest, signal, overflow) {
1907
1904
  const entries = new Map(manifest.map((entry) => [entry.path, entry]));
1908
- return removeOne(parent, name2, "", (path) => entries.get(path) ?? overflow?.(path), signal);
1905
+ async function batch(dir, names2, parentPath) {
1906
+ signal?.throwIfAborted();
1907
+ const paths = names2.map((child2) => parentPath === void 0 ? "" : parentPath + "/" + child2);
1908
+ let extra;
1909
+ if (overflow) {
1910
+ const missing7 = paths.filter((path) => !entries.has(path));
1911
+ if (missing7.length) extra = await overflow(missing7);
1912
+ }
1913
+ for (const [i, path] of paths.entries())
1914
+ await removeOne(
1915
+ dir,
1916
+ names2[i],
1917
+ entries.get(path) ?? extra?.get(path),
1918
+ children3,
1919
+ signal
1920
+ );
1921
+ }
1922
+ async function children3(dir, path) {
1923
+ const names2 = [];
1924
+ for await (const child2 of dir.keys()) {
1925
+ signal?.throwIfAborted();
1926
+ names2.push(child2);
1927
+ if (names2.length === MANIFEST_BATCH) {
1928
+ await batch(dir, names2, path);
1929
+ names2.length = 0;
1930
+ }
1931
+ }
1932
+ if (names2.length) await batch(dir, names2, path);
1933
+ }
1934
+ return batch(parent, [name2]);
1909
1935
  }
1910
1936
 
1911
1937
  // src/fs/rename-manifest.ts
1912
1938
  var INLINE_BYTES = 256 * 1024;
1913
- var BATCH = 64;
1914
1939
  function manifestRoot(intent) {
1915
1940
  return "rename-manifest:" + intent;
1916
1941
  }
1917
- async function storedStamp(meta, intent, path) {
1918
- const [row] = await meta.get([manifestRoot(intent) + path]);
1919
- return row?.copyStamp && { path, ...row.copyStamp };
1942
+ async function storedStamps(meta, intent, paths) {
1943
+ const prefix = manifestRoot(intent);
1944
+ const rows = await meta.get(paths.map((path) => prefix + path));
1945
+ const found = /* @__PURE__ */ new Map();
1946
+ for (const [i, path] of paths.entries()) {
1947
+ const stamp = rows[i]?.copyStamp;
1948
+ if (stamp) found.set(path, { ...stamp, path });
1949
+ }
1950
+ return found;
1920
1951
  }
1921
1952
  var RenameManifest = class {
1922
1953
  meta;
@@ -1941,7 +1972,7 @@ var RenameManifest = class {
1941
1972
  const { path: relative2, ...copyStamp } = entry;
1942
1973
  const path = manifestRoot(this.intent) + relative2;
1943
1974
  this.pending.push({ path, change: () => ({ path, copyStamp }) });
1944
- if (this.pending.length === BATCH) await this.flush();
1975
+ if (this.pending.length === MANIFEST_BATCH) await this.flush();
1945
1976
  }
1946
1977
  async flush() {
1947
1978
  if (!this.pending.length) return;
@@ -4323,8 +4354,12 @@ var OpfsFs = class {
4323
4354
  }
4324
4355
  async removeReserved(intent, from, reservation, rename, signal) {
4325
4356
  if (rename.unverifiedSource) {
4326
- await this.sourceId(from);
4327
- throw fsError("EBUSY", from);
4357
+ const [dir, name2] = await this.parent(from);
4358
+ return this.inDir(dir, async (parent) => {
4359
+ await parent.getDirectoryHandle(name2);
4360
+ signal?.throwIfAborted();
4361
+ await parent.removeEntry(name2);
4362
+ });
4328
4363
  }
4329
4364
  const commit = reservation.copyCommit?.intent === intent ? reservation.copyCommit : void 0;
4330
4365
  const entries = commit?.entries ?? rename.copiedEntries;
@@ -4338,7 +4373,7 @@ var OpfsFs = class {
4338
4373
  name2,
4339
4374
  entries,
4340
4375
  signal,
4341
- commit?.indexed ? (path) => storedStamp(this.meta, intent, path) : void 0
4376
+ commit?.indexed ? (paths) => storedStamps(this.meta, intent, paths) : void 0
4342
4377
  ) : parent.removeEntry(name2);
4343
4378
  });
4344
4379
  }
@@ -10400,7 +10435,7 @@ function satisfies(version, range2) {
10400
10435
  }
10401
10436
 
10402
10437
  // src/version.ts
10403
- var KERNEL_VERSION = true ? "1.196.48" : "0.0.0-dev";
10438
+ var KERNEL_VERSION = true ? "1.196.49" : "0.0.0-dev";
10404
10439
  var OS_RELEASE = "6.0.0-slicc";
10405
10440
  function procVersion() {
10406
10441
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC