@ai-ecoverse/slicc-kernel 1.167.2 → 1.167.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.
@@ -8477,7 +8477,7 @@ function satisfies(version, range2) {
8477
8477
  }
8478
8478
 
8479
8479
  // src/version.ts
8480
- var KERNEL_VERSION = true ? "1.167.2" : "0.0.0-dev";
8480
+ var KERNEL_VERSION = true ? "1.167.3" : "0.0.0-dev";
8481
8481
  var OS_RELEASE = "6.0.0-slicc";
8482
8482
  function procVersion() {
8483
8483
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -33755,7 +33755,7 @@ var Launcher = class {
33755
33755
  kept: async (tab, items, paths) => {
33756
33756
  for (const { path, hidden, fid } of items) {
33757
33757
  if (hidden !== void 0 && sharedKept(hidden)) await this.adoptShared(path, hidden, fid);
33758
- else this.adoptKept(path, hidden, fid, ours);
33758
+ else await this.adoptKept(path, hidden, fid, ours);
33759
33759
  }
33760
33760
  await open2(tab, paths);
33761
33761
  },
@@ -33765,14 +33765,33 @@ var Launcher = class {
33765
33765
  }
33766
33766
  };
33767
33767
  }
33768
- async adoptShared(path, hidden, fid) {
33769
- const bound3 = [...this.held].map(
33770
- (holds2) => [holds2, [...holds2.boundAt(path, fid), ...holds2.boundAt(hidden, fid)]]
33771
- );
33772
- const keeping = bound3.filter(([, ids]) => ids.length > 0);
33768
+ async keptIds(hidden, fid) {
33769
+ if (fid !== void 0) return [fid];
33770
+ const st = await this.rootFs.lstat(hidden).catch(() => void 0);
33771
+ return st?.fid === void 0 ? [void 0] : [void 0, st.fid];
33772
+ }
33773
+ boundTo(path, hidden, fids) {
33774
+ const keeping = [...this.held].map(
33775
+ (holds2) => [
33776
+ holds2,
33777
+ fids.flatMap((fid) => [...holds2.boundAt(path, fid), ...holds2.boundAt(hidden, fid)])
33778
+ ]
33779
+ ).filter(([, ids]) => ids.length > 0);
33773
33780
  const nodes = [...this.openFiles].filter(
33774
33781
  (open2) => [path, hidden].some((at) => open2.holdsAt(at))
33775
33782
  );
33783
+ const keep2 = (file) => {
33784
+ const kept = nodes.filter(
33785
+ (open2) => fids.some((fid) => open2.keepBound([hidden, path], fid, file))
33786
+ ).length;
33787
+ for (let i = kept; i < nodes.length; i++) file.release();
33788
+ for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
33789
+ void this.rootFs.announceHolds?.([], [path, hidden], false);
33790
+ };
33791
+ return { keeping, nodes, keep: keep2 };
33792
+ }
33793
+ async adoptShared(path, hidden, fid) {
33794
+ const { keeping, nodes, keep: keep2 } = this.boundTo(path, hidden, await this.keptIds(hidden, fid));
33776
33795
  const refs = keeping.length + nodes.length;
33777
33796
  if (refs === 0) {
33778
33797
  this.held.doubt([path]);
@@ -33787,29 +33806,17 @@ var Launcher = class {
33787
33806
  this.held.doubt([path]);
33788
33807
  return;
33789
33808
  }
33790
- const kept = nodes.filter((open2) => open2.keepBound([hidden, path], fid, file)).length;
33791
- for (let i = kept; i < nodes.length; i++) file.release();
33792
- for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
33793
- void this.rootFs.announceHolds?.([], [path, hidden], false);
33809
+ keep2(file);
33794
33810
  }
33795
- adoptKept(path, hidden, fid, ours) {
33811
+ async adoptKept(path, hidden, fid, ours) {
33796
33812
  if (hidden === void 0 || !ours(hidden)) {
33797
33813
  this.held.doubt([path]);
33798
33814
  return;
33799
33815
  }
33800
- const bound3 = [...this.held].map(
33801
- (holds2) => [holds2, [...holds2.boundAt(path, fid), ...holds2.boundAt(hidden, fid)]]
33802
- );
33803
- const keeping = bound3.filter(([, ids]) => ids.length > 0);
33804
- const nodes = [...this.openFiles].filter(
33805
- (open2) => [path, hidden].some((at) => open2.holdsAt(at))
33806
- );
33816
+ const { keeping, nodes, keep: keep2 } = this.boundTo(path, hidden, await this.keptIds(hidden, fid));
33807
33817
  const file = this.unlinked.adopt(hidden, Math.max(keeping.length + nodes.length, 1));
33808
- const kept = nodes.filter((open2) => open2.keepBound([hidden, path], fid, file)).length;
33809
- for (let i = kept; i < nodes.length; i++) file.release();
33810
33818
  if (keeping.length === 0 && nodes.length === 0) file.release();
33811
- for (const [holds2, ids] of keeping) holds2.keepBound(ids, path, file);
33812
- void this.rootFs.announceHolds?.([], [path, hidden], false);
33819
+ keep2(file);
33813
33820
  }
33814
33821
  openNodes(fs, entries) {
33815
33822
  const nodes = new VfsNodes(fs, (path) => this.released(path), entries);
@@ -33846,6 +33853,7 @@ var Launcher = class {
33846
33853
  this.changes.flush();
33847
33854
  this.changes.foreign(crowded);
33848
33855
  if (crowded) {
33856
+ void this.announceHeld();
33849
33857
  void this.held.bindIds((path) => this.rootFileId(path)).then(
33850
33858
  () => Promise.all([...this.openFiles].map((open2) => open2.bindIds((p) => this.rootFileId(p))))
33851
33859
  ).then(() => this.announceHeld());