@ai-ecoverse/slicc-kernel 1.196.13 → 1.196.14

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.
@@ -9284,7 +9284,7 @@ var init_version = __esm({
9284
9284
  "src/version.ts"() {
9285
9285
  "use strict";
9286
9286
  init_captured_globals();
9287
- KERNEL_VERSION = true ? "1.196.13" : "0.0.0-dev";
9287
+ KERNEL_VERSION = true ? "1.196.14" : "0.0.0-dev";
9288
9288
  OS_RELEASE = "6.0.0-slicc";
9289
9289
  }
9290
9290
  });
@@ -9283,7 +9283,7 @@ var init_version = __esm({
9283
9283
  "src/version.ts"() {
9284
9284
  "use strict";
9285
9285
  init_captured_globals();
9286
- KERNEL_VERSION = true ? "1.196.13" : "0.0.0-dev";
9286
+ KERNEL_VERSION = true ? "1.196.14" : "0.0.0-dev";
9287
9287
  OS_RELEASE = "6.0.0-slicc";
9288
9288
  }
9289
9289
  });
package/dist/node.js CHANGED
@@ -7732,7 +7732,7 @@ function satisfies(version, range2) {
7732
7732
  }
7733
7733
 
7734
7734
  // src/version.ts
7735
- var KERNEL_VERSION = true ? "1.196.13" : "0.0.0-dev";
7735
+ var KERNEL_VERSION = true ? "1.196.14" : "0.0.0-dev";
7736
7736
  var OS_RELEASE = "6.0.0-slicc";
7737
7737
  function procVersion() {
7738
7738
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -34686,7 +34686,6 @@ var OpfsFs = class {
34686
34686
  if (!crowded && options?.alone !== true) {
34687
34687
  throw fsError("ENOTSUP", `${path}: appended by position while no other tab shares the root`);
34688
34688
  }
34689
- if (crowded) await this.remote?.peered();
34690
34689
  const at = normalizePath(path);
34691
34690
  if (this.renamesInFlight()) await this.writeWaits(at);
34692
34691
  const ended = this.writeStarted(at);
@@ -35121,7 +35120,7 @@ var OpfsFs = class {
35121
35120
  let lock;
35122
35121
  const hooks = {};
35123
35122
  const staging = swap ? `.${name2}.${crypto.randomUUID()}` : name2;
35124
- const copying = sourceStat.isDirectory && !movable(source.handle);
35123
+ const copying = swap || sourceStat.isDirectory && !movable(source.handle);
35125
35124
  const staged2 = resolvePath(parent.path, staging);
35126
35125
  const place = async () => {
35127
35126
  this.forget(destination);
@@ -35139,7 +35138,7 @@ var OpfsFs = class {
35139
35138
  });
35140
35139
  const moved2 = await this.replacingTarget(
35141
35140
  targetStat !== null,
35142
- () => this.place(source.handle, dir, staging, copies)
35141
+ () => this.place(source.handle, dir, staging, copies, copying)
35143
35142
  ).catch(async (err) => {
35144
35143
  if (first) await this.rollBack(staged2, source.path, [first, second]);
35145
35144
  throw err;
@@ -35152,7 +35151,7 @@ var OpfsFs = class {
35152
35151
  if (first) await this.meta.update(first, () => void 0);
35153
35152
  if (swap) {
35154
35153
  const hidden = await dir.getDirectoryHandle(staging);
35155
- const placed = await this.place(hidden, dir, name2, copies);
35154
+ const placed = await this.place(hidden, dir, name2, copies, copying);
35156
35155
  if (!placed) await dir.removeEntry(staging, { recursive: true });
35157
35156
  }
35158
35157
  if (second) await this.meta.update(second, () => void 0);
@@ -35161,6 +35160,7 @@ var OpfsFs = class {
35161
35160
  this.touch(Date.now(), parentOf11(source.path), parent.path);
35162
35161
  };
35163
35162
  if (!copying) return sourceStat.isDirectory ? place() : this.movingFile(source.path, place);
35163
+ if (this.remote && !this.locks) throw fsError("EBUSY", source.path);
35164
35164
  const { promise, resolve: resolve2 } = Promise.withResolvers();
35165
35165
  const entry = { from: source.path, to: destination, done: promise };
35166
35166
  this.renamingDirs.add(entry);
@@ -35423,6 +35423,7 @@ var OpfsFs = class {
35423
35423
  return this.remote !== void 0 && this.locks !== void 0 && this.shared();
35424
35424
  }
35425
35425
  async peerOp(name2, args, inner) {
35426
+ if (name2 === "append") await this.remote?.peered();
35426
35427
  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);
35427
35428
  const listing = LISTINGS.has(name2);
35428
35429
  const removing = REMOVALS2.has(name2);
@@ -35462,7 +35463,8 @@ var OpfsFs = class {
35462
35463
  await this.copy(
35463
35464
  moved2.handle,
35464
35465
  back.handle,
35465
- baseOf4(to)
35466
+ baseOf4(to),
35467
+ { restoring: true }
35466
35468
  );
35467
35469
  const [dir, name2] = await this.parent(from);
35468
35470
  await this.inDir(dir, (parent) => parent.removeEntry(name2, { recursive: true }));
@@ -35657,11 +35659,12 @@ var OpfsFs = class {
35657
35659
  await this.meta.update(path + rest2, (entry) => entry && { ...entry, mtimeFor });
35658
35660
  }
35659
35661
  }
35660
- async place(handle, dir, name2, copies) {
35661
- if (await this.moved(handle, dir, name2)) return true;
35662
+ async place(handle, dir, name2, copies, admitted) {
35663
+ if (await this.moved(handle, dir, name2, admitted)) return true;
35664
+ if (!admitted) throw fsError("EBUSY", name2);
35662
35665
  const before = this.fileMoves;
35663
35666
  try {
35664
- await this.copy(handle, dir, name2, copies);
35667
+ await this.copy(handle, dir, name2, { copies });
35665
35668
  } catch (err) {
35666
35669
  if (handle.kind === "directory" && this.fileMoves === before) {
35667
35670
  await this.io(dir.removeEntry(name2, { recursive: true }));
@@ -35671,48 +35674,61 @@ var OpfsFs = class {
35671
35674
  return false;
35672
35675
  }
35673
35676
  fileMoves = 0;
35674
- async moved(handle, dir, name2) {
35677
+ async moved(handle, dir, name2, canCopyLocked) {
35675
35678
  const move = handle.move;
35676
35679
  if (!move) return false;
35677
35680
  for (let attempt = 0; ; attempt++) {
35678
35681
  this.others++;
35679
- const failed5 = await move.call(handle, dir, name2).then(
35680
- () => void 0,
35681
- (err) => ({ err })
35682
- );
35683
- if (!failed5) return true;
35684
- const error = failed5.err?.name;
35685
- if (handle.kind !== "file" || !LOCKED.has(error)) return false;
35686
- const delay2 = SYNC_BACKOFF_MS[attempt];
35687
- if (delay2 === void 0) throw fsError("EBUSY", name2);
35688
- await new Promise((resolve2) => setTimeout(resolve2, delay2));
35682
+ try {
35683
+ await move.call(handle, dir, name2);
35684
+ return true;
35685
+ } catch (err) {
35686
+ const error = err;
35687
+ if (error?.name === "NotSupportedError" || error?.code === "ENOTSUP" || error?.code === "EOPNOTSUPP")
35688
+ return false;
35689
+ if (!LOCKED.has(error?.name ?? "")) throw translate(err, name2, "write");
35690
+ if (canCopyLocked) return false;
35691
+ const delay2 = SYNC_BACKOFF_MS[attempt];
35692
+ if (handle.kind !== "file" || delay2 === void 0) throw fsError("EBUSY", name2);
35693
+ await new Promise((resolve2) => setTimeout(resolve2, delay2));
35694
+ }
35689
35695
  }
35690
35696
  }
35691
- async copy(handle, dir, name2, copies, rest2 = "") {
35692
- if (handle.kind === "file" && movable(handle)) {
35693
- this.others++;
35694
- const moved2 = await handle.move?.(dir, name2).then(
35695
- () => true,
35696
- () => false
35697
- );
35698
- if (moved2) {
35699
- this.fileMoves++;
35700
- return;
35701
- }
35697
+ async moveChild(file, dir, name2) {
35698
+ if (!file.move) return false;
35699
+ this.others++;
35700
+ try {
35701
+ await file.move(dir, name2);
35702
+ } catch {
35703
+ return false;
35702
35704
  }
35705
+ this.fileMoves++;
35706
+ return true;
35707
+ }
35708
+ async copy(handle, dir, name2, options = {}, rest2 = "") {
35703
35709
  if (handle.kind === "file") {
35710
+ if (options.restoring && await this.handleExists(dir, name2)) return;
35711
+ if (await this.moveChild(handle, dir, name2)) return;
35712
+ const file = await this.io(handle.getFile());
35704
35713
  const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
35705
35714
  const writable3 = await this.io(made2.createWritable());
35706
- const file = await this.io(handle.getFile());
35707
- await writable3.write(file);
35708
- await writable3.close();
35709
- copies?.set(rest2, { before: copies.get(rest2)?.before ?? file.lastModified, made: made2 });
35715
+ try {
35716
+ await writable3.write(file);
35717
+ await writable3.close();
35718
+ } catch (err) {
35719
+ await writable3.abort().catch(nothing2);
35720
+ throw err;
35721
+ }
35722
+ options.copies?.set(rest2, {
35723
+ before: options.copies.get(rest2)?.before ?? file.lastModified,
35724
+ made: made2
35725
+ });
35710
35726
  return;
35711
35727
  }
35712
35728
  const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
35713
35729
  this.others++;
35714
35730
  for await (const child2 of handle.values()) {
35715
- await this.copy(child2, target, child2.name, copies, `${rest2}/${child2.name}`);
35731
+ await this.copy(child2, target, child2.name, options, `${rest2}/${child2.name}`);
35716
35732
  }
35717
35733
  }
35718
35734
  async symlink(target, path, owner) {