@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.
@@ -5235,7 +5235,7 @@ function satisfies(version, range2) {
5235
5235
  }
5236
5236
 
5237
5237
  // src/version.ts
5238
- var KERNEL_VERSION = true ? "1.196.13" : "0.0.0-dev";
5238
+ var KERNEL_VERSION = true ? "1.196.14" : "0.0.0-dev";
5239
5239
  var OS_RELEASE = "6.0.0-slicc";
5240
5240
  function procVersion() {
5241
5241
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -34358,7 +34358,6 @@ var OpfsFs = class {
34358
34358
  if (!crowded && options?.alone !== true) {
34359
34359
  throw fsError("ENOTSUP", `${path}: appended by position while no other tab shares the root`);
34360
34360
  }
34361
- if (crowded) await this.remote?.peered();
34362
34361
  const at = normalizePath(path);
34363
34362
  if (this.renamesInFlight()) await this.writeWaits(at);
34364
34363
  const ended = this.writeStarted(at);
@@ -34793,7 +34792,7 @@ var OpfsFs = class {
34793
34792
  let lock;
34794
34793
  const hooks = {};
34795
34794
  const staging = swap ? `.${name2}.${crypto.randomUUID()}` : name2;
34796
- const copying = sourceStat.isDirectory && !movable(source.handle);
34795
+ const copying = swap || sourceStat.isDirectory && !movable(source.handle);
34797
34796
  const staged2 = resolvePath(parent.path, staging);
34798
34797
  const place = async () => {
34799
34798
  this.forget(destination);
@@ -34811,7 +34810,7 @@ var OpfsFs = class {
34811
34810
  });
34812
34811
  const moved3 = await this.replacingTarget(
34813
34812
  targetStat !== null,
34814
- () => this.place(source.handle, dir, staging, copies)
34813
+ () => this.place(source.handle, dir, staging, copies, copying)
34815
34814
  ).catch(async (err) => {
34816
34815
  if (first) await this.rollBack(staged2, source.path, [first, second]);
34817
34816
  throw err;
@@ -34824,7 +34823,7 @@ var OpfsFs = class {
34824
34823
  if (first) await this.meta.update(first, () => void 0);
34825
34824
  if (swap) {
34826
34825
  const hidden = await dir.getDirectoryHandle(staging);
34827
- const placed = await this.place(hidden, dir, name2, copies);
34826
+ const placed = await this.place(hidden, dir, name2, copies, copying);
34828
34827
  if (!placed) await dir.removeEntry(staging, { recursive: true });
34829
34828
  }
34830
34829
  if (second) await this.meta.update(second, () => void 0);
@@ -34833,6 +34832,7 @@ var OpfsFs = class {
34833
34832
  this.touch(Date.now(), parentOf11(source.path), parent.path);
34834
34833
  };
34835
34834
  if (!copying) return sourceStat.isDirectory ? place() : this.movingFile(source.path, place);
34835
+ if (this.remote && !this.locks) throw fsError("EBUSY", source.path);
34836
34836
  const { promise, resolve: resolve2 } = Promise.withResolvers();
34837
34837
  const entry = { from: source.path, to: destination, done: promise };
34838
34838
  this.renamingDirs.add(entry);
@@ -35095,6 +35095,7 @@ var OpfsFs = class {
35095
35095
  return this.remote !== void 0 && this.locks !== void 0 && this.shared();
35096
35096
  }
35097
35097
  async peerOp(name2, args, inner) {
35098
+ if (name2 === "append") await this.remote?.peered();
35098
35099
  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);
35099
35100
  const listing = LISTINGS.has(name2);
35100
35101
  const removing = REMOVALS2.has(name2);
@@ -35134,7 +35135,8 @@ var OpfsFs = class {
35134
35135
  await this.copy(
35135
35136
  moved3.handle,
35136
35137
  back.handle,
35137
- baseOf4(to)
35138
+ baseOf4(to),
35139
+ { restoring: true }
35138
35140
  );
35139
35141
  const [dir, name2] = await this.parent(from);
35140
35142
  await this.inDir(dir, (parent) => parent.removeEntry(name2, { recursive: true }));
@@ -35329,11 +35331,12 @@ var OpfsFs = class {
35329
35331
  await this.meta.update(path + rest2, (entry) => entry && { ...entry, mtimeFor });
35330
35332
  }
35331
35333
  }
35332
- async place(handle, dir, name2, copies) {
35333
- if (await this.moved(handle, dir, name2)) return true;
35334
+ async place(handle, dir, name2, copies, admitted) {
35335
+ if (await this.moved(handle, dir, name2, admitted)) return true;
35336
+ if (!admitted) throw fsError("EBUSY", name2);
35334
35337
  const before = this.fileMoves;
35335
35338
  try {
35336
- await this.copy(handle, dir, name2, copies);
35339
+ await this.copy(handle, dir, name2, { copies });
35337
35340
  } catch (err) {
35338
35341
  if (handle.kind === "directory" && this.fileMoves === before) {
35339
35342
  await this.io(dir.removeEntry(name2, { recursive: true }));
@@ -35343,48 +35346,61 @@ var OpfsFs = class {
35343
35346
  return false;
35344
35347
  }
35345
35348
  fileMoves = 0;
35346
- async moved(handle, dir, name2) {
35349
+ async moved(handle, dir, name2, canCopyLocked) {
35347
35350
  const move = handle.move;
35348
35351
  if (!move) return false;
35349
35352
  for (let attempt = 0; ; attempt++) {
35350
35353
  this.others++;
35351
- const failed4 = await move.call(handle, dir, name2).then(
35352
- () => void 0,
35353
- (err) => ({ err })
35354
- );
35355
- if (!failed4) return true;
35356
- const error = failed4.err?.name;
35357
- if (handle.kind !== "file" || !LOCKED.has(error)) return false;
35358
- const delay2 = SYNC_BACKOFF_MS[attempt];
35359
- if (delay2 === void 0) throw fsError("EBUSY", name2);
35360
- await new Promise((resolve2) => setTimeout(resolve2, delay2));
35354
+ try {
35355
+ await move.call(handle, dir, name2);
35356
+ return true;
35357
+ } catch (err) {
35358
+ const error = err;
35359
+ if (error?.name === "NotSupportedError" || error?.code === "ENOTSUP" || error?.code === "EOPNOTSUPP")
35360
+ return false;
35361
+ if (!LOCKED.has(error?.name ?? "")) throw translate(err, name2, "write");
35362
+ if (canCopyLocked) return false;
35363
+ const delay2 = SYNC_BACKOFF_MS[attempt];
35364
+ if (handle.kind !== "file" || delay2 === void 0) throw fsError("EBUSY", name2);
35365
+ await new Promise((resolve2) => setTimeout(resolve2, delay2));
35366
+ }
35361
35367
  }
35362
35368
  }
35363
- async copy(handle, dir, name2, copies, rest2 = "") {
35364
- if (handle.kind === "file" && movable(handle)) {
35365
- this.others++;
35366
- const moved3 = await handle.move?.(dir, name2).then(
35367
- () => true,
35368
- () => false
35369
- );
35370
- if (moved3) {
35371
- this.fileMoves++;
35372
- return;
35373
- }
35369
+ async moveChild(file, dir, name2) {
35370
+ if (!file.move) return false;
35371
+ this.others++;
35372
+ try {
35373
+ await file.move(dir, name2);
35374
+ } catch {
35375
+ return false;
35374
35376
  }
35377
+ this.fileMoves++;
35378
+ return true;
35379
+ }
35380
+ async copy(handle, dir, name2, options = {}, rest2 = "") {
35375
35381
  if (handle.kind === "file") {
35382
+ if (options.restoring && await this.handleExists(dir, name2)) return;
35383
+ if (await this.moveChild(handle, dir, name2)) return;
35384
+ const file = await this.io(handle.getFile());
35376
35385
  const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
35377
35386
  const writable3 = await this.io(made2.createWritable());
35378
- const file = await this.io(handle.getFile());
35379
- await writable3.write(file);
35380
- await writable3.close();
35381
- copies?.set(rest2, { before: copies.get(rest2)?.before ?? file.lastModified, made: made2 });
35387
+ try {
35388
+ await writable3.write(file);
35389
+ await writable3.close();
35390
+ } catch (err) {
35391
+ await writable3.abort().catch(nothing2);
35392
+ throw err;
35393
+ }
35394
+ options.copies?.set(rest2, {
35395
+ before: options.copies.get(rest2)?.before ?? file.lastModified,
35396
+ made: made2
35397
+ });
35382
35398
  return;
35383
35399
  }
35384
35400
  const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
35385
35401
  this.others++;
35386
35402
  for await (const child2 of handle.values()) {
35387
- await this.copy(child2, target, child2.name, copies, `${rest2}/${child2.name}`);
35403
+ await this.copy(child2, target, child2.name, options, `${rest2}/${child2.name}`);
35388
35404
  }
35389
35405
  }
35390
35406
  async symlink(target, path, owner) {