@ai-ecoverse/slicc-kernel 1.26.1 → 1.26.2

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
@@ -3808,6 +3808,9 @@ var MountFs = class {
3808
3808
  truncate: false,
3809
3809
  exclusive: false,
3810
3810
  ...version !== void 0 ? { ifMatch: version } : {}
3811
+ }).catch((err) => {
3812
+ const gone = version !== void 0 && err.code === "ENOENT";
3813
+ throw gone ? errnoError("ESTALE", `${real} is gone from the host`) : err;
3811
3814
  });
3812
3815
  const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
3813
3816
  const chunks2 = [];
@@ -6493,6 +6496,7 @@ function within3(path, root) {
6493
6496
  var VfsNode = class {
6494
6497
  data;
6495
6498
  ranged;
6499
+ pin;
6496
6500
  length = 0;
6497
6501
  dirty = false;
6498
6502
  queue = Promise.resolve();
@@ -6504,8 +6508,9 @@ var VfsNode = class {
6504
6508
  fs;
6505
6509
  path;
6506
6510
  orphaned;
6507
- constructor(fs, path, contents2, orphaned = false, dirty = false) {
6511
+ constructor(fs, path, contents2, orphaned = false, dirty = false, pin) {
6508
6512
  this.fs = fs;
6513
+ this.pin = pin;
6509
6514
  this.path = path;
6510
6515
  this.orphaned = orphaned;
6511
6516
  if (contents2 !== void 0) this.data = new Uint8Array(contents2);
@@ -6529,6 +6534,10 @@ var VfsNode = class {
6529
6534
  if (this.revoked) throw new KernelError("EIO");
6530
6535
  if (this.ranged || this.data) return this.ranged;
6531
6536
  const io = rangedOps(this.fs);
6537
+ if (io && this.pin && !this.orphaned) {
6538
+ this.ranged = new AsyncRangedFile(io, this.path, this.pin.size, this.pin.version);
6539
+ return this.ranged;
6540
+ }
6532
6541
  const st = io && !this.orphaned ? await this.fs.stat?.(this.path).catch(() => void 0) : void 0;
6533
6542
  if (io && st?.ranged) {
6534
6543
  this.ranged = new AsyncRangedFile(io, this.path, st.size ?? 0, st.version);
@@ -6668,10 +6677,10 @@ var VfsNodes = class {
6668
6677
  constructor(fs) {
6669
6678
  this.fs = fs;
6670
6679
  }
6671
- open(path) {
6680
+ open(path, pin) {
6672
6681
  let node = this.byPath.get(path);
6673
6682
  if (!node) {
6674
- node = new VfsNode(this.fs, path);
6683
+ node = new VfsNode(this.fs, path, void 0, false, false, pin);
6675
6684
  this.byPath.set(path, node);
6676
6685
  }
6677
6686
  node.opens++;
@@ -6792,7 +6801,7 @@ function vfsFile(fs, opts, nodes) {
6792
6801
  const access = opts.flags & O_ACCMODE;
6793
6802
  const readable = access !== O_WRONLY;
6794
6803
  const writable = access === O_WRONLY || access === O_RDWR;
6795
- const node = !nodes || opts.orphan ? new VfsNode(fs, opts.path, opts.contents, opts.orphan === true, opts.dirty === true) : opts.contents !== void 0 ? nodes.adopt(opts.path, opts.contents, opts.dirty === true) : nodes.open(opts.path);
6804
+ const node = !nodes || opts.orphan ? new VfsNode(fs, opts.path, opts.contents, opts.orphan === true, opts.dirty === true) : opts.contents !== void 0 ? nodes.adopt(opts.path, opts.contents, opts.dirty === true) : nodes.open(opts.path, opts.pin);
6796
6805
  let openError;
6797
6806
  const atOpen = (op) => {
6798
6807
  void node.serial(op).catch((err) => {
@@ -7110,7 +7119,8 @@ var WasmProcess = class {
7110
7119
  ...req.contents !== void 0 ? { contents: req.contents } : {},
7111
7120
  ...req.orphan ? { orphan: true } : {},
7112
7121
  ...req.truncate ? { truncate: true } : {},
7113
- ...req.create ? { create: true } : {}
7122
+ ...req.create ? { create: true } : {},
7123
+ ...req.pin ? { pin: req.pin } : {}
7114
7124
  },
7115
7125
  this.nodes
7116
7126
  );
@@ -7242,7 +7252,8 @@ var WasmProcess = class {
7242
7252
  position: req.position ?? 0,
7243
7253
  ...req.contents !== void 0 ? { contents: req.contents } : {},
7244
7254
  ...req.orphan ? { orphan: true } : {},
7245
- ...req.dirty ? { dirty: true } : {}
7255
+ ...req.dirty ? { dirty: true } : {},
7256
+ ...req.pin ? { pin: req.pin } : {}
7246
7257
  },
7247
7258
  this.nodes
7248
7259
  );
@@ -10645,6 +10656,7 @@ async function createNodeKernel(options = {}) {
10645
10656
  ...transport ? { transport } : {},
10646
10657
  ...options.processMounts !== void 0 ? { processMounts: options.processMounts } : {},
10647
10658
  ...options.fstabRetries ? { fstabRetries: options.fstabRetries } : {},
10659
+ ...options.hostfs ? { hostfs: options.hostfs } : {},
10648
10660
  ...options.cdp ? { cdp: options.cdp } : {}
10649
10661
  });
10650
10662
  await launcher.prepare();