@ai-ecoverse/slicc-kernel 1.134.1 → 1.134.4

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
@@ -5635,14 +5635,14 @@ var OpfsFs = class {
5635
5635
  const staged = resolvePath(parent.path, staging);
5636
5636
  const place = async () => {
5637
5637
  this.forget(destination);
5638
- const timed2 = await this.explicitTimes(source.path);
5638
+ const copies = /* @__PURE__ */ new Map();
5639
5639
  const root = { ino: inodeOf(source.path), ...moving };
5640
5640
  const owned4 = lock ? { lock } : {};
5641
5641
  const first = copying ? await this.intend({ from: source.path, to: staged, root, ...owned4 }) : void 0;
5642
5642
  const second = copying && swap ? await this.intend({ from: staged, to: destination, replace: true, root, ...owned4 }) : void 0;
5643
5643
  const moved2 = await this.replacingTarget(
5644
5644
  targetStat !== null,
5645
- () => this.place(source.handle, dir, staging)
5645
+ () => this.place(source.handle, dir, staging, copies)
5646
5646
  ).catch(async (err) => {
5647
5647
  if (first) await this.rollBack(staged, source.path, [first, second]);
5648
5648
  throw err;
@@ -5656,15 +5656,13 @@ var OpfsFs = class {
5656
5656
  await this.meta.update(source.path, () => left);
5657
5657
  }
5658
5658
  if (first) await this.meta.update(first, () => void 0);
5659
- let copied = !moved2;
5660
5659
  if (swap) {
5661
5660
  const hidden = await dir.getDirectoryHandle(staging);
5662
- const placed = await this.place(hidden, dir, name2);
5661
+ const placed = await this.place(hidden, dir, name2, copies);
5663
5662
  if (!placed) await dir.removeEntry(staging, { recursive: true });
5664
- copied ||= !placed;
5665
5663
  }
5666
5664
  if (second) await this.meta.update(second, () => void 0);
5667
- if (copied) await this.restamp(destination, timed2);
5665
+ await this.restamp(destination, copies);
5668
5666
  this.changed(source.path, destination);
5669
5667
  this.touch(Date.now(), parentOf4(source.path), parent.path);
5670
5668
  };
@@ -5881,22 +5879,17 @@ var OpfsFs = class {
5881
5879
  const handle = await this.handle(path);
5882
5880
  return handle.kind === "file" ? (await this.snapshot(handle)).lastModified : 0;
5883
5881
  }
5884
- async explicitTimes(path) {
5885
- const timed2 = [];
5886
- for (const entry of await this.meta.under(path)) {
5887
- if (entry.mtimeFor === void 0 || entry.link !== void 0) continue;
5888
- const current = await this.modified(entry.path).catch(() => void 0);
5889
- if (current === entry.mtimeFor) timed2.push(entry.path.slice(path.length));
5890
- }
5891
- return timed2;
5892
- }
5893
- async restamp(path, timed2) {
5894
- for (const rest2 of timed2) {
5895
- const mtimeFor = await this.modified(path + rest2);
5882
+ async restamp(path, copies) {
5883
+ if (copies.size === 0) return;
5884
+ const copied = [...copies];
5885
+ const entries = await this.meta.get(copied.map(([rest2]) => path + rest2));
5886
+ for (const [i, [rest2, { before, made: made2 }]] of copied.entries()) {
5887
+ if (entries[i]?.mtimeFor !== before) continue;
5888
+ const mtimeFor = (await this.io(made2.getFile())).lastModified;
5896
5889
  await this.meta.update(path + rest2, (entry) => entry && { ...entry, mtimeFor });
5897
5890
  }
5898
5891
  }
5899
- async place(handle, dir, name2) {
5892
+ async place(handle, dir, name2, copies) {
5900
5893
  const move = handle.move;
5901
5894
  if (move) this.others++;
5902
5895
  const moved2 = await move?.call(handle, dir, name2).then(
@@ -5906,7 +5899,7 @@ var OpfsFs = class {
5906
5899
  if (moved2) return true;
5907
5900
  const before = this.fileMoves;
5908
5901
  try {
5909
- await this.copy(handle, dir, name2);
5902
+ await this.copy(handle, dir, name2, copies);
5910
5903
  } catch (err) {
5911
5904
  if (handle.kind === "directory" && this.fileMoves === before) {
5912
5905
  await this.io(dir.removeEntry(name2, { recursive: true }));
@@ -5916,7 +5909,7 @@ var OpfsFs = class {
5916
5909
  return false;
5917
5910
  }
5918
5911
  fileMoves = 0;
5919
- async copy(handle, dir, name2) {
5912
+ async copy(handle, dir, name2, copies, rest2 = "") {
5920
5913
  if (handle.kind === "file" && movable(handle)) {
5921
5914
  this.others++;
5922
5915
  const moved2 = await handle.move?.(dir, name2).then(
@@ -5931,13 +5924,17 @@ var OpfsFs = class {
5931
5924
  if (handle.kind === "file") {
5932
5925
  const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
5933
5926
  const writable2 = await this.io(made2.createWritable());
5934
- await writable2.write(await this.io(handle.getFile()));
5927
+ const file = await this.io(handle.getFile());
5928
+ await writable2.write(file);
5935
5929
  await writable2.close();
5930
+ copies?.set(rest2, { before: copies.get(rest2)?.before ?? file.lastModified, made: made2 });
5936
5931
  return;
5937
5932
  }
5938
5933
  const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
5939
5934
  this.others++;
5940
- for await (const child of handle.values()) await this.copy(child, target, child.name);
5935
+ for await (const child of handle.values()) {
5936
+ await this.copy(child, target, child.name, copies, `${rest2}/${child.name}`);
5937
+ }
5941
5938
  }
5942
5939
  async symlink(target, path, owner) {
5943
5940
  const parent = await this.locate(parentOf4(path), true);
@@ -7470,7 +7467,7 @@ function satisfies(version, range2) {
7470
7467
  }
7471
7468
 
7472
7469
  // src/version.ts
7473
- var KERNEL_VERSION = true ? "1.134.1" : "0.0.0-dev";
7470
+ var KERNEL_VERSION = true ? "1.134.4" : "0.0.0-dev";
7474
7471
  var OS_RELEASE = "6.0.0-slicc";
7475
7472
  function procVersion() {
7476
7473
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -13675,7 +13672,7 @@ var AsyncRangedFile = class {
13675
13672
  };
13676
13673
 
13677
13674
  // src/realm/sync-sab-bridge.ts
13678
- var PATH_OPS = new Set(SYNC_FS_OPS);
13675
+ var UNCOUNTED_OPS = /* @__PURE__ */ new Set([...SYNC_FS_OPS, "cwd-check", "cwd-chdir"]);
13679
13676
  var SPIN_CORES = 4;
13680
13677
  var spinning = (globalThis.navigator?.hardwareConcurrency ?? 0) >= SPIN_CORES;
13681
13678
 
@@ -13723,6 +13720,8 @@ var SYS_TREE = {
13723
13720
  slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
13724
13721
  `,
13725
13722
  slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
13723
+ `,
13724
+ slicc_cwd_checks: (listing) => `${listing.cwdChecks ?? 0}
13726
13725
  `
13727
13726
  }
13728
13727
  };
@@ -24624,6 +24623,9 @@ var WasmMemories = class {
24624
24623
  const source = this.learned ? "learned" : ceiling === void 0 ? "none" : "default";
24625
24624
  return { live: this.live, ceiling: ceiling ?? 0, source };
24626
24625
  }
24626
+ started() {
24627
+ this.progress();
24628
+ }
24627
24629
  ended() {
24628
24630
  this.live = Math.max(0, this.live - 1);
24629
24631
  this.progress();
@@ -28008,6 +28010,7 @@ var Launcher = class {
28008
28010
  });
28009
28011
  const counted3 = (handle2) => {
28010
28012
  void handle2.exited.finally(() => this.memories.ended());
28013
+ void Promise.resolve(handle2.ready).then(() => this.memories.started());
28011
28014
  return handle2;
28012
28015
  };
28013
28016
  if (!this.memories.near()) {
@@ -28106,7 +28109,8 @@ var Launcher = class {
28106
28109
  peers: Number(this.locks.shared?.() === true),
28107
28110
  fsCalls: servedFsCalls(),
28108
28111
  opfsCalls: this.rootFs.opfsCalls?.() ?? 0,
28109
- opfsOps: this.rootFs.opfsOps?.() ?? 0
28112
+ opfsOps: this.rootFs.opfsOps?.() ?? 0,
28113
+ cwdChecks: this.cwds.checks
28110
28114
  }),
28111
28115
  sudo: (call, signal) => this.sudo(pid, call, signal),
28112
28116
  crontab: (call) => this.crontab(pid, call),
@@ -30659,6 +30663,7 @@ async function createNodeKernel(options = {}) {
30659
30663
  ...options.sealed ? { sealed: options.sealed } : {},
30660
30664
  ...options.clipboard ? { clipboard: options.clipboard } : {},
30661
30665
  ...options.approve ? { approve: options.approve } : {},
30666
+ ...options.wasmMemories ? { wasmMemories: options.wasmMemories } : {},
30662
30667
  cron: { lock: cronLock(root), ...options.cron?.clock ? { clock: options.cron.clock } : {} }
30663
30668
  });
30664
30669
  await launcher.prepare();