@ai-ecoverse/slicc-kernel 1.142.3 → 1.143.1

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
@@ -4553,6 +4553,7 @@ var escapeRoot = (name2) => name2.replace(/[%:]/g, (c) => `%${c.charCodeAt(0).to
4553
4553
  var LEGACY_RENAME_LOCK = /^slicc-rename:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
4554
4554
  var PAIRED = /* @__PURE__ */ new Set(["rename", "link", "copyFile"]);
4555
4555
  var LISTINGS = /* @__PURE__ */ new Set(["readdir", "readdirStat"]);
4556
+ var REMOVALS = /* @__PURE__ */ new Set(["rm", "rename"]);
4556
4557
  var RETRY = /* @__PURE__ */ Symbol("retry");
4557
4558
  var ACK_SAMPLES = 4096;
4558
4559
  var INTENT_POLL_MS = 5;
@@ -6027,10 +6028,11 @@ var OpfsFs = class {
6027
6028
  const running = [...this.inflight];
6028
6029
  const reached = await Promise.all(
6029
6030
  running.map(async (op) => {
6030
- if (op.paths.some((at) => touches(at, trees))) return true;
6031
+ const near = (at) => touches(at, trees, true, op.removing === true);
6032
+ if (op.paths.some(near)) return true;
6031
6033
  for (const at of op.paths) {
6032
6034
  const forms = await this.resolvedForms(at);
6033
- if (forms.some((form) => touches(form, trees))) return true;
6035
+ if (forms.some(near)) return true;
6034
6036
  }
6035
6037
  return false;
6036
6038
  })
@@ -6047,10 +6049,10 @@ var OpfsFs = class {
6047
6049
  })
6048
6050
  );
6049
6051
  }
6050
- peerAt(at, listing) {
6052
+ peerAt(at, listing, removing = false) {
6051
6053
  for (const move of this.peerMoves.values()) {
6052
6054
  if (this.ownLocks.has(move.lock)) continue;
6053
- if (touches(at, move.trees, listing)) return move;
6055
+ if (touches(at, move.trees, listing, removing)) return move;
6054
6056
  }
6055
6057
  return void 0;
6056
6058
  }
@@ -6085,11 +6087,11 @@ var OpfsFs = class {
6085
6087
  this.peerWaits.set(move.lock, wait2);
6086
6088
  return wait2;
6087
6089
  }
6088
- async peerSettled(at, listing) {
6090
+ async peerSettled(at, listing, removing) {
6089
6091
  await this.lookForRenames();
6090
6092
  for (let reals; ; ) {
6091
6093
  const forms = [at, ...reals ?? []];
6092
- const move = forms.map((form) => this.peerAt(form, listing)).find(Boolean);
6094
+ const move = forms.map((form) => this.peerAt(form, listing, removing)).find(Boolean);
6093
6095
  if (move) {
6094
6096
  this.peerWaited++;
6095
6097
  await this.peerMoved(move);
@@ -6127,13 +6129,14 @@ var OpfsFs = class {
6127
6129
  async peerOp(name2, args, inner) {
6128
6130
  const paths = (name2 === "symlink" ? args.slice(1, 2) : PAIRED.has(name2) ? args.slice(0, 2) : args.slice(0, 1)).filter((path) => typeof path === "string").map(normalizePath);
6129
6131
  const listing = LISTINGS.has(name2);
6132
+ const removing = REMOVALS.has(name2);
6130
6133
  const checked = [...paths];
6131
6134
  while (this.amongPeers()) {
6132
6135
  checked.length = 0;
6133
- for (const at of paths) checked.push(...await this.peerSettled(at, listing));
6134
- if (!checked.some((at) => this.peerAt(at, listing))) break;
6136
+ for (const at of paths) checked.push(...await this.peerSettled(at, listing, removing));
6137
+ if (!checked.some((at) => this.peerAt(at, listing, removing))) break;
6135
6138
  }
6136
- const busy = { paths: checked, release: () => void 0 };
6139
+ const busy = { paths: checked, removing, release: () => void 0 };
6137
6140
  const done4 = () => {
6138
6141
  this.inflight.delete(busy);
6139
6142
  busy.waiting?.resolve();
@@ -6558,9 +6561,9 @@ var OpfsFs = class {
6558
6561
  function nothing() {
6559
6562
  return void 0;
6560
6563
  }
6561
- function touches(at, trees, listing = true) {
6564
+ function touches(at, trees, listing = true, removing = false) {
6562
6565
  return trees.some(
6563
- ([from, to]) => within3(at, from) || within3(at, to) || listing && (at === parentOf4(from) || at === parentOf4(to))
6566
+ ([from, to]) => within3(at, from) || within3(at, to) || listing && (at === parentOf4(from) || at === parentOf4(to)) || removing && (at === "/" || within3(from, at) || within3(to, at))
6564
6567
  );
6565
6568
  }
6566
6569
  function byIntent(a, b) {
@@ -7979,7 +7982,7 @@ function satisfies(version, range2) {
7979
7982
  }
7980
7983
 
7981
7984
  // src/version.ts
7982
- var KERNEL_VERSION = true ? "1.142.3" : "0.0.0-dev";
7985
+ var KERNEL_VERSION = true ? "1.143.1" : "0.0.0-dev";
7983
7986
  var OS_RELEASE = "6.0.0-slicc";
7984
7987
  function procVersion() {
7985
7988
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -13583,7 +13586,7 @@ async function guardAndResolve(entry, path, req) {
13583
13586
  entry: { ...entry, fs: noLinks }
13584
13587
  };
13585
13588
  }
13586
- var REMOVALS = /* @__PURE__ */ new Set(["unlink", "rmdir", "rm"]);
13589
+ var REMOVALS2 = /* @__PURE__ */ new Set(["unlink", "rmdir", "rm"]);
13587
13590
  var CREATIONS = /* @__PURE__ */ new Set([
13588
13591
  "write",
13589
13592
  "mkdir",
@@ -13629,7 +13632,7 @@ async function dispatchPath(entry, req) {
13629
13632
  const { fs, cwd } = entry;
13630
13633
  try {
13631
13634
  const path = fs.resolvePath(cwd, req.path);
13632
- const device = REMOVALS.has(req.op) ? devRemoval(path, entry.cred?.()) : void 0;
13635
+ const device = REMOVALS2.has(req.op) ? devRemoval(path, entry.cred?.()) : void 0;
13633
13636
  if (device) return { ok: false, errno: device, message: `${path}: a device entry stays` };
13634
13637
  const made2 = await newDevName(entry, path, req);
13635
13638
  if (made2) return made2;