@qawolf/cli 1.7.3 → 1.7.5

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.
Files changed (2) hide show
  1. package/dist/cli.js +756 -624
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3285,7 +3285,7 @@ var require_atomic_sleep = __commonJS((exports, module) => {
3285
3285
 
3286
3286
  // node_modules/sonic-boom/index.js
3287
3287
  var require_sonic_boom = __commonJS((exports, module) => {
3288
- var fs2 = __require("fs");
3288
+ var fs3 = __require("fs");
3289
3289
  var EventEmitter = __require("events");
3290
3290
  var inherits = __require("util").inherits;
3291
3291
  var path2 = __require("path");
@@ -3343,21 +3343,21 @@ var require_sonic_boom = __commonJS((exports, module) => {
3343
3343
  if (sonic.sync) {
3344
3344
  try {
3345
3345
  if (sonic.mkdir)
3346
- fs2.mkdirSync(path2.dirname(file2), { recursive: true });
3347
- const fd = fs2.openSync(file2, flags, mode);
3346
+ fs3.mkdirSync(path2.dirname(file2), { recursive: true });
3347
+ const fd = fs3.openSync(file2, flags, mode);
3348
3348
  fileOpened(null, fd);
3349
3349
  } catch (err) {
3350
3350
  fileOpened(err);
3351
3351
  throw err;
3352
3352
  }
3353
3353
  } else if (sonic.mkdir) {
3354
- fs2.mkdir(path2.dirname(file2), { recursive: true }, (err) => {
3354
+ fs3.mkdir(path2.dirname(file2), { recursive: true }, (err) => {
3355
3355
  if (err)
3356
3356
  return fileOpened(err);
3357
- fs2.open(file2, flags, mode, fileOpened);
3357
+ fs3.open(file2, flags, mode, fileOpened);
3358
3358
  });
3359
3359
  } else {
3360
- fs2.open(file2, flags, mode, fileOpened);
3360
+ fs3.open(file2, flags, mode, fileOpened);
3361
3361
  }
3362
3362
  }
3363
3363
  function SonicBoom(opts) {
@@ -3398,8 +3398,8 @@ var require_sonic_boom = __commonJS((exports, module) => {
3398
3398
  this.flush = flushBuffer;
3399
3399
  this.flushSync = flushBufferSync;
3400
3400
  this._actualWrite = actualWriteBuffer;
3401
- fsWriteSync = () => fs2.writeSync(this.fd, this._writingBuf);
3402
- fsWrite = () => fs2.write(this.fd, this._writingBuf, this.release);
3401
+ fsWriteSync = () => fs3.writeSync(this.fd, this._writingBuf);
3402
+ fsWrite = () => fs3.write(this.fd, this._writingBuf, this.release);
3403
3403
  } else if (contentMode === undefined || contentMode === kContentModeUtf8) {
3404
3404
  this._writingBuf = "";
3405
3405
  this.write = write;
@@ -3408,15 +3408,15 @@ var require_sonic_boom = __commonJS((exports, module) => {
3408
3408
  this._actualWrite = actualWrite;
3409
3409
  fsWriteSync = () => {
3410
3410
  if (Buffer.isBuffer(this._writingBuf)) {
3411
- return fs2.writeSync(this.fd, this._writingBuf);
3411
+ return fs3.writeSync(this.fd, this._writingBuf);
3412
3412
  }
3413
- return fs2.writeSync(this.fd, this._writingBuf, "utf8");
3413
+ return fs3.writeSync(this.fd, this._writingBuf, "utf8");
3414
3414
  };
3415
3415
  fsWrite = () => {
3416
3416
  if (Buffer.isBuffer(this._writingBuf)) {
3417
- return fs2.write(this.fd, this._writingBuf, this.release);
3417
+ return fs3.write(this.fd, this._writingBuf, this.release);
3418
3418
  }
3419
- return fs2.write(this.fd, this._writingBuf, "utf8", this.release);
3419
+ return fs3.write(this.fd, this._writingBuf, "utf8", this.release);
3420
3420
  };
3421
3421
  } else {
3422
3422
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -3473,7 +3473,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3473
3473
  }
3474
3474
  }
3475
3475
  if (this._fsync) {
3476
- fs2.fsyncSync(this.fd);
3476
+ fs3.fsyncSync(this.fd);
3477
3477
  }
3478
3478
  const len = this._len;
3479
3479
  if (this._reopening) {
@@ -3588,7 +3588,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3588
3588
  const onDrain = () => {
3589
3589
  if (!this._fsync) {
3590
3590
  try {
3591
- fs2.fsync(this.fd, (err) => {
3591
+ fs3.fsync(this.fd, (err) => {
3592
3592
  this._flushPending = false;
3593
3593
  cb(err);
3594
3594
  });
@@ -3690,7 +3690,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3690
3690
  const fd = this.fd;
3691
3691
  this.once("ready", () => {
3692
3692
  if (fd !== this.fd) {
3693
- fs2.close(fd, (err) => {
3693
+ fs3.close(fd, (err) => {
3694
3694
  if (err) {
3695
3695
  return this.emit("error", err);
3696
3696
  }
@@ -3739,7 +3739,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3739
3739
  buf = this._bufs[0];
3740
3740
  }
3741
3741
  try {
3742
- const n = Buffer.isBuffer(buf) ? fs2.writeSync(this.fd, buf) : fs2.writeSync(this.fd, buf, "utf8");
3742
+ const n = Buffer.isBuffer(buf) ? fs3.writeSync(this.fd, buf) : fs3.writeSync(this.fd, buf, "utf8");
3743
3743
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
3744
3744
  buf = releasedBufObj.writingBuf;
3745
3745
  this._len = releasedBufObj.len;
@@ -3755,7 +3755,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3755
3755
  }
3756
3756
  }
3757
3757
  try {
3758
- fs2.fsyncSync(this.fd);
3758
+ fs3.fsyncSync(this.fd);
3759
3759
  } catch {}
3760
3760
  }
3761
3761
  function flushBufferSync() {
@@ -3775,7 +3775,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3775
3775
  buf = mergeBuf(this._bufs[0], this._lens[0]);
3776
3776
  }
3777
3777
  try {
3778
- const n = fs2.writeSync(this.fd, buf);
3778
+ const n = fs3.writeSync(this.fd, buf);
3779
3779
  buf = buf.subarray(n);
3780
3780
  this._len = Math.max(this._len - n, 0);
3781
3781
  if (buf.length <= 0) {
@@ -3803,13 +3803,13 @@ var require_sonic_boom = __commonJS((exports, module) => {
3803
3803
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
3804
3804
  if (this.sync) {
3805
3805
  try {
3806
- const written = Buffer.isBuffer(this._writingBuf) ? fs2.writeSync(this.fd, this._writingBuf) : fs2.writeSync(this.fd, this._writingBuf, "utf8");
3806
+ const written = Buffer.isBuffer(this._writingBuf) ? fs3.writeSync(this.fd, this._writingBuf) : fs3.writeSync(this.fd, this._writingBuf, "utf8");
3807
3807
  release(null, written);
3808
3808
  } catch (err) {
3809
3809
  release(err);
3810
3810
  }
3811
3811
  } else {
3812
- fs2.write(this.fd, this._writingBuf, release);
3812
+ fs3.write(this.fd, this._writingBuf, release);
3813
3813
  }
3814
3814
  }
3815
3815
  function actualWriteBuffer() {
@@ -3818,7 +3818,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3818
3818
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
3819
3819
  if (this.sync) {
3820
3820
  try {
3821
- const written = fs2.writeSync(this.fd, this._writingBuf);
3821
+ const written = fs3.writeSync(this.fd, this._writingBuf);
3822
3822
  release(null, written);
3823
3823
  } catch (err) {
3824
3824
  release(err);
@@ -3827,7 +3827,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
3827
3827
  if (kCopyBuffer) {
3828
3828
  this._writingBuf = Buffer.from(this._writingBuf);
3829
3829
  }
3830
- fs2.write(this.fd, this._writingBuf, release);
3830
+ fs3.write(this.fd, this._writingBuf, release);
3831
3831
  }
3832
3832
  }
3833
3833
  function actualClose(sonic) {
@@ -3843,11 +3843,11 @@ var require_sonic_boom = __commonJS((exports, module) => {
3843
3843
  sonic._lens = [];
3844
3844
  assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
3845
3845
  try {
3846
- fs2.fsync(sonic.fd, closeWrapped);
3846
+ fs3.fsync(sonic.fd, closeWrapped);
3847
3847
  } catch {}
3848
3848
  function closeWrapped() {
3849
3849
  if (sonic.fd !== 1 && sonic.fd !== 2) {
3850
- fs2.close(sonic.fd, done);
3850
+ fs3.close(sonic.fd, done);
3851
3851
  } else {
3852
3852
  done();
3853
3853
  }
@@ -17258,14 +17258,14 @@ var require_load = __commonJS((exports, module) => {
17258
17258
  zipEntries.load(data2);
17259
17259
  return zipEntries;
17260
17260
  }).then(function checkCRC32(zipEntries) {
17261
- var promises2 = [external2.Promise.resolve(zipEntries)];
17261
+ var promises3 = [external2.Promise.resolve(zipEntries)];
17262
17262
  var files = zipEntries.files;
17263
17263
  if (options.checkCRC32) {
17264
17264
  for (var i2 = 0;i2 < files.length; i2++) {
17265
- promises2.push(checkEntryCRC32(files[i2]));
17265
+ promises3.push(checkEntryCRC32(files[i2]));
17266
17266
  }
17267
17267
  }
17268
- return external2.Promise.all(promises2);
17268
+ return external2.Promise.all(promises3);
17269
17269
  }).then(function addFiles(results) {
17270
17270
  var zipEntries = results.shift();
17271
17271
  var files = zipEntries.files;
@@ -18963,7 +18963,7 @@ var init_strip_ansi = __esm(() => {
18963
18963
  });
18964
18964
 
18965
18965
  // node_modules/@wdio/logger/build/index.js
18966
- import fs3 from "node:fs";
18966
+ import fs4 from "node:fs";
18967
18967
  import util from "node:util";
18968
18968
  function getLogger(name) {
18969
18969
  if (loggers[name]) {
@@ -19042,7 +19042,7 @@ var import_safe_regex2, import_loglevel, import_loglevel_plugin_prefix, SENSITIV
19042
19042
  const rawMethod = originalFactory(methodName, logLevel, loggerName);
19043
19043
  return (...args) => {
19044
19044
  if (!logFile && process.env.WDIO_LOG_PATH) {
19045
- logFile = fs3.createWriteStream(process.env.WDIO_LOG_PATH);
19045
+ logFile = fs4.createWriteStream(process.env.WDIO_LOG_PATH);
19046
19046
  }
19047
19047
  const match = Object.values(matches).filter((x) => args[0].endsWith(`: ${x}`))[0];
19048
19048
  if (match) {
@@ -20043,13 +20043,13 @@ var require_minimatch = __commonJS((exports, module) => {
20043
20043
  // node_modules/readdir-glob/index.js
20044
20044
  var require_readdir_glob = __commonJS((exports, module) => {
20045
20045
  module.exports = readdirGlob;
20046
- var fs4 = __require("fs");
20046
+ var fs5 = __require("fs");
20047
20047
  var { EventEmitter } = __require("events");
20048
20048
  var { Minimatch } = require_minimatch();
20049
20049
  var { resolve: resolve10 } = __require("path");
20050
20050
  function readdir3(dir, strict) {
20051
20051
  return new Promise((resolve11, reject) => {
20052
- fs4.readdir(dir, { withFileTypes: true }, (err, files) => {
20052
+ fs5.readdir(dir, { withFileTypes: true }, (err, files) => {
20053
20053
  if (err) {
20054
20054
  switch (err.code) {
20055
20055
  case "ENOTDIR":
@@ -20078,7 +20078,7 @@ var require_readdir_glob = __commonJS((exports, module) => {
20078
20078
  }
20079
20079
  function stat2(file2, followSymlinks) {
20080
20080
  return new Promise((resolve11, reject) => {
20081
- const statFunc = followSymlinks ? fs4.stat : fs4.lstat;
20081
+ const statFunc = followSymlinks ? fs5.stat : fs5.lstat;
20082
20082
  statFunc(file2, (err, stats) => {
20083
20083
  if (err) {
20084
20084
  switch (err.code) {
@@ -22202,54 +22202,54 @@ var require_polyfills = __commonJS((exports, module) => {
22202
22202
  }
22203
22203
  var chdir;
22204
22204
  module.exports = patch;
22205
- function patch(fs4) {
22205
+ function patch(fs5) {
22206
22206
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
22207
- patchLchmod(fs4);
22208
- }
22209
- if (!fs4.lutimes) {
22210
- patchLutimes(fs4);
22211
- }
22212
- fs4.chown = chownFix(fs4.chown);
22213
- fs4.fchown = chownFix(fs4.fchown);
22214
- fs4.lchown = chownFix(fs4.lchown);
22215
- fs4.chmod = chmodFix(fs4.chmod);
22216
- fs4.fchmod = chmodFix(fs4.fchmod);
22217
- fs4.lchmod = chmodFix(fs4.lchmod);
22218
- fs4.chownSync = chownFixSync(fs4.chownSync);
22219
- fs4.fchownSync = chownFixSync(fs4.fchownSync);
22220
- fs4.lchownSync = chownFixSync(fs4.lchownSync);
22221
- fs4.chmodSync = chmodFixSync(fs4.chmodSync);
22222
- fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
22223
- fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
22224
- fs4.stat = statFix(fs4.stat);
22225
- fs4.fstat = statFix(fs4.fstat);
22226
- fs4.lstat = statFix(fs4.lstat);
22227
- fs4.statSync = statFixSync(fs4.statSync);
22228
- fs4.fstatSync = statFixSync(fs4.fstatSync);
22229
- fs4.lstatSync = statFixSync(fs4.lstatSync);
22230
- if (fs4.chmod && !fs4.lchmod) {
22231
- fs4.lchmod = function(path3, mode, cb) {
22207
+ patchLchmod(fs5);
22208
+ }
22209
+ if (!fs5.lutimes) {
22210
+ patchLutimes(fs5);
22211
+ }
22212
+ fs5.chown = chownFix(fs5.chown);
22213
+ fs5.fchown = chownFix(fs5.fchown);
22214
+ fs5.lchown = chownFix(fs5.lchown);
22215
+ fs5.chmod = chmodFix(fs5.chmod);
22216
+ fs5.fchmod = chmodFix(fs5.fchmod);
22217
+ fs5.lchmod = chmodFix(fs5.lchmod);
22218
+ fs5.chownSync = chownFixSync(fs5.chownSync);
22219
+ fs5.fchownSync = chownFixSync(fs5.fchownSync);
22220
+ fs5.lchownSync = chownFixSync(fs5.lchownSync);
22221
+ fs5.chmodSync = chmodFixSync(fs5.chmodSync);
22222
+ fs5.fchmodSync = chmodFixSync(fs5.fchmodSync);
22223
+ fs5.lchmodSync = chmodFixSync(fs5.lchmodSync);
22224
+ fs5.stat = statFix(fs5.stat);
22225
+ fs5.fstat = statFix(fs5.fstat);
22226
+ fs5.lstat = statFix(fs5.lstat);
22227
+ fs5.statSync = statFixSync(fs5.statSync);
22228
+ fs5.fstatSync = statFixSync(fs5.fstatSync);
22229
+ fs5.lstatSync = statFixSync(fs5.lstatSync);
22230
+ if (fs5.chmod && !fs5.lchmod) {
22231
+ fs5.lchmod = function(path3, mode, cb) {
22232
22232
  if (cb)
22233
22233
  process.nextTick(cb);
22234
22234
  };
22235
- fs4.lchmodSync = function() {};
22235
+ fs5.lchmodSync = function() {};
22236
22236
  }
22237
- if (fs4.chown && !fs4.lchown) {
22238
- fs4.lchown = function(path3, uid, gid, cb) {
22237
+ if (fs5.chown && !fs5.lchown) {
22238
+ fs5.lchown = function(path3, uid, gid, cb) {
22239
22239
  if (cb)
22240
22240
  process.nextTick(cb);
22241
22241
  };
22242
- fs4.lchownSync = function() {};
22242
+ fs5.lchownSync = function() {};
22243
22243
  }
22244
22244
  if (platform === "win32") {
22245
- fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
22245
+ fs5.rename = typeof fs5.rename !== "function" ? fs5.rename : function(fs$rename) {
22246
22246
  function rename(from, to2, cb) {
22247
22247
  var start = Date.now();
22248
22248
  var backoff = 0;
22249
22249
  fs$rename(from, to2, function CB(er2) {
22250
22250
  if (er2 && (er2.code === "EACCES" || er2.code === "EPERM" || er2.code === "EBUSY") && Date.now() - start < 60000) {
22251
22251
  setTimeout(function() {
22252
- fs4.stat(to2, function(stater, st2) {
22252
+ fs5.stat(to2, function(stater, st2) {
22253
22253
  if (stater && stater.code === "ENOENT")
22254
22254
  fs$rename(from, to2, CB);
22255
22255
  else
@@ -22267,9 +22267,9 @@ var require_polyfills = __commonJS((exports, module) => {
22267
22267
  if (Object.setPrototypeOf)
22268
22268
  Object.setPrototypeOf(rename, fs$rename);
22269
22269
  return rename;
22270
- }(fs4.rename);
22270
+ }(fs5.rename);
22271
22271
  }
22272
- fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
22272
+ fs5.read = typeof fs5.read !== "function" ? fs5.read : function(fs$read) {
22273
22273
  function read(fd, buffer, offset, length, position, callback_) {
22274
22274
  var callback2;
22275
22275
  if (callback_ && typeof callback_ === "function") {
@@ -22277,23 +22277,23 @@ var require_polyfills = __commonJS((exports, module) => {
22277
22277
  callback2 = function(er2, _4, __) {
22278
22278
  if (er2 && er2.code === "EAGAIN" && eagCounter < 10) {
22279
22279
  eagCounter++;
22280
- return fs$read.call(fs4, fd, buffer, offset, length, position, callback2);
22280
+ return fs$read.call(fs5, fd, buffer, offset, length, position, callback2);
22281
22281
  }
22282
22282
  callback_.apply(this, arguments);
22283
22283
  };
22284
22284
  }
22285
- return fs$read.call(fs4, fd, buffer, offset, length, position, callback2);
22285
+ return fs$read.call(fs5, fd, buffer, offset, length, position, callback2);
22286
22286
  }
22287
22287
  if (Object.setPrototypeOf)
22288
22288
  Object.setPrototypeOf(read, fs$read);
22289
22289
  return read;
22290
- }(fs4.read);
22291
- fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : function(fs$readSync) {
22290
+ }(fs5.read);
22291
+ fs5.readSync = typeof fs5.readSync !== "function" ? fs5.readSync : function(fs$readSync) {
22292
22292
  return function(fd, buffer, offset, length, position) {
22293
22293
  var eagCounter = 0;
22294
22294
  while (true) {
22295
22295
  try {
22296
- return fs$readSync.call(fs4, fd, buffer, offset, length, position);
22296
+ return fs$readSync.call(fs5, fd, buffer, offset, length, position);
22297
22297
  } catch (er2) {
22298
22298
  if (er2.code === "EAGAIN" && eagCounter < 10) {
22299
22299
  eagCounter++;
@@ -22303,90 +22303,90 @@ var require_polyfills = __commonJS((exports, module) => {
22303
22303
  }
22304
22304
  }
22305
22305
  };
22306
- }(fs4.readSync);
22307
- function patchLchmod(fs5) {
22308
- fs5.lchmod = function(path3, mode, callback2) {
22309
- fs5.open(path3, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
22306
+ }(fs5.readSync);
22307
+ function patchLchmod(fs6) {
22308
+ fs6.lchmod = function(path3, mode, callback2) {
22309
+ fs6.open(path3, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
22310
22310
  if (err) {
22311
22311
  if (callback2)
22312
22312
  callback2(err);
22313
22313
  return;
22314
22314
  }
22315
- fs5.fchmod(fd, mode, function(err2) {
22316
- fs5.close(fd, function(err22) {
22315
+ fs6.fchmod(fd, mode, function(err2) {
22316
+ fs6.close(fd, function(err22) {
22317
22317
  if (callback2)
22318
22318
  callback2(err2 || err22);
22319
22319
  });
22320
22320
  });
22321
22321
  });
22322
22322
  };
22323
- fs5.lchmodSync = function(path3, mode) {
22324
- var fd = fs5.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
22323
+ fs6.lchmodSync = function(path3, mode) {
22324
+ var fd = fs6.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
22325
22325
  var threw = true;
22326
22326
  var ret;
22327
22327
  try {
22328
- ret = fs5.fchmodSync(fd, mode);
22328
+ ret = fs6.fchmodSync(fd, mode);
22329
22329
  threw = false;
22330
22330
  } finally {
22331
22331
  if (threw) {
22332
22332
  try {
22333
- fs5.closeSync(fd);
22333
+ fs6.closeSync(fd);
22334
22334
  } catch (er2) {}
22335
22335
  } else {
22336
- fs5.closeSync(fd);
22336
+ fs6.closeSync(fd);
22337
22337
  }
22338
22338
  }
22339
22339
  return ret;
22340
22340
  };
22341
22341
  }
22342
- function patchLutimes(fs5) {
22343
- if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
22344
- fs5.lutimes = function(path3, at2, mt2, cb) {
22345
- fs5.open(path3, constants.O_SYMLINK, function(er2, fd) {
22342
+ function patchLutimes(fs6) {
22343
+ if (constants.hasOwnProperty("O_SYMLINK") && fs6.futimes) {
22344
+ fs6.lutimes = function(path3, at2, mt2, cb) {
22345
+ fs6.open(path3, constants.O_SYMLINK, function(er2, fd) {
22346
22346
  if (er2) {
22347
22347
  if (cb)
22348
22348
  cb(er2);
22349
22349
  return;
22350
22350
  }
22351
- fs5.futimes(fd, at2, mt2, function(er3) {
22352
- fs5.close(fd, function(er22) {
22351
+ fs6.futimes(fd, at2, mt2, function(er3) {
22352
+ fs6.close(fd, function(er22) {
22353
22353
  if (cb)
22354
22354
  cb(er3 || er22);
22355
22355
  });
22356
22356
  });
22357
22357
  });
22358
22358
  };
22359
- fs5.lutimesSync = function(path3, at2, mt2) {
22360
- var fd = fs5.openSync(path3, constants.O_SYMLINK);
22359
+ fs6.lutimesSync = function(path3, at2, mt2) {
22360
+ var fd = fs6.openSync(path3, constants.O_SYMLINK);
22361
22361
  var ret;
22362
22362
  var threw = true;
22363
22363
  try {
22364
- ret = fs5.futimesSync(fd, at2, mt2);
22364
+ ret = fs6.futimesSync(fd, at2, mt2);
22365
22365
  threw = false;
22366
22366
  } finally {
22367
22367
  if (threw) {
22368
22368
  try {
22369
- fs5.closeSync(fd);
22369
+ fs6.closeSync(fd);
22370
22370
  } catch (er2) {}
22371
22371
  } else {
22372
- fs5.closeSync(fd);
22372
+ fs6.closeSync(fd);
22373
22373
  }
22374
22374
  }
22375
22375
  return ret;
22376
22376
  };
22377
- } else if (fs5.futimes) {
22378
- fs5.lutimes = function(_a3, _b, _c, cb) {
22377
+ } else if (fs6.futimes) {
22378
+ fs6.lutimes = function(_a3, _b, _c, cb) {
22379
22379
  if (cb)
22380
22380
  process.nextTick(cb);
22381
22381
  };
22382
- fs5.lutimesSync = function() {};
22382
+ fs6.lutimesSync = function() {};
22383
22383
  }
22384
22384
  }
22385
22385
  function chmodFix(orig) {
22386
22386
  if (!orig)
22387
22387
  return orig;
22388
22388
  return function(target, mode, cb) {
22389
- return orig.call(fs4, target, mode, function(er2) {
22389
+ return orig.call(fs5, target, mode, function(er2) {
22390
22390
  if (chownErOk(er2))
22391
22391
  er2 = null;
22392
22392
  if (cb)
@@ -22399,7 +22399,7 @@ var require_polyfills = __commonJS((exports, module) => {
22399
22399
  return orig;
22400
22400
  return function(target, mode) {
22401
22401
  try {
22402
- return orig.call(fs4, target, mode);
22402
+ return orig.call(fs5, target, mode);
22403
22403
  } catch (er2) {
22404
22404
  if (!chownErOk(er2))
22405
22405
  throw er2;
@@ -22410,7 +22410,7 @@ var require_polyfills = __commonJS((exports, module) => {
22410
22410
  if (!orig)
22411
22411
  return orig;
22412
22412
  return function(target, uid, gid, cb) {
22413
- return orig.call(fs4, target, uid, gid, function(er2) {
22413
+ return orig.call(fs5, target, uid, gid, function(er2) {
22414
22414
  if (chownErOk(er2))
22415
22415
  er2 = null;
22416
22416
  if (cb)
@@ -22423,7 +22423,7 @@ var require_polyfills = __commonJS((exports, module) => {
22423
22423
  return orig;
22424
22424
  return function(target, uid, gid) {
22425
22425
  try {
22426
- return orig.call(fs4, target, uid, gid);
22426
+ return orig.call(fs5, target, uid, gid);
22427
22427
  } catch (er2) {
22428
22428
  if (!chownErOk(er2))
22429
22429
  throw er2;
@@ -22448,14 +22448,14 @@ var require_polyfills = __commonJS((exports, module) => {
22448
22448
  if (cb)
22449
22449
  cb.apply(this, arguments);
22450
22450
  }
22451
- return options ? orig.call(fs4, target, options, callback2) : orig.call(fs4, target, callback2);
22451
+ return options ? orig.call(fs5, target, options, callback2) : orig.call(fs5, target, callback2);
22452
22452
  };
22453
22453
  }
22454
22454
  function statFixSync(orig) {
22455
22455
  if (!orig)
22456
22456
  return orig;
22457
22457
  return function(target, options) {
22458
- var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
22458
+ var stats = options ? orig.call(fs5, target, options) : orig.call(fs5, target);
22459
22459
  if (stats) {
22460
22460
  if (stats.uid < 0)
22461
22461
  stats.uid += 4294967296;
@@ -22484,7 +22484,7 @@ var require_polyfills = __commonJS((exports, module) => {
22484
22484
  var require_legacy_streams = __commonJS((exports, module) => {
22485
22485
  var Stream = __require("stream").Stream;
22486
22486
  module.exports = legacy;
22487
- function legacy(fs4) {
22487
+ function legacy(fs5) {
22488
22488
  return {
22489
22489
  ReadStream: ReadStream2,
22490
22490
  WriteStream
@@ -22529,7 +22529,7 @@ var require_legacy_streams = __commonJS((exports, module) => {
22529
22529
  });
22530
22530
  return;
22531
22531
  }
22532
- fs4.open(this.path, this.flags, this.mode, function(err, fd) {
22532
+ fs5.open(this.path, this.flags, this.mode, function(err, fd) {
22533
22533
  if (err) {
22534
22534
  self2.emit("error", err);
22535
22535
  self2.readable = false;
@@ -22569,7 +22569,7 @@ var require_legacy_streams = __commonJS((exports, module) => {
22569
22569
  this.busy = false;
22570
22570
  this._queue = [];
22571
22571
  if (this.fd === null) {
22572
- this._open = fs4.open;
22572
+ this._open = fs5.open;
22573
22573
  this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
22574
22574
  this.flush();
22575
22575
  }
@@ -22599,7 +22599,7 @@ var require_clone = __commonJS((exports, module) => {
22599
22599
 
22600
22600
  // node_modules/graceful-fs/graceful-fs.js
22601
22601
  var require_graceful_fs = __commonJS((exports, module) => {
22602
- var fs4 = __require("fs");
22602
+ var fs5 = __require("fs");
22603
22603
  var polyfills = require_polyfills();
22604
22604
  var legacy = require_legacy_streams();
22605
22605
  var clone2 = require_clone();
@@ -22631,12 +22631,12 @@ var require_graceful_fs = __commonJS((exports, module) => {
22631
22631
  GFS4: `);
22632
22632
  console.error(m4);
22633
22633
  };
22634
- if (!fs4[gracefulQueue]) {
22634
+ if (!fs5[gracefulQueue]) {
22635
22635
  queue = global[gracefulQueue] || [];
22636
- publishQueue(fs4, queue);
22637
- fs4.close = function(fs$close) {
22636
+ publishQueue(fs5, queue);
22637
+ fs5.close = function(fs$close) {
22638
22638
  function close(fd, cb) {
22639
- return fs$close.call(fs4, fd, function(err) {
22639
+ return fs$close.call(fs5, fd, function(err) {
22640
22640
  if (!err) {
22641
22641
  resetQueue();
22642
22642
  }
@@ -22648,40 +22648,40 @@ GFS4: `);
22648
22648
  value: fs$close
22649
22649
  });
22650
22650
  return close;
22651
- }(fs4.close);
22652
- fs4.closeSync = function(fs$closeSync) {
22651
+ }(fs5.close);
22652
+ fs5.closeSync = function(fs$closeSync) {
22653
22653
  function closeSync(fd) {
22654
- fs$closeSync.apply(fs4, arguments);
22654
+ fs$closeSync.apply(fs5, arguments);
22655
22655
  resetQueue();
22656
22656
  }
22657
22657
  Object.defineProperty(closeSync, previousSymbol, {
22658
22658
  value: fs$closeSync
22659
22659
  });
22660
22660
  return closeSync;
22661
- }(fs4.closeSync);
22661
+ }(fs5.closeSync);
22662
22662
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
22663
22663
  process.on("exit", function() {
22664
- debug(fs4[gracefulQueue]);
22665
- __require("assert").equal(fs4[gracefulQueue].length, 0);
22664
+ debug(fs5[gracefulQueue]);
22665
+ __require("assert").equal(fs5[gracefulQueue].length, 0);
22666
22666
  });
22667
22667
  }
22668
22668
  }
22669
22669
  var queue;
22670
22670
  if (!global[gracefulQueue]) {
22671
- publishQueue(global, fs4[gracefulQueue]);
22672
- }
22673
- module.exports = patch(clone2(fs4));
22674
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
22675
- module.exports = patch(fs4);
22676
- fs4.__patched = true;
22677
- }
22678
- function patch(fs5) {
22679
- polyfills(fs5);
22680
- fs5.gracefulify = patch;
22681
- fs5.createReadStream = createReadStream2;
22682
- fs5.createWriteStream = createWriteStream;
22683
- var fs$readFile = fs5.readFile;
22684
- fs5.readFile = readFile;
22671
+ publishQueue(global, fs5[gracefulQueue]);
22672
+ }
22673
+ module.exports = patch(clone2(fs5));
22674
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs5.__patched) {
22675
+ module.exports = patch(fs5);
22676
+ fs5.__patched = true;
22677
+ }
22678
+ function patch(fs6) {
22679
+ polyfills(fs6);
22680
+ fs6.gracefulify = patch;
22681
+ fs6.createReadStream = createReadStream2;
22682
+ fs6.createWriteStream = createWriteStream;
22683
+ var fs$readFile = fs6.readFile;
22684
+ fs6.readFile = readFile;
22685
22685
  function readFile(path3, options, cb) {
22686
22686
  if (typeof options === "function")
22687
22687
  cb = options, options = null;
@@ -22697,8 +22697,8 @@ GFS4: `);
22697
22697
  });
22698
22698
  }
22699
22699
  }
22700
- var fs$writeFile = fs5.writeFile;
22701
- fs5.writeFile = writeFile;
22700
+ var fs$writeFile = fs6.writeFile;
22701
+ fs6.writeFile = writeFile;
22702
22702
  function writeFile(path3, data, options, cb) {
22703
22703
  if (typeof options === "function")
22704
22704
  cb = options, options = null;
@@ -22714,9 +22714,9 @@ GFS4: `);
22714
22714
  });
22715
22715
  }
22716
22716
  }
22717
- var fs$appendFile = fs5.appendFile;
22717
+ var fs$appendFile = fs6.appendFile;
22718
22718
  if (fs$appendFile)
22719
- fs5.appendFile = appendFile;
22719
+ fs6.appendFile = appendFile;
22720
22720
  function appendFile(path3, data, options, cb) {
22721
22721
  if (typeof options === "function")
22722
22722
  cb = options, options = null;
@@ -22732,9 +22732,9 @@ GFS4: `);
22732
22732
  });
22733
22733
  }
22734
22734
  }
22735
- var fs$copyFile = fs5.copyFile;
22735
+ var fs$copyFile = fs6.copyFile;
22736
22736
  if (fs$copyFile)
22737
- fs5.copyFile = copyFile;
22737
+ fs6.copyFile = copyFile;
22738
22738
  function copyFile(src, dest, flags, cb) {
22739
22739
  if (typeof flags === "function") {
22740
22740
  cb = flags;
@@ -22752,8 +22752,8 @@ GFS4: `);
22752
22752
  });
22753
22753
  }
22754
22754
  }
22755
- var fs$readdir = fs5.readdir;
22756
- fs5.readdir = readdir3;
22755
+ var fs$readdir = fs6.readdir;
22756
+ fs6.readdir = readdir3;
22757
22757
  var noReaddirOptionVersions = /^v[0-5]\./;
22758
22758
  function readdir3(path3, options, cb) {
22759
22759
  if (typeof options === "function")
@@ -22784,21 +22784,21 @@ GFS4: `);
22784
22784
  }
22785
22785
  }
22786
22786
  if (process.version.substr(0, 4) === "v0.8") {
22787
- var legStreams = legacy(fs5);
22787
+ var legStreams = legacy(fs6);
22788
22788
  ReadStream2 = legStreams.ReadStream;
22789
22789
  WriteStream = legStreams.WriteStream;
22790
22790
  }
22791
- var fs$ReadStream = fs5.ReadStream;
22791
+ var fs$ReadStream = fs6.ReadStream;
22792
22792
  if (fs$ReadStream) {
22793
22793
  ReadStream2.prototype = Object.create(fs$ReadStream.prototype);
22794
22794
  ReadStream2.prototype.open = ReadStream$open;
22795
22795
  }
22796
- var fs$WriteStream = fs5.WriteStream;
22796
+ var fs$WriteStream = fs6.WriteStream;
22797
22797
  if (fs$WriteStream) {
22798
22798
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
22799
22799
  WriteStream.prototype.open = WriteStream$open;
22800
22800
  }
22801
- Object.defineProperty(fs5, "ReadStream", {
22801
+ Object.defineProperty(fs6, "ReadStream", {
22802
22802
  get: function() {
22803
22803
  return ReadStream2;
22804
22804
  },
@@ -22808,7 +22808,7 @@ GFS4: `);
22808
22808
  enumerable: true,
22809
22809
  configurable: true
22810
22810
  });
22811
- Object.defineProperty(fs5, "WriteStream", {
22811
+ Object.defineProperty(fs6, "WriteStream", {
22812
22812
  get: function() {
22813
22813
  return WriteStream;
22814
22814
  },
@@ -22819,7 +22819,7 @@ GFS4: `);
22819
22819
  configurable: true
22820
22820
  });
22821
22821
  var FileReadStream = ReadStream2;
22822
- Object.defineProperty(fs5, "FileReadStream", {
22822
+ Object.defineProperty(fs6, "FileReadStream", {
22823
22823
  get: function() {
22824
22824
  return FileReadStream;
22825
22825
  },
@@ -22830,7 +22830,7 @@ GFS4: `);
22830
22830
  configurable: true
22831
22831
  });
22832
22832
  var FileWriteStream = WriteStream;
22833
- Object.defineProperty(fs5, "FileWriteStream", {
22833
+ Object.defineProperty(fs6, "FileWriteStream", {
22834
22834
  get: function() {
22835
22835
  return FileWriteStream;
22836
22836
  },
@@ -22879,13 +22879,13 @@ GFS4: `);
22879
22879
  });
22880
22880
  }
22881
22881
  function createReadStream2(path3, options) {
22882
- return new fs5.ReadStream(path3, options);
22882
+ return new fs6.ReadStream(path3, options);
22883
22883
  }
22884
22884
  function createWriteStream(path3, options) {
22885
- return new fs5.WriteStream(path3, options);
22885
+ return new fs6.WriteStream(path3, options);
22886
22886
  }
22887
- var fs$open = fs5.open;
22888
- fs5.open = open;
22887
+ var fs$open = fs6.open;
22888
+ fs6.open = open;
22889
22889
  function open(path3, flags, mode, cb) {
22890
22890
  if (typeof mode === "function")
22891
22891
  cb = mode, mode = null;
@@ -22901,20 +22901,20 @@ GFS4: `);
22901
22901
  });
22902
22902
  }
22903
22903
  }
22904
- return fs5;
22904
+ return fs6;
22905
22905
  }
22906
22906
  function enqueue(elem) {
22907
22907
  debug("ENQUEUE", elem[0].name, elem[1]);
22908
- fs4[gracefulQueue].push(elem);
22908
+ fs5[gracefulQueue].push(elem);
22909
22909
  retry();
22910
22910
  }
22911
22911
  var retryTimer;
22912
22912
  function resetQueue() {
22913
22913
  var now = Date.now();
22914
- for (var i2 = 0;i2 < fs4[gracefulQueue].length; ++i2) {
22915
- if (fs4[gracefulQueue][i2].length > 2) {
22916
- fs4[gracefulQueue][i2][3] = now;
22917
- fs4[gracefulQueue][i2][4] = now;
22914
+ for (var i2 = 0;i2 < fs5[gracefulQueue].length; ++i2) {
22915
+ if (fs5[gracefulQueue][i2].length > 2) {
22916
+ fs5[gracefulQueue][i2][3] = now;
22917
+ fs5[gracefulQueue][i2][4] = now;
22918
22918
  }
22919
22919
  }
22920
22920
  retry();
@@ -22922,9 +22922,9 @@ GFS4: `);
22922
22922
  function retry() {
22923
22923
  clearTimeout(retryTimer);
22924
22924
  retryTimer = undefined;
22925
- if (fs4[gracefulQueue].length === 0)
22925
+ if (fs5[gracefulQueue].length === 0)
22926
22926
  return;
22927
- var elem = fs4[gracefulQueue].shift();
22927
+ var elem = fs5[gracefulQueue].shift();
22928
22928
  var fn2 = elem[0];
22929
22929
  var args = elem[1];
22930
22930
  var err = elem[2];
@@ -22946,7 +22946,7 @@ GFS4: `);
22946
22946
  debug("RETRY", fn2.name, args);
22947
22947
  fn2.apply(null, args.concat([startTime]));
22948
22948
  } else {
22949
- fs4[gracefulQueue].push(elem);
22949
+ fs5[gracefulQueue].push(elem);
22950
22950
  }
22951
22951
  }
22952
22952
  if (retryTimer === undefined) {
@@ -31598,7 +31598,7 @@ var require_stream = __commonJS((exports, module) => {
31598
31598
  var { pipeline } = require_pipeline();
31599
31599
  var { destroyer } = require_destroy3();
31600
31600
  var eos = require_end_of_stream();
31601
- var promises2 = require_promises();
31601
+ var promises3 = require_promises();
31602
31602
  var utils = require_utils3();
31603
31603
  var Stream = module.exports = require_legacy().Stream;
31604
31604
  Stream.isDestroyed = utils.isDestroyed;
@@ -31672,21 +31672,21 @@ var require_stream = __commonJS((exports, module) => {
31672
31672
  configurable: true,
31673
31673
  enumerable: true,
31674
31674
  get() {
31675
- return promises2;
31675
+ return promises3;
31676
31676
  }
31677
31677
  });
31678
31678
  ObjectDefineProperty(pipeline, customPromisify, {
31679
31679
  __proto__: null,
31680
31680
  enumerable: true,
31681
31681
  get() {
31682
- return promises2.pipeline;
31682
+ return promises3.pipeline;
31683
31683
  }
31684
31684
  });
31685
31685
  ObjectDefineProperty(eos, customPromisify, {
31686
31686
  __proto__: null,
31687
31687
  enumerable: true,
31688
31688
  get() {
31689
- return promises2.finished;
31689
+ return promises3.finished;
31690
31690
  }
31691
31691
  });
31692
31692
  Stream.Stream = Stream;
@@ -31702,7 +31702,7 @@ var require_stream = __commonJS((exports, module) => {
31702
31702
  var require_ours = __commonJS((exports, module) => {
31703
31703
  var Stream = __require("stream");
31704
31704
  if (Stream && process.env.READABLE_STREAM === "disable") {
31705
- const promises2 = Stream.promises;
31705
+ const promises3 = Stream.promises;
31706
31706
  module.exports._uint8ArrayToBuffer = Stream._uint8ArrayToBuffer;
31707
31707
  module.exports._isUint8Array = Stream._isUint8Array;
31708
31708
  module.exports.isDisturbed = Stream.isDisturbed;
@@ -31722,13 +31722,13 @@ var require_ours = __commonJS((exports, module) => {
31722
31722
  configurable: true,
31723
31723
  enumerable: true,
31724
31724
  get() {
31725
- return promises2;
31725
+ return promises3;
31726
31726
  }
31727
31727
  });
31728
31728
  module.exports.Stream = Stream.Stream;
31729
31729
  } else {
31730
31730
  const CustomStream = require_stream();
31731
- const promises2 = require_promises();
31731
+ const promises3 = require_promises();
31732
31732
  const originalDestroy = CustomStream.Readable.destroy;
31733
31733
  module.exports = CustomStream.Readable;
31734
31734
  module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
@@ -31751,7 +31751,7 @@ var require_ours = __commonJS((exports, module) => {
31751
31751
  configurable: true,
31752
31752
  enumerable: true,
31753
31753
  get() {
31754
- return promises2;
31754
+ return promises3;
31755
31755
  }
31756
31756
  });
31757
31757
  module.exports.Stream = CustomStream.Stream;
@@ -36757,8 +36757,8 @@ var require_commonjs4 = __commonJS((exports) => {
36757
36757
  #children;
36758
36758
  nocase;
36759
36759
  #fs;
36760
- constructor(cwd = process.cwd(), pathImpl, sep5, { nocase, childrenCacheSize = 16 * 1024, fs: fs4 = defaultFS } = {}) {
36761
- this.#fs = fsFromOption(fs4);
36760
+ constructor(cwd = process.cwd(), pathImpl, sep5, { nocase, childrenCacheSize = 16 * 1024, fs: fs5 = defaultFS } = {}) {
36761
+ this.#fs = fsFromOption(fs5);
36762
36762
  if (cwd instanceof URL || cwd.startsWith("file://")) {
36763
36763
  cwd = (0, node_url_1.fileURLToPath)(cwd);
36764
36764
  }
@@ -37121,14 +37121,14 @@ var require_commonjs4 = __commonJS((exports) => {
37121
37121
  if (er2)
37122
37122
  return results.emit("error", er2);
37123
37123
  if (follow && !didRealpaths) {
37124
- const promises2 = [];
37124
+ const promises3 = [];
37125
37125
  for (const e of entries) {
37126
37126
  if (e.isSymbolicLink()) {
37127
- promises2.push(e.realpath().then((r2) => r2?.isUnknown() ? r2.lstat() : r2));
37127
+ promises3.push(e.realpath().then((r2) => r2?.isUnknown() ? r2.lstat() : r2));
37128
37128
  }
37129
37129
  }
37130
- if (promises2.length) {
37131
- Promise.all(promises2).then(() => onReaddir(null, entries, true));
37130
+ if (promises3.length) {
37131
+ Promise.all(promises3).then(() => onReaddir(null, entries, true));
37132
37132
  return;
37133
37133
  }
37134
37134
  }
@@ -37235,8 +37235,8 @@ var require_commonjs4 = __commonJS((exports) => {
37235
37235
  parseRootPath(dir) {
37236
37236
  return node_path_1.win32.parse(dir).root.toUpperCase();
37237
37237
  }
37238
- newRoot(fs4) {
37239
- return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs4 });
37238
+ newRoot(fs5) {
37239
+ return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
37240
37240
  }
37241
37241
  isAbsolute(p3) {
37242
37242
  return p3.startsWith("/") || p3.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p3);
@@ -37254,8 +37254,8 @@ var require_commonjs4 = __commonJS((exports) => {
37254
37254
  parseRootPath(_dir) {
37255
37255
  return "/";
37256
37256
  }
37257
- newRoot(fs4) {
37258
- return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs4 });
37257
+ newRoot(fs5) {
37258
+ return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs: fs5 });
37259
37259
  }
37260
37260
  isAbsolute(p3) {
37261
37261
  return p3.startsWith("/");
@@ -38341,7 +38341,7 @@ var require_commonjs5 = __commonJS((exports) => {
38341
38341
 
38342
38342
  // node_modules/archiver-utils/file.js
38343
38343
  var require_file = __commonJS((exports, module) => {
38344
- var fs4 = require_graceful_fs();
38344
+ var fs5 = require_graceful_fs();
38345
38345
  var path3 = __require("path");
38346
38346
  var flatten = require_flatten();
38347
38347
  var difference = require_difference();
@@ -38368,7 +38368,7 @@ var require_file = __commonJS((exports, module) => {
38368
38368
  };
38369
38369
  file2.exists = function() {
38370
38370
  var filepath = path3.join.apply(path3, arguments);
38371
- return fs4.existsSync(filepath);
38371
+ return fs5.existsSync(filepath);
38372
38372
  };
38373
38373
  file2.expand = function(...args) {
38374
38374
  var options = isPlainObject4(args[0]) ? args.shift() : {};
@@ -38386,7 +38386,7 @@ var require_file = __commonJS((exports, module) => {
38386
38386
  if (typeof options.filter === "function") {
38387
38387
  return options.filter(filepath);
38388
38388
  } else {
38389
- return fs4.statSync(filepath)[options.filter]();
38389
+ return fs5.statSync(filepath)[options.filter]();
38390
38390
  }
38391
38391
  } catch (e) {
38392
38392
  return false;
@@ -38492,7 +38492,7 @@ var require_file = __commonJS((exports, module) => {
38492
38492
 
38493
38493
  // node_modules/archiver-utils/index.js
38494
38494
  var require_archiver_utils = __commonJS((exports, module) => {
38495
- var fs4 = require_graceful_fs();
38495
+ var fs5 = require_graceful_fs();
38496
38496
  var path3 = __require("path");
38497
38497
  var isStream = require_is_stream();
38498
38498
  var lazystream = require_lazystream();
@@ -38541,7 +38541,7 @@ var require_archiver_utils = __commonJS((exports, module) => {
38541
38541
  };
38542
38542
  utils.lazyReadStream = function(filepath) {
38543
38543
  return new lazystream.Readable(function() {
38544
- return fs4.createReadStream(filepath);
38544
+ return fs5.createReadStream(filepath);
38545
38545
  });
38546
38546
  };
38547
38547
  utils.normalizeInputSource = function(source) {
@@ -38569,7 +38569,7 @@ var require_archiver_utils = __commonJS((exports, module) => {
38569
38569
  callback2 = base;
38570
38570
  base = dirpath;
38571
38571
  }
38572
- fs4.readdir(dirpath, function(err, list) {
38572
+ fs5.readdir(dirpath, function(err, list) {
38573
38573
  var i2 = 0;
38574
38574
  var file2;
38575
38575
  var filepath;
@@ -38582,7 +38582,7 @@ var require_archiver_utils = __commonJS((exports, module) => {
38582
38582
  return callback2(null, results);
38583
38583
  }
38584
38584
  filepath = path3.join(dirpath, file2);
38585
- fs4.stat(filepath, function(err2, stats) {
38585
+ fs5.stat(filepath, function(err2, stats) {
38586
38586
  results.push({
38587
38587
  path: filepath,
38588
38588
  relative: path3.relative(base, filepath).replace(/\\/g, "/"),
@@ -43829,7 +43829,7 @@ var require_stream2 = __commonJS((exports, module) => {
43829
43829
  var { pipeline } = require_pipeline2();
43830
43830
  var { destroyer } = require_destroy4();
43831
43831
  var eos = require_end_of_stream2();
43832
- var promises2 = require_promises2();
43832
+ var promises3 = require_promises2();
43833
43833
  var utils = require_utils4();
43834
43834
  var Stream = module.exports = require_legacy2().Stream;
43835
43835
  Stream.isDestroyed = utils.isDestroyed;
@@ -43903,21 +43903,21 @@ var require_stream2 = __commonJS((exports, module) => {
43903
43903
  configurable: true,
43904
43904
  enumerable: true,
43905
43905
  get() {
43906
- return promises2;
43906
+ return promises3;
43907
43907
  }
43908
43908
  });
43909
43909
  ObjectDefineProperty(pipeline, customPromisify, {
43910
43910
  __proto__: null,
43911
43911
  enumerable: true,
43912
43912
  get() {
43913
- return promises2.pipeline;
43913
+ return promises3.pipeline;
43914
43914
  }
43915
43915
  });
43916
43916
  ObjectDefineProperty(eos, customPromisify, {
43917
43917
  __proto__: null,
43918
43918
  enumerable: true,
43919
43919
  get() {
43920
- return promises2.finished;
43920
+ return promises3.finished;
43921
43921
  }
43922
43922
  });
43923
43923
  Stream.Stream = Stream;
@@ -43933,7 +43933,7 @@ var require_stream2 = __commonJS((exports, module) => {
43933
43933
  var require_ours2 = __commonJS((exports, module) => {
43934
43934
  var Stream = __require("stream");
43935
43935
  if (Stream && process.env.READABLE_STREAM === "disable") {
43936
- const promises2 = Stream.promises;
43936
+ const promises3 = Stream.promises;
43937
43937
  module.exports._uint8ArrayToBuffer = Stream._uint8ArrayToBuffer;
43938
43938
  module.exports._isUint8Array = Stream._isUint8Array;
43939
43939
  module.exports.isDisturbed = Stream.isDisturbed;
@@ -43953,13 +43953,13 @@ var require_ours2 = __commonJS((exports, module) => {
43953
43953
  configurable: true,
43954
43954
  enumerable: true,
43955
43955
  get() {
43956
- return promises2;
43956
+ return promises3;
43957
43957
  }
43958
43958
  });
43959
43959
  module.exports.Stream = Stream.Stream;
43960
43960
  } else {
43961
43961
  const CustomStream = require_stream2();
43962
- const promises2 = require_promises2();
43962
+ const promises3 = require_promises2();
43963
43963
  const originalDestroy = CustomStream.Readable.destroy;
43964
43964
  module.exports = CustomStream.Readable;
43965
43965
  module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
@@ -43982,7 +43982,7 @@ var require_ours2 = __commonJS((exports, module) => {
43982
43982
  configurable: true,
43983
43983
  enumerable: true,
43984
43984
  get() {
43985
- return promises2;
43985
+ return promises3;
43986
43986
  }
43987
43987
  });
43988
43988
  module.exports.Stream = CustomStream.Stream;
@@ -43992,7 +43992,7 @@ var require_ours2 = __commonJS((exports, module) => {
43992
43992
 
43993
43993
  // node_modules/archiver/lib/core.js
43994
43994
  var require_core = __commonJS((exports, module) => {
43995
- var fs4 = __require("fs");
43995
+ var fs5 = __require("fs");
43996
43996
  var glob2 = require_readdir_glob();
43997
43997
  var async = require_async();
43998
43998
  var path3 = __require("path");
@@ -44056,7 +44056,7 @@ var require_core = __commonJS((exports, module) => {
44056
44056
  data.sourcePath = filepath;
44057
44057
  task.data = data;
44058
44058
  this._entriesCount++;
44059
- if (data.stats && data.stats instanceof fs4.Stats) {
44059
+ if (data.stats && data.stats instanceof fs5.Stats) {
44060
44060
  task = this._updateQueueTaskWithStats(task, data.stats);
44061
44061
  if (task) {
44062
44062
  if (data.stats.size) {
@@ -44227,7 +44227,7 @@ var require_core = __commonJS((exports, module) => {
44227
44227
  callback2();
44228
44228
  return;
44229
44229
  }
44230
- fs4.lstat(task.filepath, function(err, stats) {
44230
+ fs5.lstat(task.filepath, function(err, stats) {
44231
44231
  if (this._state.aborted) {
44232
44232
  setImmediate(callback2);
44233
44233
  return;
@@ -44270,7 +44270,7 @@ var require_core = __commonJS((exports, module) => {
44270
44270
  task.data.sourceType = "buffer";
44271
44271
  task.source = Buffer.concat([]);
44272
44272
  } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
44273
- var linkPath = fs4.readlinkSync(task.filepath);
44273
+ var linkPath = fs5.readlinkSync(task.filepath);
44274
44274
  var dirName = path3.dirname(task.filepath);
44275
44275
  task.data.type = "symlink";
44276
44276
  task.data.linkname = path3.relative(dirName, path3.resolve(dirName, linkPath));
@@ -50092,7 +50092,7 @@ var require_stream3 = __commonJS((exports, module) => {
50092
50092
  var { pipeline } = require_pipeline3();
50093
50093
  var { destroyer } = require_destroy5();
50094
50094
  var eos = require_end_of_stream3();
50095
- var promises2 = require_promises3();
50095
+ var promises3 = require_promises3();
50096
50096
  var utils = require_utils5();
50097
50097
  var Stream = module.exports = require_legacy3().Stream;
50098
50098
  Stream.isDestroyed = utils.isDestroyed;
@@ -50166,21 +50166,21 @@ var require_stream3 = __commonJS((exports, module) => {
50166
50166
  configurable: true,
50167
50167
  enumerable: true,
50168
50168
  get() {
50169
- return promises2;
50169
+ return promises3;
50170
50170
  }
50171
50171
  });
50172
50172
  ObjectDefineProperty(pipeline, customPromisify, {
50173
50173
  __proto__: null,
50174
50174
  enumerable: true,
50175
50175
  get() {
50176
- return promises2.pipeline;
50176
+ return promises3.pipeline;
50177
50177
  }
50178
50178
  });
50179
50179
  ObjectDefineProperty(eos, customPromisify, {
50180
50180
  __proto__: null,
50181
50181
  enumerable: true,
50182
50182
  get() {
50183
- return promises2.finished;
50183
+ return promises3.finished;
50184
50184
  }
50185
50185
  });
50186
50186
  Stream.Stream = Stream;
@@ -50196,7 +50196,7 @@ var require_stream3 = __commonJS((exports, module) => {
50196
50196
  var require_ours3 = __commonJS((exports, module) => {
50197
50197
  var Stream = __require("stream");
50198
50198
  if (Stream && process.env.READABLE_STREAM === "disable") {
50199
- const promises2 = Stream.promises;
50199
+ const promises3 = Stream.promises;
50200
50200
  module.exports._uint8ArrayToBuffer = Stream._uint8ArrayToBuffer;
50201
50201
  module.exports._isUint8Array = Stream._isUint8Array;
50202
50202
  module.exports.isDisturbed = Stream.isDisturbed;
@@ -50216,13 +50216,13 @@ var require_ours3 = __commonJS((exports, module) => {
50216
50216
  configurable: true,
50217
50217
  enumerable: true,
50218
50218
  get() {
50219
- return promises2;
50219
+ return promises3;
50220
50220
  }
50221
50221
  });
50222
50222
  module.exports.Stream = Stream.Stream;
50223
50223
  } else {
50224
50224
  const CustomStream = require_stream3();
50225
- const promises2 = require_promises3();
50225
+ const promises3 = require_promises3();
50226
50226
  const originalDestroy = CustomStream.Readable.destroy;
50227
50227
  module.exports = CustomStream.Readable;
50228
50228
  module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
@@ -50245,7 +50245,7 @@ var require_ours3 = __commonJS((exports, module) => {
50245
50245
  configurable: true,
50246
50246
  enumerable: true,
50247
50247
  get() {
50248
- return promises2;
50248
+ return promises3;
50249
50249
  }
50250
50250
  });
50251
50251
  module.exports.Stream = CustomStream.Stream;
@@ -55649,7 +55649,7 @@ var require_stream4 = __commonJS((exports, module) => {
55649
55649
  var { pipeline } = require_pipeline4();
55650
55650
  var { destroyer } = require_destroy6();
55651
55651
  var eos = require_end_of_stream4();
55652
- var promises2 = require_promises4();
55652
+ var promises3 = require_promises4();
55653
55653
  var utils = require_utils6();
55654
55654
  var Stream = module.exports = require_legacy4().Stream;
55655
55655
  Stream.isDestroyed = utils.isDestroyed;
@@ -55723,21 +55723,21 @@ var require_stream4 = __commonJS((exports, module) => {
55723
55723
  configurable: true,
55724
55724
  enumerable: true,
55725
55725
  get() {
55726
- return promises2;
55726
+ return promises3;
55727
55727
  }
55728
55728
  });
55729
55729
  ObjectDefineProperty(pipeline, customPromisify, {
55730
55730
  __proto__: null,
55731
55731
  enumerable: true,
55732
55732
  get() {
55733
- return promises2.pipeline;
55733
+ return promises3.pipeline;
55734
55734
  }
55735
55735
  });
55736
55736
  ObjectDefineProperty(eos, customPromisify, {
55737
55737
  __proto__: null,
55738
55738
  enumerable: true,
55739
55739
  get() {
55740
- return promises2.finished;
55740
+ return promises3.finished;
55741
55741
  }
55742
55742
  });
55743
55743
  Stream.Stream = Stream;
@@ -55753,7 +55753,7 @@ var require_stream4 = __commonJS((exports, module) => {
55753
55753
  var require_ours4 = __commonJS((exports, module) => {
55754
55754
  var Stream = __require("stream");
55755
55755
  if (Stream && process.env.READABLE_STREAM === "disable") {
55756
- const promises2 = Stream.promises;
55756
+ const promises3 = Stream.promises;
55757
55757
  module.exports._uint8ArrayToBuffer = Stream._uint8ArrayToBuffer;
55758
55758
  module.exports._isUint8Array = Stream._isUint8Array;
55759
55759
  module.exports.isDisturbed = Stream.isDisturbed;
@@ -55773,13 +55773,13 @@ var require_ours4 = __commonJS((exports, module) => {
55773
55773
  configurable: true,
55774
55774
  enumerable: true,
55775
55775
  get() {
55776
- return promises2;
55776
+ return promises3;
55777
55777
  }
55778
55778
  });
55779
55779
  module.exports.Stream = Stream.Stream;
55780
55780
  } else {
55781
55781
  const CustomStream = require_stream4();
55782
- const promises2 = require_promises4();
55782
+ const promises3 = require_promises4();
55783
55783
  const originalDestroy = CustomStream.Readable.destroy;
55784
55784
  module.exports = CustomStream.Readable;
55785
55785
  module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
@@ -55802,7 +55802,7 @@ var require_ours4 = __commonJS((exports, module) => {
55802
55802
  configurable: true,
55803
55803
  enumerable: true,
55804
55804
  get() {
55805
- return promises2;
55805
+ return promises3;
55806
55806
  }
55807
55807
  });
55808
55808
  module.exports.Stream = CustomStream.Stream;
@@ -59364,7 +59364,7 @@ function mitt_default(n2) {
59364
59364
  }
59365
59365
 
59366
59366
  // node_modules/@wdio/utils/build/index.js
59367
- import fs4 from "node:fs/promises";
59367
+ import fs5 from "node:fs/promises";
59368
59368
  import path3 from "node:path";
59369
59369
  function overwriteElementCommands(propertiesObject) {
59370
59370
  const elementOverrides = propertiesObject.__elementOverrides__ ? propertiesObject.__elementOverrides__.value : {};
@@ -59497,7 +59497,7 @@ async function enableFileLogging(outputDir) {
59497
59497
  if (!outputDir) {
59498
59498
  return;
59499
59499
  }
59500
- await fs4.mkdir(path3.join(outputDir), { recursive: true });
59500
+ await fs5.mkdir(path3.join(outputDir), { recursive: true });
59501
59501
  process.env.WDIO_LOG_PATH = path3.join(outputDir, "wdio.log");
59502
59502
  }
59503
59503
  function WebDriver(options, modifier, propertiesObject = {}) {
@@ -88613,19 +88613,19 @@ async function connectWebsocket(candidateUrls, options) {
88613
88613
  }
88614
88614
  return;
88615
88615
  }
88616
- function firstResolved(promises2, errorMessages = []) {
88617
- if (promises2.length === 0) {
88616
+ function firstResolved(promises3, errorMessages = []) {
88617
+ if (promises3.length === 0) {
88618
88618
  const sep5 = `
88619
88619
  - `;
88620
88620
  const errorMessage2 = errorMessages.length > 0 ? sep5 + errorMessages.join(sep5) : "";
88621
88621
  log6.error("Could not connect to Bidi protocol" + errorMessage2);
88622
88622
  return Promise.resolve(undefined);
88623
88623
  }
88624
- return Promise.race(promises2.map(({ promise: promise3 }) => promise3)).then((result) => {
88624
+ return Promise.race(promises3.map(({ promise: promise3 }) => promise3)).then((result) => {
88625
88625
  if (result.isConnected) {
88626
88626
  return result;
88627
88627
  }
88628
- return firstResolved(promises2.filter(({ index }) => index !== result.index), [...errorMessages, result.errorMessage || "unknown error"]);
88628
+ return firstResolved(promises3.filter(({ index }) => index !== result.index), [...errorMessages, result.errorMessage || "unknown error"]);
88629
88629
  });
88630
88630
  }
88631
88631
  function killDriverProcess(capabilities, shutdownDriver) {
@@ -131304,18 +131304,18 @@ var require_proxy_agent2 = __commonJS((exports, module) => {
131304
131304
  }
131305
131305
  }
131306
131306
  [kClose]() {
131307
- const promises2 = [this[kAgent].close()];
131307
+ const promises3 = [this[kAgent].close()];
131308
131308
  if (this[kClient]) {
131309
- promises2.push(this[kClient].close());
131309
+ promises3.push(this[kClient].close());
131310
131310
  }
131311
- return Promise.all(promises2);
131311
+ return Promise.all(promises3);
131312
131312
  }
131313
131313
  [kDestroy]() {
131314
- const promises2 = [this[kAgent].destroy()];
131314
+ const promises3 = [this[kAgent].destroy()];
131315
131315
  if (this[kClient]) {
131316
- promises2.push(this[kClient].destroy());
131316
+ promises3.push(this[kClient].destroy());
131317
131317
  }
131318
- return Promise.all(promises2);
131318
+ return Promise.all(promises3);
131319
131319
  }
131320
131320
  }
131321
131321
  function buildHeaders(headers) {
@@ -144419,7 +144419,7 @@ __export(exports_node, {
144419
144419
  import os5 from "node:os";
144420
144420
  import fs8 from "node:fs";
144421
144421
  import process22 from "node:process";
144422
- import fs5 from "node:fs";
144422
+ import fs6 from "node:fs";
144423
144423
  import path4 from "node:path";
144424
144424
  import fs32 from "node:fs";
144425
144425
  import path32 from "node:path";
@@ -144429,7 +144429,7 @@ import fs42 from "node:fs";
144429
144429
  import path42 from "node:path";
144430
144430
  import fs52 from "node:fs";
144431
144431
  import path5 from "node:path";
144432
- import fs6 from "node:fs/promises";
144432
+ import fs62 from "node:fs/promises";
144433
144433
  import path6 from "node:path";
144434
144434
  import fs7 from "node:fs/promises";
144435
144435
  import path7 from "node:path";
@@ -144445,12 +144445,12 @@ async function downloadFile(fileName, targetDirectory) {
144445
144445
  if (!targetDirectory.endsWith("/")) {
144446
144446
  targetDirectory += "/";
144447
144447
  }
144448
- fs5.mkdirSync(targetDirectory, { recursive: true });
144448
+ fs6.mkdirSync(targetDirectory, { recursive: true });
144449
144449
  const zipFilePath = path4.join(targetDirectory, `${fileName}.zip`);
144450
144450
  const binaryString = atob(base64Content);
144451
144451
  const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
144452
- fs5.writeFileSync(zipFilePath, bytes);
144453
- const zipData = fs5.readFileSync(zipFilePath);
144452
+ fs6.writeFileSync(zipFilePath, bytes);
144453
+ const zipData = fs6.readFileSync(zipFilePath);
144454
144454
  const filesData = [];
144455
144455
  try {
144456
144456
  const zip2 = await import_jszip.default.loadAsync(zipData);
@@ -144458,7 +144458,7 @@ async function downloadFile(fileName, targetDirectory) {
144458
144458
  for (let i2 = 0;i2 < keys2.length; i2++) {
144459
144459
  const fileData = await zip2.files[keys2[i2]].async("nodebuffer");
144460
144460
  const dir = path4.resolve(targetDirectory, keys2[i2]);
144461
- fs5.writeFileSync(dir, fileData);
144461
+ fs6.writeFileSync(dir, fileData);
144462
144462
  log8.info(`File extracted: ${keys2[i2]}`);
144463
144463
  filesData.push(dir);
144464
144464
  }
@@ -144580,7 +144580,7 @@ async function saveScreenshot(filepath, options) {
144580
144580
  await assertDirectoryExists(absoluteFilepath);
144581
144581
  const screenBuffer = this.isBidi ? await takeScreenshotBidi.call(this, filepath, options) : await takeScreenshotClassic.call(this, filepath, options);
144582
144582
  const screenshot = Buffer.from(screenBuffer, "base64");
144583
- await fs6.writeFile(absoluteFilepath, screenshot);
144583
+ await fs62.writeFile(absoluteFilepath, screenshot);
144584
144584
  return screenshot;
144585
144585
  }
144586
144586
  function takeScreenshotClassic(filepath, options) {
@@ -144620,19 +144620,19 @@ async function takeScreenshotBidi(filepath, options) {
144620
144620
  type: imageFormat,
144621
144621
  quality
144622
144622
  };
144623
- const clip2 = options?.clip ? {
144623
+ const clip3 = options?.clip ? {
144624
144624
  type: "box",
144625
144625
  x: options.clip.x,
144626
144626
  y: options.clip.y,
144627
144627
  width: options.clip.width,
144628
144628
  height: options.clip.height
144629
144629
  } : undefined;
144630
- if (clip2) {
144631
- if (typeof clip2.x !== "number" || typeof clip2.y !== "number" || typeof clip2.width !== "number" || typeof clip2.height !== "number") {
144630
+ if (clip3) {
144631
+ if (typeof clip3.x !== "number" || typeof clip3.y !== "number" || typeof clip3.width !== "number" || typeof clip3.height !== "number") {
144632
144632
  throw new Error("Invalid clip, use an object with x, y, width and height properties");
144633
144633
  }
144634
144634
  }
144635
- const { data: data2 } = contextManager.findParentContext(context, tree.contexts) ? await browser.$("html").getElement().then((el) => this.takeElementScreenshot(el.elementId).then((data22) => ({ data: data22 }))) : await this.browsingContextCaptureScreenshot({ context, origin, format, clip: clip2 });
144635
+ const { data: data2 } = contextManager.findParentContext(context, tree.contexts) ? await browser.$("html").getElement().then((el) => this.takeElementScreenshot(el.elementId).then((data22) => ({ data: data22 }))) : await this.browsingContextCaptureScreenshot({ context, origin, format, clip: clip3 });
144636
144636
  return data2;
144637
144637
  }
144638
144638
  async function saveElementScreenshot(filepath) {
@@ -155198,7 +155198,7 @@ var authMessages = {
155198
155198
  linkExpired: "The flow bundle download link has expired. Please run `qawolf flows pull` again to refresh.",
155199
155199
  failedWithStatus: (status) => `Could not download the flow bundle (HTTP ${status}).`,
155200
155200
  networkUnreachable: "Could not reach the flow bundle storage. Check your network connection and try again.",
155201
- timedOut: (timeoutMs) => `Downloading the flow bundle timed out after ${formatSeconds(timeoutMs)}. Please try again.`,
155201
+ timedOut: (timeoutMs) => `Downloading the flow bundle stalled — no data arrived for ${formatSeconds(timeoutMs)}. Please try again.`,
155202
155202
  malformed: "The flow bundle download was malformed. Please run `qawolf flows pull` again."
155203
155203
  }
155204
155204
  },
@@ -155345,6 +155345,7 @@ var flowsMessages = {
155345
155345
  aborted: "Aborted; no changes.",
155346
155346
  extractingBundle: "Extracting bundle",
155347
155347
  downloadingTeamStorageAssets: "Downloading team-storage assets",
155348
+ downloadingTeamStorageAssetsProgress: (current, total) => `Downloading team-storage assets (${String(current)}/${String(total)})`,
155348
155349
  teamStorageRequiresTeamKey: "Team storage requires a team API key; organization keys are not supported here.",
155349
155350
  summary: (result, assetsAbs) => {
155350
155351
  const flows = pluralize(result.flowCount, "flow");
@@ -155639,10 +155640,33 @@ function flushAndExit(code, proc = process, scheduleBackstop = (fn) => {
155639
155640
  }
155640
155641
 
155641
155642
  // src/shell/fs.ts
155643
+ import * as fs2 from "node:fs";
155644
+
155645
+ // src/shell/fsWriteHandle.ts
155642
155646
  import * as fs from "node:fs";
155647
+ async function openFsWriteHandle(path2) {
155648
+ const handle = await fs.promises.open(path2, "w");
155649
+ return {
155650
+ async write(chunk) {
155651
+ let remaining = chunk;
155652
+ while (remaining.length > 0) {
155653
+ const { bytesWritten } = await handle.write(remaining);
155654
+ if (bytesWritten === 0) {
155655
+ throw new Error(`write returned 0 bytes for '${path2}'`);
155656
+ }
155657
+ remaining = remaining.subarray(bytesWritten);
155658
+ }
155659
+ },
155660
+ close() {
155661
+ return handle.close();
155662
+ }
155663
+ };
155664
+ }
155665
+
155666
+ // src/shell/fs.ts
155643
155667
  async function pathExists(p) {
155644
155668
  try {
155645
- await fs.promises.stat(p);
155669
+ await fs2.promises.stat(p);
155646
155670
  return true;
155647
155671
  } catch (err) {
155648
155672
  if (isNoEntError(err))
@@ -155653,66 +155677,67 @@ async function pathExists(p) {
155653
155677
  function makeDefaultFs() {
155654
155678
  return {
155655
155679
  async mkdir(path2, options) {
155656
- await fs.promises.mkdir(path2, options);
155680
+ await fs2.promises.mkdir(path2, options);
155657
155681
  },
155658
155682
  pathExists,
155659
155683
  readFile(path2) {
155660
- return fs.promises.readFile(path2, "utf-8");
155684
+ return fs2.promises.readFile(path2, "utf-8");
155661
155685
  },
155662
155686
  async rm(path2, options) {
155663
- await fs.promises.rm(path2, options);
155687
+ await fs2.promises.rm(path2, options);
155664
155688
  },
155665
155689
  stat(path2) {
155666
- return fs.promises.stat(path2);
155690
+ return fs2.promises.stat(path2);
155667
155691
  },
155668
155692
  async unlink(path2) {
155669
- await fs.promises.unlink(path2);
155693
+ await fs2.promises.unlink(path2);
155670
155694
  },
155671
155695
  async writeFile(path2, data, options) {
155672
155696
  if (typeof data === "string") {
155673
- await fs.promises.writeFile(path2, data, {
155697
+ await fs2.promises.writeFile(path2, data, {
155674
155698
  encoding: "utf8",
155675
155699
  mode: options?.mode
155676
155700
  });
155677
155701
  } else {
155678
- await fs.promises.writeFile(path2, data, options ?? undefined);
155702
+ await fs2.promises.writeFile(path2, data, options ?? undefined);
155679
155703
  }
155680
155704
  },
155705
+ openWriteHandle: openFsWriteHandle,
155681
155706
  readdir(path2) {
155682
- return fs.promises.readdir(path2);
155707
+ return fs2.promises.readdir(path2);
155683
155708
  },
155684
155709
  readdirWithTypes(path2) {
155685
- return fs.promises.readdir(path2, {
155710
+ return fs2.promises.readdir(path2, {
155686
155711
  withFileTypes: true
155687
155712
  });
155688
155713
  },
155689
155714
  rename(oldPath, newPath) {
155690
- return fs.promises.rename(oldPath, newPath);
155715
+ return fs2.promises.rename(oldPath, newPath);
155691
155716
  },
155692
155717
  utimes(path2, atime, mtime) {
155693
- return fs.promises.utimes(path2, atime, mtime);
155718
+ return fs2.promises.utimes(path2, atime, mtime);
155694
155719
  },
155695
155720
  createReadStream(path2) {
155696
- if (!fs.existsSync(path2)) {
155721
+ if (!fs2.existsSync(path2)) {
155697
155722
  const err = Object.assign(new Error(`ENOENT: no such file or directory, open '${path2}'`), { code: "ENOENT", errno: -2 });
155698
155723
  throw err;
155699
155724
  }
155700
- return fs.createReadStream(path2);
155725
+ return fs2.createReadStream(path2);
155701
155726
  },
155702
155727
  async copyFile(source, destination) {
155703
- await fs.promises.copyFile(source, destination);
155728
+ await fs2.promises.copyFile(source, destination);
155704
155729
  },
155705
155730
  existsSync(path2) {
155706
- return fs.existsSync(path2);
155731
+ return fs2.existsSync(path2);
155707
155732
  },
155708
155733
  readFileSync(path2) {
155709
- return fs.readFileSync(path2, "utf-8");
155734
+ return fs2.readFileSync(path2, "utf-8");
155710
155735
  },
155711
155736
  writeFileSync(path2, data) {
155712
- fs.writeFileSync(path2, data, "utf8");
155737
+ fs2.writeFileSync(path2, data, "utf8");
155713
155738
  },
155714
155739
  mkdirSync(path2, options) {
155715
- fs.mkdirSync(path2, options);
155740
+ fs2.mkdirSync(path2, options);
155716
155741
  }
155717
155742
  };
155718
155743
  }
@@ -155747,18 +155772,18 @@ function deleteFromKeychain() {
155747
155772
  return "unavailable";
155748
155773
  }
155749
155774
  }
155750
- async function deleteFromFile(configDir, fs2) {
155775
+ async function deleteFromFile(configDir, fs3) {
155751
155776
  try {
155752
- await fs2.unlink(join2(configDir, credentialsFile));
155777
+ await fs3.unlink(join2(configDir, credentialsFile));
155753
155778
  return "deleted";
155754
155779
  } catch {
155755
155780
  return "not-found";
155756
155781
  }
155757
155782
  }
155758
- async function deleteApiKey(configDir, fs2) {
155783
+ async function deleteApiKey(configDir, fs3) {
155759
155784
  const [keychain, file] = await Promise.all([
155760
155785
  Promise.resolve(deleteFromKeychain()),
155761
- deleteFromFile(configDir, fs2)
155786
+ deleteFromFile(configDir, fs3)
155762
155787
  ]);
155763
155788
  return { keychain, file };
155764
155789
  }
@@ -156536,8 +156561,8 @@ function getElementAtPath(obj, path2) {
156536
156561
  }
156537
156562
  function promiseAllObject(promisesObj) {
156538
156563
  const keys = Object.keys(promisesObj);
156539
- const promises2 = keys.map((key) => promisesObj[key]);
156540
- return Promise.all(promises2).then((results) => {
156564
+ const promises3 = keys.map((key) => promisesObj[key]);
156565
+ return Promise.all(promises3).then((results) => {
156541
156566
  const resolvedObj = {};
156542
156567
  for (let i = 0;i < keys.length; i++) {
156543
156568
  resolvedObj[keys[i]] = results[i];
@@ -170072,30 +170097,30 @@ async function loadApiKey(configDir, deps) {
170072
170097
  // src/domains/auth/store/save.ts
170073
170098
  import { join as join4 } from "node:path";
170074
170099
  import { Entry as Entry2 } from "@napi-rs/keyring";
170075
- async function saveToFile(configDir, key, fs2) {
170100
+ async function saveToFile(configDir, key, fs3) {
170076
170101
  const payload = { apiKey: key };
170077
- await fs2.mkdir(configDir, { recursive: true, mode: 448 });
170078
- await fs2.writeFile(join4(configDir, credentialsFile), JSON.stringify(payload, undefined, 2), { mode: 384 });
170102
+ await fs3.mkdir(configDir, { recursive: true, mode: 448 });
170103
+ await fs3.writeFile(join4(configDir, credentialsFile), JSON.stringify(payload, undefined, 2), { mode: 384 });
170079
170104
  }
170080
- async function saveApiKey(configDir, key, fs2) {
170105
+ async function saveApiKey(configDir, key, fs3) {
170081
170106
  try {
170082
170107
  const entry = new Entry2(service, account);
170083
170108
  entry.setPassword(key);
170084
170109
  return { stored: "keychain" };
170085
170110
  } catch (err) {
170086
- await saveToFile(configDir, key, fs2);
170111
+ await saveToFile(configDir, key, fs3);
170087
170112
  return { stored: "file", keychainError: errorMessage(err) };
170088
170113
  }
170089
170114
  }
170090
170115
  // src/domains/auth/resolve.ts
170091
- function makeDefaultDeps(fs2) {
170116
+ function makeDefaultDeps(fs3) {
170092
170117
  return {
170093
- loadApiKey: (configDir) => loadApiKey(configDir, { EntryClass: Entry3, fs: fs2 }),
170118
+ loadApiKey: (configDir) => loadApiKey(configDir, { EntryClass: Entry3, fs: fs3 }),
170094
170119
  env: process.env
170095
170120
  };
170096
170121
  }
170097
- async function resolveApiKey(configDir, fs2, deps) {
170098
- const resolvedDeps = deps ?? makeDefaultDeps(fs2);
170122
+ async function resolveApiKey(configDir, fs3, deps) {
170123
+ const resolvedDeps = deps ?? makeDefaultDeps(fs3);
170099
170124
  const envKey = resolvedDeps.env["QAWOLF_API_KEY"];
170100
170125
  if (envKey?.trim()) {
170101
170126
  return { key: envKey.trim(), source: "env" };
@@ -170106,8 +170131,8 @@ async function resolveApiKey(configDir, fs2, deps) {
170106
170131
  }
170107
170132
  return;
170108
170133
  }
170109
- async function requireApiKey(configDir, fs2, deps) {
170110
- const result = await resolveApiKey(configDir, fs2, deps);
170134
+ async function requireApiKey(configDir, fs3, deps) {
170135
+ const result = await resolveApiKey(configDir, fs3, deps);
170111
170136
  if (!result) {
170112
170137
  throw new Error("QAWOLF_API_KEY is not set. Set it in your environment, or run 'qawolf auth login'. See 'qawolf doctor'.");
170113
170138
  }
@@ -170194,49 +170219,86 @@ function createLoggingSystem(opts) {
170194
170219
  };
170195
170220
  }
170196
170221
 
170222
+ // src/shell/platform/parseErrorBody.ts
170223
+ var defaultMaxLength = 1024;
170224
+ function asRecord(value) {
170225
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
170226
+ }
170227
+ function asString(value) {
170228
+ return typeof value === "string" ? value : undefined;
170229
+ }
170230
+ function extractMessage(parsed) {
170231
+ const root = asRecord(parsed);
170232
+ if (!root)
170233
+ return;
170234
+ const flat = asString(root["error"]);
170235
+ if (flat !== undefined)
170236
+ return flat;
170237
+ const error51 = asRecord(root["error"]);
170238
+ if (!error51)
170239
+ return;
170240
+ const json2 = asRecord(error51["json"]);
170241
+ return asString(json2?.["message"]) ?? asString(error51["message"]);
170242
+ }
170243
+ function parseErrorBody(body, maxLength = defaultMaxLength) {
170244
+ if (!body)
170245
+ return "";
170246
+ let parsed;
170247
+ try {
170248
+ parsed = JSON.parse(body);
170249
+ } catch {
170250
+ return "";
170251
+ }
170252
+ const message = extractMessage(parsed)?.trim();
170253
+ if (!message)
170254
+ return "";
170255
+ return clip(message, maxLength);
170256
+ }
170257
+ function clip(message, maxLength) {
170258
+ if (message.length <= maxLength)
170259
+ return message;
170260
+ return maxLength < 1 ? "" : `${message.slice(0, maxLength - 1)}…`;
170261
+ }
170262
+
170197
170263
  // src/shell/platform/describeErrors.ts
170198
170264
  var m = authMessages.errors;
170265
+ var inlineReasonMaxLength = 200;
170199
170266
  function describeIdentityError(err) {
170200
170267
  if (err.kind === "http") {
170201
170268
  if (err.status === 401 || err.status === 403) {
170202
- return m.identity.invalidOrUnauthorized;
170269
+ return { error: m.identity.invalidOrUnauthorized };
170203
170270
  }
170204
- return m.identity.couldNotVerify(parseErrorBody(err.body), err.status);
170271
+ return {
170272
+ error: m.identity.couldNotVerify(parseErrorBody(err.body, inlineReasonMaxLength), err.status)
170273
+ };
170205
170274
  }
170206
170275
  if (err.kind === "network") {
170207
- return m.identity.couldNotVerifyNetwork(err.cause.message);
170276
+ return { error: m.identity.couldNotVerifyNetwork(err.cause.message) };
170208
170277
  }
170209
- if (err.kind === "timeout")
170210
- return m.identity.timedOut(err.timeoutMs);
170211
- return m.identity.unexpectedFormat;
170212
- }
170213
- function parseErrorBody(body) {
170214
- if (!body)
170215
- return "";
170216
- try {
170217
- const parsed = JSON.parse(body);
170218
- if (typeof parsed === "object" && parsed !== null && "error" in parsed && typeof parsed.error === "string") {
170219
- return parsed.error;
170220
- }
170221
- } catch {}
170222
- return "";
170278
+ if (err.kind === "timeout") {
170279
+ return { error: m.identity.timedOut(err.timeoutMs) };
170280
+ }
170281
+ return { error: m.identity.unexpectedFormat };
170223
170282
  }
170224
170283
  function describeRequestError(err, baseUrl, noun) {
170225
170284
  if (err.kind === "http") {
170285
+ const reason = parseErrorBody(err.body);
170286
+ const body = reason ? { errorBody: reason } : {};
170226
170287
  if (err.status === 401)
170227
- return m.request.rejected401(noun);
170288
+ return { error: m.request.rejected401(noun), ...body };
170228
170289
  if (err.status === 403)
170229
- return m.request.rejected403(noun);
170290
+ return { error: m.request.rejected403(noun), ...body };
170230
170291
  if (err.status === 404)
170231
- return m.request.notFound404(noun);
170232
- return m.request.failedWithStatus(err.status, noun);
170292
+ return { error: m.request.notFound404(noun), ...body };
170293
+ return { error: m.request.failedWithStatus(err.status, noun), ...body };
170233
170294
  }
170234
170295
  if (err.kind === "network") {
170235
- return m.request.networkUnreachable(baseUrl, noun);
170296
+ return { error: m.request.networkUnreachable(baseUrl, noun) };
170236
170297
  }
170237
- if (err.kind === "timeout")
170238
- return m.request.timedOut(err.timeoutMs, noun);
170239
- return m.request.unexpectedResponse(noun);
170298
+ if (err.kind === "timeout") {
170299
+ return { error: m.request.timedOut(err.timeoutMs, noun) };
170300
+ }
170301
+ return { error: m.request.unexpectedResponse(noun) };
170240
170302
  }
170241
170303
  function describeBundleDownloadError(err) {
170242
170304
  if (err.kind === "http") {
@@ -170261,7 +170323,7 @@ function describeTeamStorageDownloadError(path2, err) {
170261
170323
  return `Could not reach team-storage while downloading ${path2}. Check your network connection and try again.`;
170262
170324
  }
170263
170325
  if (err.kind === "timeout") {
170264
- return `Downloading the team-storage asset ${path2} timed out after ${formatSeconds(err.timeoutMs)}. Please try again.`;
170326
+ return `Downloading the team-storage asset ${path2} stalled — no data arrived for ${formatSeconds(err.timeoutMs)}. Please try again.`;
170265
170327
  }
170266
170328
  return `The team-storage download for ${path2} was malformed. Please run \`qawolf flows pull\` again.`;
170267
170329
  }
@@ -170271,6 +170333,9 @@ import { setTimeout as setTimeout2 } from "node:timers/promises";
170271
170333
  var sleep = (ms) => setTimeout2(ms);
170272
170334
 
170273
170335
  // src/shell/platform/requestWithRetry.ts
170336
+ function failureFields(failure) {
170337
+ return failure.errorBody ? { error: failure.error, errorBody: failure.errorBody } : { error: failure.error };
170338
+ }
170274
170339
  async function requestWithRetry(args) {
170275
170340
  const sleep2 = args.sleep ?? sleep;
170276
170341
  for (let attempt = 0;; attempt++) {
@@ -170280,7 +170345,7 @@ async function requestWithRetry(args) {
170280
170345
  const backoff = args.backoffMs[attempt];
170281
170346
  const retryable = result.error.kind === "network" || result.error.kind === "timeout";
170282
170347
  if (backoff === undefined || !retryable) {
170283
- return { ok: false, error: args.describe(result.error) };
170348
+ return { ok: false, ...args.describe(result.error) };
170284
170349
  }
170285
170350
  await sleep2(backoff);
170286
170351
  }
@@ -171185,15 +171250,15 @@ function createTrpcClient(apiKey, deps) {
171185
171250
  }
171186
171251
  };
171187
171252
  }
171188
- function clip(text) {
171253
+ function clip2(text) {
171189
171254
  return text.length > 200 ? text.slice(0, 200) + "…" : text;
171190
171255
  }
171191
171256
  function summarize(error51) {
171192
171257
  if (error51.kind === "http")
171193
- return `${error51.status} ${clip(error51.body)}`;
171258
+ return `${error51.status} ${clip2(error51.body)}`;
171194
171259
  if (error51.kind === "timeout")
171195
171260
  return `timed out after ${error51.timeoutMs}ms`;
171196
- return clip(error51.cause.message);
171261
+ return clip2(error51.cause.message);
171197
171262
  }
171198
171263
 
171199
171264
  // src/shell/platform/downloadBundle.ts
@@ -171202,47 +171267,87 @@ import { tmpdir as tmpdir2 } from "node:os";
171202
171267
  import { join as join6 } from "node:path";
171203
171268
 
171204
171269
  // src/shell/platform/fetchSignedUrl.ts
171205
- var timeoutMs = 30000;
171270
+ var defaultStallTimeoutMs = 30000;
171206
171271
  async function fetchSignedUrl(args, deps = { fetch: globalThis.fetch }) {
171207
- let response;
171272
+ const timeoutMs = deps.stallTimeoutMs ?? defaultStallTimeoutMs;
171273
+ const fs3 = deps.fs ?? makeDefaultFs();
171274
+ const partPath = `${args.dest}.part`;
171275
+ const controller = new AbortController;
171276
+ let stallTimer;
171277
+ const armStallTimer = () => {
171278
+ clearTimeout(stallTimer);
171279
+ stallTimer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), timeoutMs);
171280
+ };
171208
171281
  try {
171209
- response = await deps.fetch(args.url, {
171210
- signal: AbortSignal.timeout(timeoutMs)
171211
- });
171212
- } catch (error51) {
171213
- if (isTimeoutError(error51)) {
171214
- return { ok: false, error: { kind: "timeout", timeoutMs } };
171282
+ armStallTimer();
171283
+ let response;
171284
+ try {
171285
+ response = await deps.fetch(args.url, { signal: controller.signal });
171286
+ } catch (error51) {
171287
+ if (isTimeoutError(error51)) {
171288
+ return { ok: false, error: { kind: "timeout", timeoutMs } };
171289
+ }
171290
+ return { ok: false, error: { cause: toError(error51), kind: "network" } };
171215
171291
  }
171216
- return { ok: false, error: { cause: toError(error51), kind: "network" } };
171217
- }
171218
- if (!response.ok) {
171219
- const body = await response.text().catch(() => "");
171220
- return {
171221
- ok: false,
171222
- error: { body, kind: "http", status: response.status }
171223
- };
171224
- }
171225
- if (!response.body) {
171226
- return {
171227
- ok: false,
171228
- error: { cause: new Error("response had no body"), kind: "network" }
171292
+ if (!response.ok) {
171293
+ const body = await response.text().catch(() => "");
171294
+ return {
171295
+ ok: false,
171296
+ error: { body, kind: "http", status: response.status }
171297
+ };
171298
+ }
171299
+ if (!response.body) {
171300
+ return {
171301
+ ok: false,
171302
+ error: { cause: new Error("response had no body"), kind: "network" }
171303
+ };
171304
+ }
171305
+ let handle;
171306
+ try {
171307
+ handle = await fs3.openWriteHandle(partPath);
171308
+ } catch (error51) {
171309
+ controller.abort(toError(error51));
171310
+ return { ok: false, error: { cause: toError(error51), kind: "network" } };
171311
+ }
171312
+ const discardPart = async () => {
171313
+ await handle.close().catch(() => {});
171314
+ await fs3.unlink(partPath).catch(() => {});
171229
171315
  };
171230
- }
171231
- let downloaded;
171232
- try {
171233
- downloaded = await response.arrayBuffer();
171234
- } catch (error51) {
171235
- if (isTimeoutError(error51)) {
171236
- return { ok: false, error: { kind: "timeout", timeoutMs } };
171316
+ const reader = response.body.getReader();
171317
+ for (;; ) {
171318
+ let result;
171319
+ try {
171320
+ result = await reader.read();
171321
+ } catch (error51) {
171322
+ await discardPart();
171323
+ if (isTimeoutError(error51)) {
171324
+ return { ok: false, error: { kind: "timeout", timeoutMs } };
171325
+ }
171326
+ return { ok: false, error: { cause: toError(error51), kind: "network" } };
171327
+ }
171328
+ if (result.done)
171329
+ break;
171330
+ clearTimeout(stallTimer);
171331
+ try {
171332
+ await handle.write(result.value);
171333
+ } catch (error51) {
171334
+ controller.abort(toError(error51));
171335
+ await discardPart();
171336
+ return { ok: false, error: { cause: toError(error51), kind: "network" } };
171337
+ }
171338
+ armStallTimer();
171237
171339
  }
171238
- return { ok: false, error: { cause: toError(error51), kind: "network" } };
171239
- }
171240
- try {
171241
- await (deps.fs ?? makeDefaultFs()).writeFile(args.dest, new Uint8Array(downloaded));
171242
- } catch (error51) {
171243
- return { ok: false, error: { cause: toError(error51), kind: "network" } };
171340
+ try {
171341
+ await handle.close();
171342
+ await fs3.rename(partPath, args.dest);
171343
+ } catch (error51) {
171344
+ await fs3.unlink(partPath).catch(() => {});
171345
+ return { ok: false, error: { cause: toError(error51), kind: "network" } };
171346
+ }
171347
+ return { ok: true, data: undefined };
171348
+ } finally {
171349
+ clearTimeout(stallTimer);
171244
171350
  }
171245
- return { ok: true, data: undefined };
171246
171351
  }
171247
171352
 
171248
171353
  // src/shell/platform/downloadBundle.ts
@@ -172129,18 +172234,18 @@ var makeContractsV1 = (ids) => {
172129
172234
  var publicContractsV1 = makeContractsV1(defaultIdSchemas);
172130
172235
 
172131
172236
  // src/shell/platform/getIdentity.ts
172132
- var timeoutMs2 = 1e4;
172237
+ var timeoutMs = 1e4;
172133
172238
  async function getIdentity(apiKey, deps) {
172134
172239
  const url2 = `${deps.baseUrl}/api/v0/identity`;
172135
172240
  let response;
172136
172241
  try {
172137
172242
  response = await deps.fetch(url2, {
172138
172243
  headers: { Authorization: `Bearer ${apiKey}` },
172139
- signal: AbortSignal.timeout(timeoutMs2)
172244
+ signal: AbortSignal.timeout(timeoutMs)
172140
172245
  });
172141
172246
  } catch (error51) {
172142
172247
  if (isTimeoutError(error51)) {
172143
- return { ok: false, error: { kind: "timeout", timeoutMs: timeoutMs2 } };
172248
+ return { ok: false, error: { kind: "timeout", timeoutMs } };
172144
172249
  }
172145
172250
  return {
172146
172251
  ok: false,
@@ -172159,7 +172264,7 @@ async function getIdentity(apiKey, deps) {
172159
172264
  json2 = await response.json();
172160
172265
  } catch (error51) {
172161
172266
  if (isTimeoutError(error51)) {
172162
- return { ok: false, error: { kind: "timeout", timeoutMs: timeoutMs2 } };
172267
+ return { ok: false, error: { kind: "timeout", timeoutMs } };
172163
172268
  }
172164
172269
  json2 = undefined;
172165
172270
  }
@@ -172222,9 +172327,6 @@ async function listTeamStorageFiles(trpc, args, deps) {
172222
172327
  return { ok: true, value: files };
172223
172328
  }
172224
172329
 
172225
- // src/shell/platform/teamStorageAssets.ts
172226
- import { dirname as dirname3, join as join9 } from "node:path";
172227
-
172228
172330
  // src/shell/platform/teamStorageAssetManifest.ts
172229
172331
  import { dirname as dirname2 } from "node:path";
172230
172332
  var assetManifestSchema = exports_external.object({
@@ -172239,10 +172341,10 @@ var assetManifestSchema = exports_external.object({
172239
172341
  function assetManifestPath(assetsAbs) {
172240
172342
  return `${assetsAbs}.manifest.json`;
172241
172343
  }
172242
- async function readAssetManifest(assetsAbs, fs2) {
172344
+ async function readAssetManifest(assetsAbs, fs3) {
172243
172345
  let raw;
172244
172346
  try {
172245
- raw = await fs2.readFile(assetManifestPath(assetsAbs));
172347
+ raw = await fs3.readFile(assetManifestPath(assetsAbs));
172246
172348
  } catch (err) {
172247
172349
  if (isNoEntError(err))
172248
172350
  return new Map;
@@ -172259,7 +172361,7 @@ async function readAssetManifest(assetsAbs, fs2) {
172259
172361
  return new Map;
172260
172362
  return new Map(result.data.files.map((file2) => [file2.path, file2]));
172261
172363
  }
172262
- async function writeAssetManifest(assetsAbs, files, fs2) {
172364
+ async function writeAssetManifest(assetsAbs, files, fs3) {
172263
172365
  const manifest = {
172264
172366
  version: 1,
172265
172367
  files: files.map((file2) => ({
@@ -172270,8 +172372,8 @@ async function writeAssetManifest(assetsAbs, files, fs2) {
172270
172372
  }))
172271
172373
  };
172272
172374
  const path2 = assetManifestPath(assetsAbs);
172273
- await fs2.mkdir(dirname2(path2), { recursive: true });
172274
- await fs2.writeFile(path2, `${JSON.stringify(manifest, undefined, 2)}
172375
+ await fs3.mkdir(dirname2(path2), { recursive: true });
172376
+ await fs3.writeFile(path2, `${JSON.stringify(manifest, undefined, 2)}
172275
172377
  `);
172276
172378
  }
172277
172379
  function serializeDate(value) {
@@ -172304,19 +172406,19 @@ import { join as join7, sep as sep2 } from "node:path";
172304
172406
  function mintAssetSnapshotPath(assetsAbs, label) {
172305
172407
  return `${assetsAbs}.${label}-${randomBytes2(8).toString("hex")}`;
172306
172408
  }
172307
- async function replaceAssetsDir(assetsAbs, tmpAssets, fs2) {
172409
+ async function replaceAssetsDir(assetsAbs, tmpAssets, fs3) {
172308
172410
  const oldAssets = mintAssetSnapshotPath(assetsAbs, "old");
172309
172411
  let movedOldAssets = false;
172310
172412
  try {
172311
- if (await fs2.pathExists(assetsAbs)) {
172312
- await fs2.rename(assetsAbs, oldAssets);
172413
+ if (await fs3.pathExists(assetsAbs)) {
172414
+ await fs3.rename(assetsAbs, oldAssets);
172313
172415
  movedOldAssets = true;
172314
172416
  }
172315
- await fs2.rename(tmpAssets, assetsAbs);
172417
+ await fs3.rename(tmpAssets, assetsAbs);
172316
172418
  } catch (error51) {
172317
172419
  if (movedOldAssets) {
172318
172420
  try {
172319
- await fs2.rename(oldAssets, assetsAbs);
172421
+ await fs3.rename(oldAssets, assetsAbs);
172320
172422
  } catch (rollbackError) {
172321
172423
  throw new Error(`Failed to replace team-storage assets and rollback also failed; previous assets may remain at ${oldAssets}. Replace error: ${errorMessage(error51)}. Rollback error: ${errorMessage(rollbackError)}`, { cause: rollbackError });
172322
172424
  }
@@ -172324,18 +172426,18 @@ async function replaceAssetsDir(assetsAbs, tmpAssets, fs2) {
172324
172426
  throw error51;
172325
172427
  }
172326
172428
  if (movedOldAssets) {
172327
- await cleanupAssetSnapshot(oldAssets, fs2);
172429
+ await cleanupAssetSnapshot(oldAssets, fs3);
172328
172430
  }
172329
172431
  }
172330
- async function cleanupAssetSnapshot(absPath, fs2) {
172331
- await fs2.rm(absPath, { recursive: true, force: true }).catch(() => {});
172432
+ async function cleanupAssetSnapshot(absPath, fs3) {
172433
+ await fs3.rm(absPath, { recursive: true, force: true }).catch(() => {});
172332
172434
  }
172333
- async function hasExactAssetSnapshot(assetsAbs, filePaths, fs2) {
172435
+ async function hasExactAssetSnapshot(assetsAbs, filePaths, fs3) {
172334
172436
  const expected = expectedEntries(filePaths);
172335
- if (!await fs2.pathExists(assetsAbs))
172437
+ if (!await fs3.pathExists(assetsAbs))
172336
172438
  return expected.size === 0;
172337
172439
  const actual = new Set;
172338
- await collectEntries(assetsAbs, "", actual, fs2);
172440
+ await collectEntries(assetsAbs, "", actual, fs3);
172339
172441
  return setsEqual(actual, expected);
172340
172442
  }
172341
172443
  function expectedEntries(filePaths) {
@@ -172349,13 +172451,13 @@ function expectedEntries(filePaths) {
172349
172451
  }
172350
172452
  return entries;
172351
172453
  }
172352
- async function collectEntries(root, relDir, out, fs2) {
172454
+ async function collectEntries(root, relDir, out, fs3) {
172353
172455
  const current = relDir ? join7(root, relDir) : root;
172354
- for (const entry of await fs2.readdirWithTypes(current)) {
172456
+ for (const entry of await fs3.readdirWithTypes(current)) {
172355
172457
  const relPath = relDir ? join7(relDir, entry.name) : entry.name;
172356
172458
  out.add(relPath);
172357
172459
  if (entry.isDirectory()) {
172358
- await collectEntries(root, relPath, out, fs2);
172460
+ await collectEntries(root, relPath, out, fs3);
172359
172461
  }
172360
172462
  }
172361
172463
  }
@@ -172367,22 +172469,45 @@ function setsEqual(left, right) {
172367
172469
 
172368
172470
  // src/shell/platform/teamStorageAssetReuse.ts
172369
172471
  import { join as join8 } from "node:path";
172370
- async function reusableAssetPaths(assetsAbs, safeFiles, manifest, fs2) {
172472
+ async function reusableAssetPaths(assetsAbs, safeFiles, manifest, fs3) {
172371
172473
  const reusable = new Set;
172372
172474
  for (const { file: file2, relativePath } of safeFiles) {
172373
- if (await canReuseAsset(assetsAbs, relativePath, file2, manifest, fs2)) {
172475
+ if (await canReuseAsset(assetsAbs, relativePath, file2, manifest, fs3)) {
172374
172476
  reusable.add(relativePath);
172375
172477
  }
172376
172478
  }
172377
172479
  return reusable;
172378
172480
  }
172379
- async function canReuseAsset(assetsAbs, relativePath, file2, manifest, fs2) {
172481
+ async function canReuseAsset(assetsAbs, relativePath, file2, manifest, fs3) {
172380
172482
  if (file2.etag === undefined)
172381
172483
  return false;
172382
172484
  const previous = manifest.get(relativePath);
172383
172485
  if (previous?.etag !== file2.etag)
172384
172486
  return false;
172385
- return fs2.pathExists(join8(assetsAbs, relativePath));
172487
+ return fs3.pathExists(join8(assetsAbs, relativePath));
172488
+ }
172489
+
172490
+ // src/shell/platform/writeAssetSnapshot.ts
172491
+ import { dirname as dirname3, join as join9 } from "node:path";
172492
+ async function writeAssetSnapshot(args) {
172493
+ let downloadedCount = 0;
172494
+ const total = args.safeFiles.filter(({ relativePath }) => !args.reusable.has(relativePath)).length;
172495
+ await args.deps.fs.mkdir(args.tmpAssets, { recursive: true });
172496
+ for (const { file: file2, relativePath } of args.safeFiles) {
172497
+ const dest = join9(args.tmpAssets, relativePath);
172498
+ await args.deps.fs.mkdir(dirname3(dest), { recursive: true });
172499
+ if (args.reusable.has(relativePath)) {
172500
+ await args.deps.fs.copyFile(join9(args.assetsAbs, relativePath), dest);
172501
+ continue;
172502
+ }
172503
+ args.deps.onProgress?.({ current: downloadedCount + 1, total });
172504
+ const result = await fetchSignedUrl({ url: file2.signedUrl, dest }, { fetch: args.deps.fetch, fs: args.deps.fs });
172505
+ if (!result.ok) {
172506
+ throw new Error(describeTeamStorageDownloadError(file2.path, result.error));
172507
+ }
172508
+ downloadedCount++;
172509
+ }
172510
+ return downloadedCount;
172386
172511
  }
172387
172512
 
172388
172513
  // src/shell/platform/teamStorageAssets.ts
@@ -172397,9 +172522,9 @@ async function downloadTeamStorageAssets(args, deps = { fetch: globalThis.fetch
172397
172522
  }
172398
172523
  }
172399
172524
  async function writeTeamStorageAssets(args, deps) {
172400
- const fs2 = deps.fs ?? makeDefaultFs();
172525
+ const fs3 = deps.fs ?? makeDefaultFs();
172401
172526
  const tmpAssets = mintAssetSnapshotPath(args.assetsAbs, "pull");
172402
- const manifest = await readAssetManifest(args.assetsAbs, fs2);
172527
+ const manifest = await readAssetManifest(args.assetsAbs, fs3);
172403
172528
  const safeFiles = [];
172404
172529
  for (const file2 of args.files) {
172405
172530
  const relativePath = safeAssetPath(file2.path);
@@ -172407,54 +172532,36 @@ async function writeTeamStorageAssets(args, deps) {
172407
172532
  safeFiles.push({ file: file2, relativePath });
172408
172533
  }
172409
172534
  const skippedCount = args.files.length - safeFiles.length;
172410
- const reusable = await reusableAssetPaths(args.assetsAbs, safeFiles, manifest, fs2);
172535
+ const reusable = await reusableAssetPaths(args.assetsAbs, safeFiles, manifest, fs3);
172411
172536
  const reusedCount = reusable.size;
172412
- if (reusedCount === safeFiles.length && await hasExactAssetSnapshot(args.assetsAbs, safeFiles.map((file2) => file2.relativePath), fs2)) {
172537
+ if (reusedCount === safeFiles.length && await hasExactAssetSnapshot(args.assetsAbs, safeFiles.map((file2) => file2.relativePath), fs3)) {
172413
172538
  return { downloadedCount: 0, reusedCount, skippedCount };
172414
172539
  }
172415
172540
  try {
172416
172541
  const downloadedCount = await writeAssetSnapshot({
172417
172542
  assetsAbs: args.assetsAbs,
172418
- deps: { fetch: deps.fetch, fs: fs2 },
172543
+ deps: { fetch: deps.fetch, fs: fs3, onProgress: deps.onProgress },
172419
172544
  reusable,
172420
172545
  safeFiles,
172421
172546
  tmpAssets
172422
172547
  });
172423
- await replaceAssetsDir(args.assetsAbs, tmpAssets, fs2);
172548
+ await replaceAssetsDir(args.assetsAbs, tmpAssets, fs3);
172424
172549
  await writeAssetManifest(args.assetsAbs, safeFiles.map(({ file: file2, relativePath }) => ({
172425
172550
  ...file2,
172426
172551
  path: relativePath
172427
- })), fs2);
172552
+ })), fs3);
172428
172553
  return { downloadedCount, reusedCount, skippedCount };
172429
172554
  } catch (error51) {
172430
- await cleanupAssetSnapshot(tmpAssets, fs2);
172555
+ await cleanupAssetSnapshot(tmpAssets, fs3);
172431
172556
  throw error51;
172432
172557
  }
172433
172558
  }
172434
- async function writeAssetSnapshot(args) {
172435
- let downloadedCount = 0;
172436
- await args.deps.fs.mkdir(args.tmpAssets, { recursive: true });
172437
- for (const { file: file2, relativePath } of args.safeFiles) {
172438
- const dest = join9(args.tmpAssets, relativePath);
172439
- await args.deps.fs.mkdir(dirname3(dest), { recursive: true });
172440
- if (args.reusable.has(relativePath)) {
172441
- await args.deps.fs.copyFile(join9(args.assetsAbs, relativePath), dest);
172442
- continue;
172443
- }
172444
- const result = await fetchSignedUrl({ url: file2.signedUrl, dest }, { fetch: args.deps.fetch, fs: args.deps.fs });
172445
- if (!result.ok) {
172446
- throw new Error(describeTeamStorageDownloadError(file2.path, result.error));
172447
- }
172448
- downloadedCount++;
172449
- }
172450
- return downloadedCount;
172451
- }
172452
172559
 
172453
172560
  // src/shell/platform/createPlatformClient.ts
172454
172561
  var requestBackoffMs2 = [500, 1500];
172455
172562
  function createPlatformClient(apiKey, deps) {
172456
172563
  const trpc = createTrpcClient(apiKey, deps);
172457
- const fs2 = deps.fs ?? makeDefaultFs();
172564
+ const fs3 = deps.fs ?? makeDefaultFs();
172458
172565
  async function getFlowsBundleUrlImpl(envId) {
172459
172566
  const result = await requestWithRetry({
172460
172567
  call: () => trpc.mutation("gitwolf.getFlowsBundleUrl", { environmentId: envId }, flowsBundleResponseSchema),
@@ -172500,11 +172607,11 @@ function createPlatformClient(apiKey, deps) {
172500
172607
  }
172501
172608
  return listTeamStorageFiles(trpc, { teamId: identity.value.team.id }, deps);
172502
172609
  },
172503
- async syncTeamStorageAssets(assetsAbs) {
172610
+ async syncTeamStorageAssets(assetsAbs, opts) {
172504
172611
  const files = await this.listTeamStorageFiles();
172505
172612
  if (!files.ok)
172506
172613
  return files;
172507
- return downloadTeamStorageAssets({ assetsAbs, files: files.value }, { fetch: deps.fetch, fs: fs2 });
172614
+ return downloadTeamStorageAssets({ assetsAbs, files: files.value }, { fetch: deps.fetch, fs: fs3, onProgress: opts?.onProgress });
172508
172615
  },
172509
172616
  async downloadBundle(envId) {
172510
172617
  const urlResult = await getFlowsBundleUrlImpl(envId);
@@ -172512,7 +172619,7 @@ function createPlatformClient(apiKey, deps) {
172512
172619
  return urlResult;
172513
172620
  return downloadBundle(urlResult.value.signedUrl, {
172514
172621
  fetch: deps.fetch,
172515
- fs: fs2
172622
+ fs: fs3
172516
172623
  });
172517
172624
  }
172518
172625
  };
@@ -174346,8 +174453,9 @@ function createAgentRenderers() {
174346
174453
  const results = [];
174347
174454
  const total = steps.length;
174348
174455
  for (const [i2, step] of steps.entries()) {
174349
- writeStderrLine(`[${String(i2 + 1)}/${String(total)}] ${step.message}`);
174350
- results.push(await step.task());
174456
+ const label = (message) => `[${String(i2 + 1)}/${String(total)}] ${message}`;
174457
+ writeStderrLine(label(step.message));
174458
+ results.push(await step.task((message) => writeStderrLine(label(message))));
174351
174459
  }
174352
174460
  const { typed, doneMessage } = finalizeResults(results, done);
174353
174461
  writeStderrLine(doneMessage);
@@ -174384,9 +174492,13 @@ ${body}` : ""));
174384
174492
  let currentLabel2 = "";
174385
174493
  try {
174386
174494
  for (const [i2, step] of steps.entries()) {
174387
- currentLabel2 = `[${String(i2 + 1)}/${String(total)}] ${step.message}`;
174495
+ const label = (message) => `[${String(i2 + 1)}/${String(total)}] ${message}`;
174496
+ currentLabel2 = label(step.message);
174388
174497
  clack.log.step(currentLabel2);
174389
- results.push(await step.task());
174498
+ results.push(await step.task((message) => {
174499
+ currentLabel2 = label(message);
174500
+ clack.log.step(currentLabel2);
174501
+ }));
174390
174502
  }
174391
174503
  const { typed, doneMessage } = finalizeResults(results, done);
174392
174504
  clack.log.success(doneMessage);
@@ -174400,13 +174512,17 @@ ${body}` : ""));
174400
174512
  let currentLabel = "";
174401
174513
  try {
174402
174514
  for (const [i2, step] of steps.entries()) {
174403
- currentLabel = `[${String(i2 + 1)}/${String(total)}] ${step.message}`;
174515
+ const label = (message) => `[${String(i2 + 1)}/${String(total)}] ${message}`;
174516
+ currentLabel = label(step.message);
174404
174517
  if (i2 === 0) {
174405
174518
  s.start(currentLabel);
174406
174519
  } else {
174407
174520
  s.message(currentLabel);
174408
174521
  }
174409
- results.push(await step.task());
174522
+ results.push(await step.task((message) => {
174523
+ currentLabel = label(message);
174524
+ s.message(currentLabel);
174525
+ }));
174410
174526
  }
174411
174527
  const { typed, doneMessage } = finalizeResults(results, done);
174412
174528
  s.stop(doneMessage);
@@ -174451,7 +174567,7 @@ function createJsonRenderers() {
174451
174567
  step: i2 + 1,
174452
174568
  total
174453
174569
  });
174454
- results.push(await step.task());
174570
+ results.push(await step.task(() => {}));
174455
174571
  }
174456
174572
  const { typed, doneMessage } = finalizeResults(results, done);
174457
174573
  writeJsonDiagnostic({ type: "success", message: doneMessage });
@@ -174538,12 +174654,12 @@ function createVerboseContext(outputMode, isVerbose) {
174538
174654
 
174539
174655
  // src/shell/npmRegistry.ts
174540
174656
  var registryUrl = "https://registry.npmjs.org";
174541
- var timeoutMs3 = 3000;
174657
+ var timeoutMs2 = 3000;
174542
174658
  async function fetchLatestVersion(packageName, deps = {}) {
174543
174659
  const fetchFn = deps.fetchFn ?? globalThis.fetch;
174544
174660
  try {
174545
174661
  const response = await fetchFn(`${registryUrl}/${packageName}/latest`, {
174546
- signal: AbortSignal.timeout(timeoutMs3)
174662
+ signal: AbortSignal.timeout(timeoutMs2)
174547
174663
  });
174548
174664
  if (!response.ok)
174549
174665
  return;
@@ -174626,7 +174742,7 @@ function startUpdateCheck(deps) {
174626
174742
  // package.json
174627
174743
  var package_default = {
174628
174744
  name: "@qawolf/cli",
174629
- version: "1.7.3",
174745
+ version: "1.7.5",
174630
174746
  description: "Run and manage QA Wolf flows from the terminal, CI, or an AI agent",
174631
174747
  keywords: [
174632
174748
  "automation",
@@ -174741,7 +174857,7 @@ function buildBaseContext(command, signals) {
174741
174857
  ...verboseWrite ? { verboseWrite } : {}
174742
174858
  });
174743
174859
  const apiBaseUrl = resolveHostUrl(env2);
174744
- const fs2 = makeDefaultFs();
174860
+ const fs3 = makeDefaultFs();
174745
174861
  const ui = createUI(outputMode, {
174746
174862
  clack,
174747
174863
  ...verboseTarget ? { verboseTarget } : {}
@@ -174750,7 +174866,7 @@ function buildBaseContext(command, signals) {
174750
174866
  env: env2,
174751
174867
  currentVersion: package_default.version,
174752
174868
  configDir: getConfigDir(),
174753
- fs: fs2,
174869
+ fs: fs3,
174754
174870
  fetchLatestVersion: () => fetchLatestVersion(package_default.name),
174755
174871
  renderNotice: (body, title) => ui.note(body, title)
174756
174872
  });
@@ -174766,7 +174882,7 @@ function buildBaseContext(command, signals) {
174766
174882
  apiBaseUrl,
174767
174883
  signals,
174768
174884
  log: (scope) => loggingSystem.createLogger(scope),
174769
- fs: fs2
174885
+ fs: fs3
174770
174886
  },
174771
174887
  apiBaseUrl,
174772
174888
  loggingSystem,
@@ -175251,12 +175367,12 @@ async function checkApiKey(deps) {
175251
175367
 
175252
175368
  // src/domains/doctor/checks/apiUrl.ts
175253
175369
  async function checkApiUrl(deps) {
175254
- const timeoutMs4 = deps.timeoutMs ?? 5000;
175370
+ const timeoutMs3 = deps.timeoutMs ?? 5000;
175255
175371
  let response;
175256
175372
  try {
175257
175373
  response = await deps.fetch(deps.apiBaseUrl, {
175258
175374
  method: "HEAD",
175259
- signal: AbortSignal.timeout(timeoutMs4)
175375
+ signal: AbortSignal.timeout(timeoutMs3)
175260
175376
  });
175261
175377
  } catch (error51) {
175262
175378
  return {
@@ -175570,10 +175686,10 @@ function renderResults(ui, results) {
175570
175686
 
175571
175687
  // src/domains/flows/ensureDeps.ts
175572
175688
  import { dirname as dirname4, join as join14 } from "node:path";
175573
- function findEnvDir(flowPath, fs2) {
175689
+ function findEnvDir(flowPath, fs3) {
175574
175690
  let dir = dirname4(flowPath);
175575
175691
  while (true) {
175576
- if (fs2.existsSync(join14(dir, "package.json")))
175692
+ if (fs3.existsSync(join14(dir, "package.json")))
175577
175693
  return dir;
175578
175694
  const parent = dirname4(dir);
175579
175695
  if (parent === dir)
@@ -175581,8 +175697,8 @@ function findEnvDir(flowPath, fs2) {
175581
175697
  dir = parent;
175582
175698
  }
175583
175699
  }
175584
- function resolveUniqueEnvDir(files, fs2) {
175585
- const dirs = new Set(files.map((f2) => findEnvDir(f2, fs2)).filter((d) => d !== undefined));
175700
+ function resolveUniqueEnvDir(files, fs3) {
175701
+ const dirs = new Set(files.map((f2) => findEnvDir(f2, fs3)).filter((d) => d !== undefined));
175586
175702
  if (dirs.size > 1) {
175587
175703
  const listed = [...dirs].map((d) => ` - ${d}`).join(`
175588
175704
  `);
@@ -175590,9 +175706,9 @@ function resolveUniqueEnvDir(files, fs2) {
175590
175706
  }
175591
175707
  return dirs.size === 1 ? [...dirs][0] : undefined;
175592
175708
  }
175593
- function resolveProjectDirSafe(files, fs2) {
175709
+ function resolveProjectDirSafe(files, fs3) {
175594
175710
  try {
175595
- return resolveUniqueEnvDir(files, fs2);
175711
+ return resolveUniqueEnvDir(files, fs3);
175596
175712
  } catch {
175597
175713
  return;
175598
175714
  }
@@ -175735,12 +175851,12 @@ function build$3(options) {
175735
175851
  return options.group ? groupFiles : empty;
175736
175852
  }
175737
175853
  var resolveSymlinksAsync = function(path2, state, callback$1) {
175738
- const { queue, fs: fs2, options: { suppressErrors } } = state;
175854
+ const { queue, fs: fs3, options: { suppressErrors } } = state;
175739
175855
  queue.enqueue();
175740
- fs2.realpath(path2, (error51, resolvedPath) => {
175856
+ fs3.realpath(path2, (error51, resolvedPath) => {
175741
175857
  if (error51)
175742
175858
  return queue.dequeue(suppressErrors ? null : error51, state);
175743
- fs2.stat(resolvedPath, (error$1, stat) => {
175859
+ fs3.stat(resolvedPath, (error$1, stat) => {
175744
175860
  if (error$1)
175745
175861
  return queue.dequeue(suppressErrors ? null : error$1, state);
175746
175862
  if (stat.isDirectory() && isRecursive(path2, resolvedPath, state))
@@ -175751,11 +175867,11 @@ var resolveSymlinksAsync = function(path2, state, callback$1) {
175751
175867
  });
175752
175868
  };
175753
175869
  var resolveSymlinks = function(path2, state, callback$1) {
175754
- const { queue, fs: fs2, options: { suppressErrors } } = state;
175870
+ const { queue, fs: fs3, options: { suppressErrors } } = state;
175755
175871
  queue.enqueue();
175756
175872
  try {
175757
- const resolvedPath = fs2.realpathSync(path2);
175758
- const stat = fs2.statSync(resolvedPath);
175873
+ const resolvedPath = fs3.realpathSync(path2);
175874
+ const stat = fs3.statSync(resolvedPath);
175759
175875
  if (stat.isDirectory() && isRecursive(path2, resolvedPath, state))
175760
175876
  return;
175761
175877
  callback$1(stat, resolvedPath);
@@ -175838,23 +175954,23 @@ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
175838
175954
  state.queue.enqueue();
175839
175955
  if (currentDepth < 0)
175840
175956
  return state.queue.dequeue(null, state);
175841
- const { fs: fs2 } = state;
175957
+ const { fs: fs3 } = state;
175842
175958
  state.visited.push(crawlPath);
175843
175959
  state.counts.directories++;
175844
- fs2.readdir(crawlPath || ".", readdirOpts, (error51, entries = []) => {
175960
+ fs3.readdir(crawlPath || ".", readdirOpts, (error51, entries = []) => {
175845
175961
  callback$1(entries, directoryPath, currentDepth);
175846
175962
  state.queue.dequeue(state.options.suppressErrors ? null : error51, state);
175847
175963
  });
175848
175964
  };
175849
175965
  var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
175850
- const { fs: fs2 } = state;
175966
+ const { fs: fs3 } = state;
175851
175967
  if (currentDepth < 0)
175852
175968
  return;
175853
175969
  state.visited.push(crawlPath);
175854
175970
  state.counts.directories++;
175855
175971
  let entries = [];
175856
175972
  try {
175857
- entries = fs2.readdirSync(crawlPath || ".", readdirOpts);
175973
+ entries = fs3.readdirSync(crawlPath || ".", readdirOpts);
175858
175974
  } catch (e) {
175859
175975
  if (!state.options.suppressErrors)
175860
175976
  throw e;
@@ -176483,25 +176599,25 @@ function extractFlowMeta(source) {
176483
176599
  }
176484
176600
 
176485
176601
  // src/domains/flows/expand.ts
176486
- function makePeekFlowMeta(fs2) {
176602
+ function makePeekFlowMeta(fs3) {
176487
176603
  return async (filePath) => {
176488
- const source = await fs2.readFile(filePath);
176604
+ const source = await fs3.readFile(filePath);
176489
176605
  return extractFlowMeta(source);
176490
176606
  };
176491
176607
  }
176492
- async function resolveGlobRoots(cwd, fs2) {
176608
+ async function resolveGlobRoots(cwd, fs3) {
176493
176609
  const qawolfPath = join15(cwd, ".qawolf");
176494
176610
  let envDirs = [];
176495
176611
  try {
176496
- const entries = await fs2.readdirWithTypes(qawolfPath);
176612
+ const entries = await fs3.readdirWithTypes(qawolfPath);
176497
176613
  envDirs = entries.filter((e) => e.isDirectory()).map((e) => join15(qawolfPath, e.name));
176498
176614
  } catch {}
176499
176615
  return [cwd, ...envDirs];
176500
176616
  }
176501
- async function expandPatterns(patterns, cwd, logger, fs2) {
176617
+ async function expandPatterns(patterns, cwd, logger, fs3) {
176502
176618
  logger?.debug(`expandPatterns: ${patterns.join(", ")}`);
176503
176619
  const effectivePatterns = patterns.length > 0 ? patterns : ["**/*.flow.{ts,js}"];
176504
- const roots = await resolveGlobRoots(cwd, fs2);
176620
+ const roots = await resolveGlobRoots(cwd, fs3);
176505
176621
  const seen = new Set;
176506
176622
  for (const root of roots) {
176507
176623
  const matches = await glob(effectivePatterns, {
@@ -176564,40 +176680,40 @@ function runStagingRoot() {
176564
176680
  function managedEnvDir() {
176565
176681
  return join16(managedEnvBaseDir(), managedEnvHash());
176566
176682
  }
176567
- async function scaffoldManagedEnv(dir, fs2) {
176568
- await fs2.mkdir(dir, { recursive: true });
176683
+ async function scaffoldManagedEnv(dir, fs3) {
176684
+ await fs3.mkdir(dir, { recursive: true });
176569
176685
  const dependencies = Object.fromEntries(pinnedPackages.map(({ name, version: version2 }) => [name, version2]));
176570
- await fs2.writeFile(join16(dir, "package.json"), JSON.stringify({ name: "qawolf-runtime", private: true, dependencies }, undefined, 2));
176571
- await fs2.writeFile(join16(dir, ".npmrc"), `@qawolf:registry=https://registry.npmjs.org/
176686
+ await fs3.writeFile(join16(dir, "package.json"), JSON.stringify({ name: "qawolf-runtime", private: true, dependencies }, undefined, 2));
176687
+ await fs3.writeFile(join16(dir, ".npmrc"), `@qawolf:registry=https://registry.npmjs.org/
176572
176688
  `);
176573
176689
  }
176574
176690
 
176575
176691
  // src/domains/runtimeEnv/clearRuntimeEnv.ts
176576
176692
  var runtimeSentinel = "qawolf-runtime";
176577
- async function clearRuntimeEnv(fs2) {
176693
+ async function clearRuntimeEnv(fs3) {
176578
176694
  const dir = managedEnvBaseDir();
176579
- const existed = await fs2.pathExists(dir);
176695
+ const existed = await fs3.pathExists(dir);
176580
176696
  if (!existed)
176581
176697
  return { dir, existed };
176582
- if (!await isManagedRuntimeBase(dir, fs2)) {
176698
+ if (!await isManagedRuntimeBase(dir, fs3)) {
176583
176699
  throw new Error(`Refusing to delete ${dir}: it does not look like a QA Wolf managed ` + `runtime directory (expected only ${runtimeSentinel} hash dirs). ` + `Check your QAWOLF_RUNTIME_DIR override.`);
176584
176700
  }
176585
- await fs2.rm(dir, { recursive: true, force: true });
176701
+ await fs3.rm(dir, { recursive: true, force: true });
176586
176702
  return { dir, existed };
176587
176703
  }
176588
- async function isManagedRuntimeBase(dir, fs2) {
176589
- const entries = await fs2.readdirWithTypes(dir);
176704
+ async function isManagedRuntimeBase(dir, fs3) {
176705
+ const entries = await fs3.readdirWithTypes(dir);
176590
176706
  for (const entry of entries) {
176591
176707
  if (!entry.isDirectory())
176592
176708
  return false;
176593
- if (!await hasRuntimeSentinel(join17(dir, entry.name), fs2))
176709
+ if (!await hasRuntimeSentinel(join17(dir, entry.name), fs3))
176594
176710
  return false;
176595
176711
  }
176596
176712
  return true;
176597
176713
  }
176598
- async function hasRuntimeSentinel(hashDir, fs2) {
176714
+ async function hasRuntimeSentinel(hashDir, fs3) {
176599
176715
  try {
176600
- const pkg = JSON.parse(await fs2.readFile(join17(hashDir, "package.json")));
176716
+ const pkg = JSON.parse(await fs3.readFile(join17(hashDir, "package.json")));
176601
176717
  return pkg.name === runtimeSentinel;
176602
176718
  } catch {
176603
176719
  return false;
@@ -176672,10 +176788,10 @@ function spawnNpmInstall(cwd, spawn2 = spawn) {
176672
176788
 
176673
176789
  // src/domains/runtimeEnv/resolvePinned.ts
176674
176790
  import { join as join18 } from "node:path";
176675
- function readInstalledVersion(dir, pkgName, fs2) {
176791
+ function readInstalledVersion(dir, pkgName, fs3) {
176676
176792
  try {
176677
176793
  const pkgPath = join18(dir, "node_modules", ...pkgName.split("/"), "package.json");
176678
- const raw = JSON.parse(fs2.readFileSync(pkgPath));
176794
+ const raw = JSON.parse(fs3.readFileSync(pkgPath));
176679
176795
  const { version: version2 } = raw;
176680
176796
  return typeof version2 === "string" ? version2 : undefined;
176681
176797
  } catch {
@@ -176696,16 +176812,16 @@ var shims = [
176696
176812
  candidates: appiumCliCandidates
176697
176813
  }
176698
176814
  ];
176699
- function pinnedResolutionFailures(dir, fs2, platform) {
176815
+ function pinnedResolutionFailures(dir, fs3, platform) {
176700
176816
  const failures = [];
176701
176817
  for (const { name, version: version2 } of pinnedPackages) {
176702
- const installed = readInstalledVersion(dir, name, fs2);
176818
+ const installed = readInstalledVersion(dir, name, fs3);
176703
176819
  if (installed !== version2) {
176704
176820
  failures.push({ kind: "package", name, pinned: version2, installed });
176705
176821
  }
176706
176822
  }
176707
176823
  for (const { name, display, candidates } of shims) {
176708
- if (!candidates(dir, platform).some((p2) => fs2.existsSync(p2))) {
176824
+ if (!candidates(dir, platform).some((p2) => fs3.existsSync(p2))) {
176709
176825
  failures.push({ kind: "shim", name, display });
176710
176826
  }
176711
176827
  }
@@ -176717,8 +176833,8 @@ function describePinnedFailure(failure) {
176717
176833
  }
176718
176834
  return failure.installed === undefined ? `${failure.name} (missing, pinned ${failure.pinned})` : `${failure.name} ${failure.installed} (pinned ${failure.pinned})`;
176719
176835
  }
176720
- function allPinnedResolved(dir, fs2, platform) {
176721
- return pinnedResolutionFailures(dir, fs2, platform).length === 0;
176836
+ function allPinnedResolved(dir, fs3, platform) {
176837
+ return pinnedResolutionFailures(dir, fs3, platform).length === 0;
176722
176838
  }
176723
176839
 
176724
176840
  // src/domains/runtimeEnv/shimDeps.ts
@@ -176750,7 +176866,7 @@ function normalizeExports(exports) {
176750
176866
  }
176751
176867
  return;
176752
176868
  }
176753
- function resolveFromEnvDir(envDir, specifier, preference = "esm", fs2 = makeDefaultFs()) {
176869
+ function resolveFromEnvDir(envDir, specifier, preference = "esm", fs3 = makeDefaultFs()) {
176754
176870
  const isScoped = specifier.startsWith("@");
176755
176871
  const parts = specifier.split("/");
176756
176872
  const pkgPartCount = isScoped ? 2 : 1;
@@ -176760,7 +176876,7 @@ function resolveFromEnvDir(envDir, specifier, preference = "esm", fs2 = makeDefa
176760
176876
  const pkgDir = join19(envDir, "node_modules", ...pkgName.split("/"));
176761
176877
  let pkg;
176762
176878
  try {
176763
- pkg = JSON.parse(fs2.readFileSync(join19(pkgDir, "package.json")));
176879
+ pkg = JSON.parse(fs3.readFileSync(join19(pkgDir, "package.json")));
176764
176880
  } catch (err) {
176765
176881
  if (isNoEntError(err))
176766
176882
  throw new Error(`Package '${pkgName}' not found in ${join19(envDir, "node_modules")}`, { cause: err });
@@ -176776,9 +176892,9 @@ function resolveFromEnvDir(envDir, specifier, preference = "esm", fs2 = makeDefa
176776
176892
  }
176777
176893
 
176778
176894
  // src/domains/runtimeEnv/shimDeps.ts
176779
- function readShimMarker(shimDir, fs2) {
176895
+ function readShimMarker(shimDir, fs3) {
176780
176896
  try {
176781
- const pkg = JSON.parse(fs2.readFileSync(join20(shimDir, "package.json")));
176897
+ const pkg = JSON.parse(fs3.readFileSync(join20(shimDir, "package.json")));
176782
176898
  if (pkg._qawolf_format) {
176783
176899
  return {
176784
176900
  _qawolf_version: pkg._qawolf_version ?? "",
@@ -176793,42 +176909,42 @@ function resolveBunBuild(bunBuild) {
176793
176909
  return globalThis.Bun;
176794
176910
  return bunBuild === false ? undefined : { build: bunBuild };
176795
176911
  }
176796
- async function removeStaleShims(flowsDir, flowsDeps, fs2) {
176912
+ async function removeStaleShims(flowsDir, flowsDeps, fs3) {
176797
176913
  const shimsDir = join20(flowsDir, "node_modules");
176798
- if (!fs2.existsSync(shimsDir))
176914
+ if (!fs3.existsSync(shimsDir))
176799
176915
  return;
176800
176916
  for (const dep of flowsDeps) {
176801
176917
  const shimDepDir = join20(shimsDir, ...dep.split("/"));
176802
- if (readShimMarker(shimDepDir, fs2)) {
176803
- await fs2.rm(shimDepDir, { recursive: true, force: true });
176918
+ if (readShimMarker(shimDepDir, fs3)) {
176919
+ await fs3.rm(shimDepDir, { recursive: true, force: true });
176804
176920
  }
176805
176921
  }
176806
176922
  }
176807
176923
  async function buildDepShim(args) {
176808
- const { envDir, flowsDir, dep, fs: fs2, build: build2 } = args;
176924
+ const { envDir, flowsDir, dep, fs: fs3, build: build2 } = args;
176809
176925
  const depParts = dep.split("/");
176810
176926
  const depDir = join20(envDir, "node_modules", ...depParts);
176811
- if (!fs2.existsSync(depDir))
176927
+ if (!fs3.existsSync(depDir))
176812
176928
  return;
176813
176929
  let depVersion;
176814
176930
  try {
176815
- const pkg = JSON.parse(fs2.readFileSync(join20(depDir, "package.json")));
176931
+ const pkg = JSON.parse(fs3.readFileSync(join20(depDir, "package.json")));
176816
176932
  depVersion = pkg.version ?? "unknown";
176817
176933
  } catch {
176818
176934
  depVersion = "unknown";
176819
176935
  }
176820
176936
  const shimDir = join20(flowsDir, "node_modules", ...depParts);
176821
- if (fs2.existsSync(shimDir)) {
176822
- const marker = readShimMarker(shimDir, fs2);
176937
+ if (fs3.existsSync(shimDir)) {
176938
+ const marker = readShimMarker(shimDir, fs3);
176823
176939
  if (!marker)
176824
176940
  return;
176825
176941
  if (marker._qawolf_version === depVersion && marker._qawolf_format === "bun-build-v1")
176826
176942
  return;
176827
- await fs2.rm(shimDir, { recursive: true, force: true });
176943
+ await fs3.rm(shimDir, { recursive: true, force: true });
176828
176944
  }
176829
176945
  let entry;
176830
176946
  try {
176831
- entry = resolveFromEnvDir(envDir, dep, "cjs", fs2);
176947
+ entry = resolveFromEnvDir(envDir, dep, "cjs", fs3);
176832
176948
  } catch {
176833
176949
  return;
176834
176950
  }
@@ -176843,32 +176959,32 @@ async function buildDepShim(args) {
176843
176959
  throw new Error(`bun.build failed to shim ${dep}: ${logs}`);
176844
176960
  }
176845
176961
  const shimCode = await output.text();
176846
- await fs2.mkdir(shimDir, { recursive: true });
176847
- await fs2.writeFile(join20(shimDir, "package.json"), JSON.stringify({
176962
+ await fs3.mkdir(shimDir, { recursive: true });
176963
+ await fs3.writeFile(join20(shimDir, "package.json"), JSON.stringify({
176848
176964
  name: dep,
176849
176965
  _qawolf_version: depVersion,
176850
176966
  _qawolf_format: "bun-build-v1"
176851
176967
  }));
176852
- await fs2.writeFile(join20(shimDir, "index.js"), shimCode);
176968
+ await fs3.writeFile(join20(shimDir, "index.js"), shimCode);
176853
176969
  }
176854
- async function shimFlowsDeps(envDir, fs2 = makeDefaultFs(), bunBuild) {
176970
+ async function shimFlowsDeps(envDir, fs3 = makeDefaultFs(), bunBuild) {
176855
176971
  const flowsDir = join20(envDir, "node_modules", "@qawolf", "flows");
176856
- if (!fs2.existsSync(flowsDir))
176972
+ if (!fs3.existsSync(flowsDir))
176857
176973
  return;
176858
176974
  let flowsDeps;
176859
176975
  try {
176860
- const flowsPkg = JSON.parse(fs2.readFileSync(join20(flowsDir, "package.json")));
176976
+ const flowsPkg = JSON.parse(fs3.readFileSync(join20(flowsDir, "package.json")));
176861
176977
  flowsDeps = Object.keys(flowsPkg.dependencies ?? {});
176862
176978
  } catch {
176863
176979
  return;
176864
176980
  }
176865
176981
  const bun = resolveBunBuild(bunBuild);
176866
176982
  if (!bun) {
176867
- await removeStaleShims(flowsDir, flowsDeps, fs2);
176983
+ await removeStaleShims(flowsDir, flowsDeps, fs3);
176868
176984
  return;
176869
176985
  }
176870
176986
  for (const dep of flowsDeps) {
176871
- await buildDepShim({ envDir, flowsDir, dep, fs: fs2, build: bun.build });
176987
+ await buildDepShim({ envDir, flowsDir, dep, fs: fs3, build: bun.build });
176872
176988
  }
176873
176989
  }
176874
176990
 
@@ -176901,15 +177017,15 @@ async function installPinned(targetDir, deps) {
176901
177017
 
176902
177018
  // src/domains/runtimeEnv/ensureRuntimeEnv.ts
176903
177019
  async function ensureRuntimeEnv(args, deps = {}) {
176904
- const fs2 = deps.fs ?? makeDefaultFs();
177020
+ const fs3 = deps.fs ?? makeDefaultFs();
176905
177021
  const resolveManagedDir = deps.resolveManagedDir ?? managedEnvDir;
176906
177022
  const install = deps.install ?? ((t2) => installPinned(t2, {
176907
- fs: fs2,
177023
+ fs: fs3,
176908
177024
  spawnInstall: defaultSpawnInstall,
176909
177025
  platform: args.platform
176910
177026
  }));
176911
177027
  if (args.overrideDir !== undefined) {
176912
- const failures = pinnedResolutionFailures(args.overrideDir, fs2, args.platform);
177028
+ const failures = pinnedResolutionFailures(args.overrideDir, fs3, args.platform);
176913
177029
  if (failures.length === 0) {
176914
177030
  return {
176915
177031
  depsRoot: args.overrideDir,
@@ -176919,27 +177035,27 @@ async function ensureRuntimeEnv(args, deps = {}) {
176919
177035
  }
176920
177036
  throw new Error(runnerMessages.depsDirIncomplete(args.overrideDir, failures.map(describePinnedFailure)));
176921
177037
  }
176922
- if (args.projectDir !== undefined && allPinnedResolved(args.projectDir, fs2, args.platform)) {
177038
+ if (args.projectDir !== undefined && allPinnedResolved(args.projectDir, fs3, args.platform)) {
176923
177039
  return { depsRoot: args.projectDir, source: "project", installed: false };
176924
177040
  }
176925
177041
  const managed = resolveManagedDir();
176926
- if (allPinnedResolved(managed, fs2, args.platform)) {
177042
+ if (allPinnedResolved(managed, fs3, args.platform)) {
176927
177043
  return { depsRoot: managed, source: "managed", installed: false };
176928
177044
  }
176929
177045
  await install(managed);
176930
- if (!allPinnedResolved(managed, fs2, args.platform)) {
177046
+ if (!allPinnedResolved(managed, fs3, args.platform)) {
176931
177047
  throw new Error(`Managed runtime is incomplete after install at ${managed}.`);
176932
177048
  }
176933
177049
  return { depsRoot: managed, source: "managed", installed: true };
176934
177050
  }
176935
177051
  // src/domains/runtimeEnv/resolveDepsRootIfPresent.ts
176936
- function resolveDepsRootIfPresent(args, fs2 = makeDefaultFs()) {
176937
- if (args.overrideDir !== undefined && allPinnedResolved(args.overrideDir, fs2, args.platform))
177052
+ function resolveDepsRootIfPresent(args, fs3 = makeDefaultFs()) {
177053
+ if (args.overrideDir !== undefined && allPinnedResolved(args.overrideDir, fs3, args.platform))
176938
177054
  return args.overrideDir;
176939
- if (args.projectDir !== undefined && allPinnedResolved(args.projectDir, fs2, args.platform))
177055
+ if (args.projectDir !== undefined && allPinnedResolved(args.projectDir, fs3, args.platform))
176940
177056
  return args.projectDir;
176941
177057
  const managed = managedEnvDir();
176942
- if (allPinnedResolved(managed, fs2, args.platform))
177058
+ if (allPinnedResolved(managed, fs3, args.platform))
176943
177059
  return managed;
176944
177060
  return;
176945
177061
  }
@@ -176961,16 +177077,16 @@ async function collectRequiredAvds(files, peekFlowMeta) {
176961
177077
  return [...seen];
176962
177078
  }
176963
177079
  async function handleDoctor(ctx, opts) {
176964
- const { fs: fs2 } = ctx;
177080
+ const { fs: fs3 } = ctx;
176965
177081
  const cwd = process.cwd();
176966
- const flowFiles = await expandPatterns([], cwd, undefined, fs2);
176967
- const projectDir = resolveProjectDirSafe([...flowFiles], fs2);
177082
+ const flowFiles = await expandPatterns([], cwd, undefined, fs3);
177083
+ const projectDir = resolveProjectDirSafe([...flowFiles], fs3);
176968
177084
  const envDir = resolveDepsRootIfPresent({
176969
177085
  platform: process.platform,
176970
177086
  ...projectDir !== undefined ? { projectDir } : {}
176971
- }, fs2);
176972
- const resolved = await resolveApiKey(ctx.configDir, fs2);
176973
- const requiredAvds = await collectRequiredAvds(flowFiles, makePeekFlowMeta(fs2));
177087
+ }, fs3);
177088
+ const resolved = await resolveApiKey(ctx.configDir, fs3);
177089
+ const requiredAvds = await collectRequiredAvds(flowFiles, makePeekFlowMeta(fs3));
176974
177090
  const runAndroidChecks = opts.all || requiredAvds.length > 0;
176975
177091
  const cliCheck = {
176976
177092
  name: "qawolf",
@@ -177074,11 +177190,11 @@ async function flowsList(ctx, pattern, deps) {
177074
177190
  ctx.ui.outro(flowsMessages.flowCount(items.length));
177075
177191
  }
177076
177192
  function handleFlowsList(ctx, pattern) {
177077
- const { fs: fs2 } = ctx;
177193
+ const { fs: fs3 } = ctx;
177078
177194
  return flowsList(ctx, pattern, {
177079
177195
  cwd: process.cwd(),
177080
- expandPatterns: (patterns, cwd) => expandPatterns(patterns, cwd, undefined, fs2),
177081
- peekFlowMeta: makePeekFlowMeta(fs2)
177196
+ expandPatterns: (patterns, cwd) => expandPatterns(patterns, cwd, undefined, fs3),
177197
+ peekFlowMeta: makePeekFlowMeta(fs3)
177082
177198
  });
177083
177199
  }
177084
177200
 
@@ -177089,9 +177205,8 @@ async function flowsListRemote(ctx, pattern, options) {
177089
177205
  environmentId: options.env,
177090
177206
  includeDrafts: options.includeDrafts
177091
177207
  });
177092
- if (!result.ok) {
177093
- return { error: result.error };
177094
- }
177208
+ if (!result.ok)
177209
+ return failureFields(result);
177095
177210
  const matches = pattern ? import_picomatch2.default(pattern) : undefined;
177096
177211
  const items = result.value.flows.filter((f2) => !matches || matches(f2.path)).map((f2) => ({
177097
177212
  flowId: f2.flowId,
@@ -177144,10 +177259,10 @@ var manifestSchema = exports_external.object({
177144
177259
  qawolfCommittedAt: exports_external.string().optional(),
177145
177260
  flows: exports_external.array(flowEntrySchema)
177146
177261
  });
177147
- async function readManifest(envDir, fs2 = makeDefaultFs()) {
177262
+ async function readManifest(envDir, fs3 = makeDefaultFs()) {
177148
177263
  let raw;
177149
177264
  try {
177150
- raw = await fs2.readFile(join21(envDir, manifestFilename));
177265
+ raw = await fs3.readFile(join21(envDir, manifestFilename));
177151
177266
  } catch (err) {
177152
177267
  if (isNoEntError(err))
177153
177268
  return "missing";
@@ -177173,15 +177288,15 @@ async function readManifest(envDir, fs2 = makeDefaultFs()) {
177173
177288
  flows: result.data.flows
177174
177289
  };
177175
177290
  }
177176
- async function writeManifest(envDir, manifest, fs2 = makeDefaultFs()) {
177291
+ async function writeManifest(envDir, manifest, fs3 = makeDefaultFs()) {
177177
177292
  const body = JSON.stringify(manifest, undefined, 2);
177178
- await fs2.writeFile(join21(envDir, manifestFilename), `${body}
177293
+ await fs3.writeFile(join21(envDir, manifestFilename), `${body}
177179
177294
  `);
177180
177295
  }
177181
- function hashFile(absPath, fs2 = makeDefaultFs()) {
177296
+ function hashFile(absPath, fs3 = makeDefaultFs()) {
177182
177297
  return new Promise((resolve5, reject) => {
177183
177298
  const hash2 = createHash2("sha256");
177184
- const stream = fs2.createReadStream(absPath);
177299
+ const stream = fs3.createReadStream(absPath);
177185
177300
  stream.on("data", (chunk) => hash2.update(chunk));
177186
177301
  stream.on("end", () => resolve5(hash2.digest("hex")));
177187
177302
  stream.on("error", reject);
@@ -177311,25 +177426,25 @@ async function checkSafety(args) {
177311
177426
 
177312
177427
  // src/domains/flows/pull/bundle.ts
177313
177428
  import { join as join22, relative as relative4 } from "node:path";
177314
- async function flattenSingleWrapper(dir, fs2 = makeDefaultFs()) {
177315
- const entries = await fs2.readdir(dir);
177429
+ async function flattenSingleWrapper(dir, fs3 = makeDefaultFs()) {
177430
+ const entries = await fs3.readdir(dir);
177316
177431
  if (entries.length !== 1)
177317
177432
  return;
177318
177433
  const innerName = entries[0];
177319
177434
  if (!innerName)
177320
177435
  return;
177321
177436
  const inner = join22(dir, innerName);
177322
- const innerStat = await fs2.stat(inner);
177437
+ const innerStat = await fs3.stat(inner);
177323
177438
  if (!innerStat.isDirectory())
177324
177439
  return;
177325
- for (const e of await fs2.readdir(inner)) {
177326
- await fs2.rename(join22(inner, e), join22(dir, e));
177440
+ for (const e of await fs3.readdir(inner)) {
177441
+ await fs3.rename(join22(inner, e), join22(dir, e));
177327
177442
  }
177328
- const leftovers = await fs2.readdir(inner);
177443
+ const leftovers = await fs3.readdir(inner);
177329
177444
  if (leftovers.length > 0) {
177330
177445
  throw new Error(`flattenSingleWrapper: ${leftovers.length} unexpected item(s) remain in wrapper dir`);
177331
177446
  }
177332
- await fs2.rm(inner, { recursive: true });
177447
+ await fs3.rm(inner, { recursive: true });
177333
177448
  return innerName;
177334
177449
  }
177335
177450
  function extractQawolfCommitSha(wrapperName) {
@@ -177338,11 +177453,11 @@ function extractQawolfCommitSha(wrapperName) {
177338
177453
  return /-([0-9a-f]{40})$/i.exec(wrapperName)?.[1];
177339
177454
  }
177340
177455
  var flowExtensions = [".flow.ts", ".flow.js"];
177341
- async function buildManifest(args, fs2 = makeDefaultFs()) {
177342
- const flowPaths = await walkForFlows(args.bundleDir, fs2);
177456
+ async function buildManifest(args, fs3 = makeDefaultFs()) {
177457
+ const flowPaths = await walkForFlows(args.bundleDir, fs3);
177343
177458
  const flows = await Promise.all(flowPaths.map(async (rel) => ({
177344
177459
  path: rel,
177345
- contentHash: await hashFile(join22(args.bundleDir, rel), fs2)
177460
+ contentHash: await hashFile(join22(args.bundleDir, rel), fs3)
177346
177461
  })));
177347
177462
  return {
177348
177463
  envId: args.envId,
@@ -177355,28 +177470,28 @@ async function buildManifest(args, fs2 = makeDefaultFs()) {
177355
177470
  flows
177356
177471
  };
177357
177472
  }
177358
- async function walkForFlows(root, fs2) {
177473
+ async function walkForFlows(root, fs3) {
177359
177474
  const out = [];
177360
- await walk(root, root, out, fs2);
177475
+ await walk(root, root, out, fs3);
177361
177476
  return out.sort();
177362
177477
  }
177363
- async function walk(current, root, out, fs2) {
177364
- const entries = await fs2.readdirWithTypes(current);
177478
+ async function walk(current, root, out, fs3) {
177479
+ const entries = await fs3.readdirWithTypes(current);
177365
177480
  for (const e of entries) {
177366
177481
  const abs = join22(current, e.name);
177367
177482
  if (e.isDirectory()) {
177368
- await walk(abs, root, out, fs2);
177483
+ await walk(abs, root, out, fs3);
177369
177484
  } else if (e.isFile() && flowExtensions.some((ext) => e.name.endsWith(ext))) {
177370
177485
  out.push(relative4(root, abs));
177371
177486
  }
177372
177487
  }
177373
177488
  }
177374
- async function sampleQawolfCommittedAt(bundleDir, fs2 = makeDefaultFs()) {
177375
- const flowPaths = await walkForFlows(bundleDir, fs2);
177489
+ async function sampleQawolfCommittedAt(bundleDir, fs3 = makeDefaultFs()) {
177490
+ const flowPaths = await walkForFlows(bundleDir, fs3);
177376
177491
  const sample = flowPaths[0];
177377
177492
  if (!sample)
177378
177493
  return;
177379
- return (await fs2.stat(join22(bundleDir, sample))).mtime.toISOString();
177494
+ return (await fs3.stat(join22(bundleDir, sample))).mtime.toISOString();
177380
177495
  }
177381
177496
 
177382
177497
  // src/domains/flows/pull/applyTeamStorageRewrite.ts
@@ -177413,26 +177528,26 @@ function isSourceFile(name) {
177413
177528
  function isFlowFile(name) {
177414
177529
  return flowExtensions2.some((ext) => name.endsWith(ext));
177415
177530
  }
177416
- async function walk2(dir, out, fs2) {
177417
- const entries = await fs2.readdirWithTypes(dir);
177531
+ async function walk2(dir, out, fs3) {
177532
+ const entries = await fs3.readdirWithTypes(dir);
177418
177533
  for (const e of entries) {
177419
177534
  const abs = join23(dir, e.name);
177420
177535
  if (e.isDirectory()) {
177421
- await walk2(abs, out, fs2);
177536
+ await walk2(abs, out, fs3);
177422
177537
  } else if (e.isFile() && isSourceFile(e.name)) {
177423
177538
  out.push(abs);
177424
177539
  }
177425
177540
  }
177426
177541
  }
177427
- async function applyTeamStorageRewrite(rootDir, fs2 = makeDefaultFs()) {
177542
+ async function applyTeamStorageRewrite(rootDir, fs3 = makeDefaultFs()) {
177428
177543
  const files = [];
177429
- await walk2(rootDir, files, fs2);
177544
+ await walk2(rootDir, files, fs3);
177430
177545
  const results = await Promise.all(files.map(async (file2) => {
177431
- const source = await fs2.readFile(file2);
177546
+ const source = await fs3.readFile(file2);
177432
177547
  const result = rewriteTeamStorage(source);
177433
177548
  const finalSource = result.rewrites > 0 ? result.source : source;
177434
177549
  if (result.rewrites > 0) {
177435
- await fs2.writeFile(file2, finalSource);
177550
+ await fs3.writeFile(file2, finalSource);
177436
177551
  }
177437
177552
  if (isFlowFile(file2) && finalSource.includes("process.env.TEAM_STORAGE_DIR")) {
177438
177553
  return relative5(rootDir, file2);
@@ -177506,10 +177621,10 @@ function unquote(escaped) {
177506
177621
  }
177507
177622
 
177508
177623
  // src/domains/flows/pull/envVars.ts
177509
- async function writeEnvFile(envDir, vars, fs2 = makeDefaultFs()) {
177624
+ async function writeEnvFile(envDir, vars, fs3 = makeDefaultFs()) {
177510
177625
  if (Object.keys(vars).length === 0)
177511
177626
  return;
177512
- await fs2.writeFile(join24(envDir, ".env"), serializeDotenv(vars), {
177627
+ await fs3.writeFile(join24(envDir, ".env"), serializeDotenv(vars), {
177513
177628
  mode: 384
177514
177629
  });
177515
177630
  }
@@ -179546,7 +179661,7 @@ var hs = Symbol("jobDone");
179546
179661
  var li = Symbol("addFSEntry");
179547
179662
  var sr = Symbol("addTarEntry");
179548
179663
  var cs = Symbol("stat");
179549
- var fs2 = Symbol("readdir");
179664
+ var fs3 = Symbol("readdir");
179550
179665
  var ci = Symbol("onreaddir");
179551
179666
  var fi = Symbol("pipe");
179552
179667
  var rr = Symbol("entry");
@@ -179641,7 +179756,7 @@ var wt = class extends A2 {
179641
179756
  }
179642
179757
  this[Ct]();
179643
179758
  }
179644
- [fs2](t2) {
179759
+ [fs3](t2) {
179645
179760
  t2.pending = true, this[G] += 1, ui.readdir(t2.absolute, (e, i2) => {
179646
179761
  if (t2.pending = false, this[G] -= 1, e)
179647
179762
  return this.emit("error", e);
@@ -179691,7 +179806,7 @@ var wt = class extends A2 {
179691
179806
  if (t2.stat && !t2.ignore) {
179692
179807
  if (!this.noDirRecurse && t2.stat.isDirectory() && !t2.readdir) {
179693
179808
  let e = this.readdirCache.get(t2.absolute);
179694
- if (e ? this[ci](t2, e) : this[fs2](t2), !t2.readdir)
179809
+ if (e ? this[ci](t2, e) : this[fs3](t2), !t2.readdir)
179695
179810
  return;
179696
179811
  }
179697
179812
  if (t2.entry = this[rr](t2), !t2.entry) {
@@ -179748,7 +179863,7 @@ var kt = class extends wt {
179748
179863
  let e = this.follow ? "statSync" : "lstatSync";
179749
179864
  this[ai](t2, ui[e](t2.absolute));
179750
179865
  }
179751
- [fs2](t2) {
179866
+ [fs3](t2) {
179752
179867
  this[ci](t2, ui.readdirSync(t2.absolute));
179753
179868
  }
179754
179869
  [fi](t2) {
@@ -180709,16 +180824,16 @@ function checkEntrySize(args) {
180709
180824
  // src/domains/flows/pull/extract.ts
180710
180825
  var defaultMaxEntryBytes = 50 * 1024 * 1024;
180711
180826
  var defaultMaxTotalBytes = 500 * 1024 * 1024;
180712
- async function extractTarGz(tgzPath, destDir, opts = {}, fs3 = makeDefaultFs()) {
180827
+ async function extractTarGz(tgzPath, destDir, opts = {}, fs4 = makeDefaultFs()) {
180713
180828
  const maxEntryBytes = opts.maxEntryBytes ?? defaultMaxEntryBytes;
180714
180829
  const maxTotalBytes = opts.maxTotalBytes ?? defaultMaxTotalBytes;
180715
- await fs3.mkdir(destDir, { recursive: true });
180830
+ await fs4.mkdir(destDir, { recursive: true });
180716
180831
  const destResolved = resolve7(destDir);
180717
180832
  return new Promise((resolveOuter, rejectOuter) => {
180718
180833
  let total = 0;
180719
180834
  let aborted2 = false;
180720
180835
  const pending = [];
180721
- const rs2 = fs3.createReadStream(tgzPath);
180836
+ const rs2 = fs4.createReadStream(tgzPath);
180722
180837
  const gz = createGunzip();
180723
180838
  const parser = new st({ strict: true });
180724
180839
  const abort = (err) => {
@@ -180742,7 +180857,7 @@ async function extractTarGz(tgzPath, destDir, opts = {}, fs3 = makeDefaultFs())
180742
180857
  maxTotalBytes,
180743
180858
  addTotal: (n2) => total += n2,
180744
180859
  getTotal: () => total,
180745
- fs: fs3
180860
+ fs: fs4
180746
180861
  }).catch((err) => {
180747
180862
  abort(err instanceof Error ? err : new Error(String(err)));
180748
180863
  });
@@ -180807,7 +180922,7 @@ function mintTempPath(destAbs, kind, registry2) {
180807
180922
  registry2.minted.add(path3);
180808
180923
  return path3;
180809
180924
  }
180810
- async function removeTempDir(absPath, registry2, fs3 = makeDefaultFs()) {
180925
+ async function removeTempDir(absPath, registry2, fs4 = makeDefaultFs()) {
180811
180926
  if (!absPath || !isAbsolute4(absPath)) {
180812
180927
  throw new Error(`removeTempDir refused: not an absolute path (${absPath})`);
180813
180928
  }
@@ -180817,24 +180932,24 @@ async function removeTempDir(absPath, registry2, fs3 = makeDefaultFs()) {
180817
180932
  if (!registry2.minted.has(absPath)) {
180818
180933
  throw new Error(`removeTempDir refused: not minted in this registry`);
180819
180934
  }
180820
- await fs3.rm(absPath, { recursive: true, force: true });
180935
+ await fs4.rm(absPath, { recursive: true, force: true });
180821
180936
  registry2.minted.delete(absPath);
180822
180937
  }
180823
180938
 
180824
180939
  // src/domains/flows/pull/stage.ts
180825
- async function stageBundle(args, fs3 = makeDefaultFs()) {
180940
+ async function stageBundle(args, fs4 = makeDefaultFs()) {
180826
180941
  const registry2 = createTempPathRegistry();
180827
180942
  const tmpDir = mintTempPath(args.destAbs, "pull", registry2);
180828
180943
  try {
180829
- await extractTarGz(args.tmpArchive, tmpDir, {}, fs3);
180830
- const wrapperName = await flattenSingleWrapper(tmpDir, fs3);
180831
- const qawolfCommittedAt = await sampleQawolfCommittedAt(tmpDir, fs3);
180832
- const { flowsWithTeamStorageRefs } = await applyTeamStorageRewrite(tmpDir, fs3);
180944
+ await extractTarGz(args.tmpArchive, tmpDir, {}, fs4);
180945
+ const wrapperName = await flattenSingleWrapper(tmpDir, fs4);
180946
+ const qawolfCommittedAt = await sampleQawolfCommittedAt(tmpDir, fs4);
180947
+ const { flowsWithTeamStorageRefs } = await applyTeamStorageRewrite(tmpDir, fs4);
180833
180948
  const effectiveEnvVars = {
180834
180949
  ...args.envVars,
180835
180950
  TEAM_STORAGE_DIR: args.assetsAbs
180836
180951
  };
180837
- await writeEnvFile(tmpDir, effectiveEnvVars, fs3);
180952
+ await writeEnvFile(tmpDir, effectiveEnvVars, fs4);
180838
180953
  const manifest = await buildManifest({
180839
180954
  envId: args.envId,
180840
180955
  bundleDir: tmpDir,
@@ -180843,22 +180958,22 @@ async function stageBundle(args, fs3 = makeDefaultFs()) {
180843
180958
  envVarsFetchedAt: args.envVarsFetchedAt,
180844
180959
  wrapperName,
180845
180960
  qawolfCommittedAt
180846
- }, fs3);
180847
- await writeManifest(tmpDir, manifest, fs3);
180961
+ }, fs4);
180962
+ await writeManifest(tmpDir, manifest, fs4);
180848
180963
  let oldDir;
180849
180964
  try {
180850
- if (await fs3.pathExists(args.destAbs)) {
180965
+ if (await fs4.pathExists(args.destAbs)) {
180851
180966
  oldDir = mintTempPath(args.destAbs, "old", registry2);
180852
- await fs3.rename(args.destAbs, oldDir);
180967
+ await fs4.rename(args.destAbs, oldDir);
180853
180968
  }
180854
- await fs3.rename(tmpDir, args.destAbs);
180969
+ await fs4.rename(tmpDir, args.destAbs);
180855
180970
  } catch (err) {
180856
180971
  if (oldDir)
180857
- await fs3.rename(oldDir, args.destAbs).catch(() => {});
180972
+ await fs4.rename(oldDir, args.destAbs).catch(() => {});
180858
180973
  throw err;
180859
180974
  }
180860
180975
  if (oldDir)
180861
- await removeTempDir(oldDir, registry2, fs3).catch(() => {});
180976
+ await removeTempDir(oldDir, registry2, fs4).catch(() => {});
180862
180977
  return {
180863
180978
  envDir: args.destAbs,
180864
180979
  flowCount: manifest.flows.length,
@@ -180866,7 +180981,7 @@ async function stageBundle(args, fs3 = makeDefaultFs()) {
180866
180981
  flowsWithTeamStorageRefs
180867
180982
  };
180868
180983
  } catch (err) {
180869
- await removeTempDir(tmpDir, registry2, fs3).catch(() => {});
180984
+ await removeTempDir(tmpDir, registry2, fs4).catch(() => {});
180870
180985
  throw err;
180871
180986
  }
180872
180987
  }
@@ -180924,8 +181039,10 @@ async function handleFlowsPull(ctx, opts, deps) {
180924
181039
  },
180925
181040
  {
180926
181041
  message: flowsMessages.pull.downloadingTeamStorageAssets,
180927
- task: async () => {
180928
- const result2 = await ctx.platformClient.syncTeamStorageAssets(assetsAbs);
181042
+ task: async (update) => {
181043
+ const result2 = await ctx.platformClient.syncTeamStorageAssets(assetsAbs, {
181044
+ onProgress: ({ current, total }) => update(flowsMessages.pull.downloadingTeamStorageAssetsProgress(current, total))
181045
+ });
180929
181046
  if (!result2.ok)
180930
181047
  throw new Error(result2.error);
180931
181048
  return result2.value;
@@ -180963,7 +181080,7 @@ var findContract = publicContractsV1.environment.find;
180963
181080
  async function pickEnvironment(deps) {
180964
181081
  const fetched = await fetchAllEnvironments(deps.platformClient);
180965
181082
  if (!fetched.ok)
180966
- return { kind: "error", error: fetched.error };
181083
+ return { ...failureFields(fetched), kind: "error" };
180967
181084
  const environments = fetched.environments;
180968
181085
  if (environments.length === 0) {
180969
181086
  return { kind: "error", error: environmentsMessages.noEnvironments };
@@ -181056,6 +181173,7 @@ async function resolveRef2(deps, ref) {
181056
181173
  });
181057
181174
  if (!result.ok) {
181058
181175
  return {
181176
+ ...failureFields(result),
181059
181177
  kind: "error",
181060
181178
  error: environmentsMessages.couldNotResolve(ref, result.error)
181061
181179
  };
@@ -181089,7 +181207,7 @@ function withResolvedEnv(signals, args, fn2) {
181089
181207
  return;
181090
181208
  }
181091
181209
  if (outcome.kind === "error") {
181092
- return { error: outcome.error };
181210
+ return failureFields(outcome);
181093
181211
  }
181094
181212
  return fn2(ctx, outcome.env);
181095
181213
  })(opts, command);
@@ -181649,16 +181767,16 @@ import { join as join26 } from "node:path";
181649
181767
  var flowSubpathImports = { "#playwright": "playwright" };
181650
181768
  var packageJsonSchema = exports_external.looseObject({ imports: exports_external.record(exports_external.string(), exports_external.unknown()).catch({}) }).catch({ imports: {} });
181651
181769
  async function writeExecSubpathImports(args) {
181652
- const { execDir, fs: fs3 } = args;
181770
+ const { execDir, fs: fs4 } = args;
181653
181771
  const pkgPath = join26(execDir, "package.json");
181654
- const pkg = packageJsonSchema.parse(await readPackageJson(pkgPath, fs3));
181772
+ const pkg = packageJsonSchema.parse(await readPackageJson(pkgPath, fs4));
181655
181773
  const merged = { ...pkg, imports: { ...pkg.imports, ...flowSubpathImports } };
181656
- await fs3.writeFile(pkgPath, JSON.stringify(merged, undefined, 2));
181774
+ await fs4.writeFile(pkgPath, JSON.stringify(merged, undefined, 2));
181657
181775
  }
181658
- async function readPackageJson(pkgPath, fs3) {
181776
+ async function readPackageJson(pkgPath, fs4) {
181659
181777
  let content;
181660
181778
  try {
181661
- content = await fs3.readFile(pkgPath);
181779
+ content = await fs4.readFile(pkgPath);
181662
181780
  } catch (err) {
181663
181781
  if (isNoEntError(err))
181664
181782
  return {};
@@ -181686,27 +181804,27 @@ async function createDirSymlink(source, target) {
181686
181804
 
181687
181805
  // src/domains/runtimeEnv/linkPinnedPackages.ts
181688
181806
  async function linkPinnedPackages(args) {
181689
- const { depsRoot, nodeModulesDir, fs: fs3 } = args;
181807
+ const { depsRoot, nodeModulesDir, fs: fs4 } = args;
181690
181808
  const managedModules = join27(depsRoot, "node_modules");
181691
- await fs3.mkdir(nodeModulesDir, { recursive: true });
181809
+ await fs4.mkdir(nodeModulesDir, { recursive: true });
181692
181810
  for (const { name } of pinnedPackages) {
181693
181811
  const segments = name.split("/");
181694
181812
  const target = join27(nodeModulesDir, ...segments);
181695
181813
  if (segments.length > 1) {
181696
- await fs3.mkdir(dirname8(target), { recursive: true });
181814
+ await fs4.mkdir(dirname8(target), { recursive: true });
181697
181815
  }
181698
- await fs3.rm(target, { recursive: true, force: true });
181816
+ await fs4.rm(target, { recursive: true, force: true });
181699
181817
  await createDirSymlink(join27(managedModules, ...segments), target);
181700
181818
  }
181701
181819
  }
181702
181820
 
181703
181821
  // src/domains/runtimeEnv/innerHop.ts
181704
181822
  async function populateInnerHop(args) {
181705
- const { depsRoot, execDir, fs: fs3 } = args;
181823
+ const { depsRoot, execDir, fs: fs4 } = args;
181706
181824
  await linkPinnedPackages({
181707
181825
  depsRoot,
181708
181826
  nodeModulesDir: join28(execDir, "node_modules"),
181709
- fs: fs3
181827
+ fs: fs4
181710
181828
  });
181711
181829
  }
181712
181830
 
@@ -181715,12 +181833,12 @@ import { lstat } from "node:fs/promises";
181715
181833
  import { dirname as dirname9, join as join29 } from "node:path";
181716
181834
  var executorPackageNames = new Set(pinnedPackages.map((p3) => p3.name));
181717
181835
  async function populateOuterHop(args) {
181718
- const { projectDir, runDir, fs: fs3 } = args;
181836
+ const { projectDir, runDir, fs: fs4 } = args;
181719
181837
  if (projectDir === undefined)
181720
181838
  return { mode: "none" };
181721
- const installableDeps = await readInstallableDeps(projectDir, fs3);
181839
+ const installableDeps = await readInstallableDeps(projectDir, fs4);
181722
181840
  const depNames = Object.keys(installableDeps);
181723
- const { satisfying, rejected } = await findSatisfyingNodeModulesDir(projectDir, depNames, fs3);
181841
+ const { satisfying, rejected } = await findSatisfyingNodeModulesDir(projectDir, depNames, fs4);
181724
181842
  if (satisfying !== undefined) {
181725
181843
  await createDirSymlink(satisfying, join29(runDir, "node_modules"));
181726
181844
  return { mode: "symlink", nodeModulesDir: satisfying };
@@ -181728,22 +181846,22 @@ async function populateOuterHop(args) {
181728
181846
  if (depNames.length === 0)
181729
181847
  return { mode: "none" };
181730
181848
  args.onInstallStart?.(depNames.length);
181731
- await installOuterDeps(runDir, installableDeps, fs3, args.install ?? spawnNpmInstall);
181849
+ await installOuterDeps(runDir, installableDeps, fs4, args.install ?? spawnNpmInstall);
181732
181850
  await linkPinnedPackages({
181733
181851
  depsRoot: args.depsRoot,
181734
181852
  nodeModulesDir: join29(runDir, "node_modules"),
181735
- fs: fs3
181853
+ fs: fs4
181736
181854
  });
181737
181855
  return { mode: "install", depCount: depNames.length, rejected };
181738
181856
  }
181739
- async function findSatisfyingNodeModulesDir(startDir, depNames, fs3) {
181857
+ async function findSatisfyingNodeModulesDir(startDir, depNames, fs4) {
181740
181858
  const rejected = [];
181741
181859
  let dir = startDir;
181742
181860
  while (true) {
181743
181861
  const candidate = join29(dir, "node_modules");
181744
181862
  const stats = await lstatSafe(candidate);
181745
181863
  if (stats !== undefined && stats.isDirectory() && !stats.isSymbolicLink()) {
181746
- const missing = depNames.filter((name) => !fs3.existsSync(join29(candidate, name, "package.json")));
181864
+ const missing = depNames.filter((name) => !fs4.existsSync(join29(candidate, name, "package.json")));
181747
181865
  if (missing.length === 0)
181748
181866
  return { satisfying: candidate, rejected };
181749
181867
  rejected.push({ dir: candidate, missing });
@@ -181761,10 +181879,10 @@ async function lstatSafe(path3) {
181761
181879
  return;
181762
181880
  }
181763
181881
  }
181764
- async function readInstallableDeps(projectDir, fs3) {
181882
+ async function readInstallableDeps(projectDir, fs4) {
181765
181883
  let content;
181766
181884
  try {
181767
- content = await fs3.readFile(join29(projectDir, "package.json"));
181885
+ content = await fs4.readFile(join29(projectDir, "package.json"));
181768
181886
  } catch {
181769
181887
  return {};
181770
181888
  }
@@ -181781,9 +181899,9 @@ async function readInstallableDeps(projectDir, fs3) {
181781
181899
  return {};
181782
181900
  return Object.fromEntries(Object.entries(rawDeps).filter(([name]) => !executorPackageNames.has(name)).filter((entry) => typeof entry[1] === "string"));
181783
181901
  }
181784
- async function installOuterDeps(runDir, deps, fs3, install) {
181785
- await fs3.writeFile(join29(runDir, "package.json"), JSON.stringify({ name: "qawolf-run", private: true, dependencies: deps }, undefined, 2));
181786
- await fs3.writeFile(join29(runDir, ".npmrc"), `@qawolf:registry=https://registry.npmjs.org/
181902
+ async function installOuterDeps(runDir, deps, fs4, install) {
181903
+ await fs4.writeFile(join29(runDir, "package.json"), JSON.stringify({ name: "qawolf-run", private: true, dependencies: deps }, undefined, 2));
181904
+ await fs4.writeFile(join29(runDir, ".npmrc"), `@qawolf:registry=https://registry.npmjs.org/
181787
181905
  `);
181788
181906
  const result = await install(runDir);
181789
181907
  if (result.exitCode !== 0) {
@@ -181809,23 +181927,23 @@ async function copyDirExcluding(source, destination, excludedNames) {
181809
181927
  // src/domains/runtimeEnv/stageFlowFiles.ts
181810
181928
  var excludedDirs = new Set(["node_modules", ".git", ".qawolf"]);
181811
181929
  async function stageFlowFiles(args) {
181812
- const { files, projectDir, execDir, fs: fs3 } = args;
181930
+ const { files, projectDir, execDir, fs: fs4 } = args;
181813
181931
  if (projectDir !== undefined) {
181814
181932
  await copyDirExcluding(projectDir, execDir, excludedDirs);
181815
- return Promise.all(files.map(async (f3) => remapPath(f3, projectDir, execDir) ?? stageOneFile(f3, execDir, fs3)));
181933
+ return Promise.all(files.map(async (f3) => remapPath(f3, projectDir, execDir) ?? stageOneFile(f3, execDir, fs4)));
181816
181934
  }
181817
181935
  if (files.length > 1) {
181818
- return Promise.all(files.map((f3) => stageOneFile(f3, execDir, fs3)));
181936
+ return Promise.all(files.map((f3) => stageOneFile(f3, execDir, fs4)));
181819
181937
  }
181820
- await Promise.all(files.map((f3) => fs3.copyFile(f3, join31(execDir, basename4(f3)))));
181938
+ await Promise.all(files.map((f3) => fs4.copyFile(f3, join31(execDir, basename4(f3)))));
181821
181939
  return files.map((f3) => join31(execDir, basename4(f3)));
181822
181940
  }
181823
- async function stageOneFile(file2, execDir, fs3) {
181941
+ async function stageOneFile(file2, execDir, fs4) {
181824
181942
  const dirHash = createHash3("sha256").update(dirname10(file2)).digest("hex").slice(0, 8);
181825
181943
  const subDir = join31(execDir, dirHash);
181826
- await fs3.mkdir(subDir, { recursive: true });
181944
+ await fs4.mkdir(subDir, { recursive: true });
181827
181945
  const dest = join31(subDir, basename4(file2));
181828
- await fs3.copyFile(file2, dest);
181946
+ await fs4.copyFile(file2, dest);
181829
181947
  return dest;
181830
181948
  }
181831
181949
  function remapPath(file2, projectDir, execDir) {
@@ -181840,30 +181958,30 @@ function remapPath(file2, projectDir, execDir) {
181840
181958
  // src/domains/runtimeEnv/prepareRunDir.ts
181841
181959
  async function prepareRunDir(args) {
181842
181960
  const { files, projectDir, depsRoot, runRoot } = args;
181843
- const fs3 = args.fs ?? makeDefaultFs();
181961
+ const fs4 = args.fs ?? makeDefaultFs();
181844
181962
  const runId = buildRunId(projectDir, files);
181845
181963
  const runDir = join32(runRoot, runId);
181846
- await fs3.rm(runDir, { recursive: true, force: true });
181847
- await fs3.mkdir(runDir, { recursive: true });
181964
+ await fs4.rm(runDir, { recursive: true, force: true });
181965
+ await fs4.mkdir(runDir, { recursive: true });
181848
181966
  const execDir = join32(runDir, "exec");
181849
- await fs3.mkdir(execDir, { recursive: true });
181850
- await populateInnerHop({ depsRoot, execDir, fs: fs3 });
181851
- const stagedFiles = await stageFlowFiles({ files, projectDir, execDir, fs: fs3 });
181967
+ await fs4.mkdir(execDir, { recursive: true });
181968
+ await populateInnerHop({ depsRoot, execDir, fs: fs4 });
181969
+ const stagedFiles = await stageFlowFiles({ files, projectDir, execDir, fs: fs4 });
181852
181970
  if (projectDir !== undefined) {
181853
- await writeExecSubpathImports({ execDir, fs: fs3 });
181971
+ await writeExecSubpathImports({ execDir, fs: fs4 });
181854
181972
  }
181855
181973
  const outerHop = await populateOuterHop({
181856
181974
  projectDir,
181857
181975
  runDir,
181858
181976
  depsRoot,
181859
- fs: fs3,
181977
+ fs: fs4,
181860
181978
  ...args.onInstallStart !== undefined ? { onInstallStart: args.onInstallStart } : {}
181861
181979
  });
181862
181980
  return {
181863
181981
  files: stagedFiles,
181864
181982
  runDir,
181865
181983
  outerHop,
181866
- cleanup: () => fs3.rm(runDir, { recursive: true, force: true })
181984
+ cleanup: () => fs4.rm(runDir, { recursive: true, force: true })
181867
181985
  };
181868
181986
  }
181869
181987
  function buildRunId(projectDir, files) {
@@ -181910,13 +182028,13 @@ async function configureTestkit(cwd, deps) {
181910
182028
 
181911
182029
  // src/commands/resolveDepsRoot.ts
181912
182030
  function resolveDepsRoot(args) {
181913
- const fs3 = args.fs ?? makeDefaultFs();
181914
- const projectDir = resolveProjectDirSafe(args.files, fs3);
182031
+ const fs4 = args.fs ?? makeDefaultFs();
182032
+ const projectDir = resolveProjectDirSafe(args.files, fs4);
181915
182033
  return ensureRuntimeEnv({
181916
182034
  platform: args.platform,
181917
182035
  ...projectDir !== undefined ? { projectDir } : {},
181918
182036
  ...args.overrideDir !== undefined ? { overrideDir: args.overrideDir } : {}
181919
- }, { fs: fs3 });
182037
+ }, { fs: fs4 });
181920
182038
  }
181921
182039
 
181922
182040
  // src/domains/emails/configureEmails.ts
@@ -181948,31 +182066,31 @@ import { join as join34 } from "node:path";
181948
182066
  function envFilePath(envDir) {
181949
182067
  return join34(envDir, ".env");
181950
182068
  }
181951
- async function readEnv(envDir, fs3) {
182069
+ async function readEnv(envDir, fs4) {
181952
182070
  try {
181953
- return parseDotenv(await fs3.readFile(envFilePath(envDir)));
182071
+ return parseDotenv(await fs4.readFile(envFilePath(envDir)));
181954
182072
  } catch (err) {
181955
182073
  if (isNoEntError(err))
181956
182074
  return {};
181957
182075
  throw err;
181958
182076
  }
181959
182077
  }
181960
- async function writeEnv(envDir, fs3, vars) {
182078
+ async function writeEnv(envDir, fs4, vars) {
181961
182079
  const target = envFilePath(envDir);
181962
182080
  const tmp = `${target}.${process.pid}.tmp`;
181963
- await fs3.writeFile(tmp, serializeDotenv(vars), { mode: 384 });
181964
- await fs3.rename(tmp, target);
182081
+ await fs4.writeFile(tmp, serializeDotenv(vars), { mode: 384 });
182082
+ await fs4.rename(tmp, target);
181965
182083
  }
181966
- function makeEnvVarDeps(envDir, fs3) {
182084
+ function makeEnvVarDeps(envDir, fs4) {
181967
182085
  return {
181968
182086
  setEnvironmentVariable: async (key, value) => {
181969
- const vars = await readEnv(envDir, fs3);
182087
+ const vars = await readEnv(envDir, fs4);
181970
182088
  vars[key] = value;
181971
- await writeEnv(envDir, fs3, vars);
182089
+ await writeEnv(envDir, fs4, vars);
181972
182090
  process.env[key] = value;
181973
182091
  },
181974
182092
  fetchLatestEnvironmentVariables: async () => {
181975
- const vars = await readEnv(envDir, fs3);
182093
+ const vars = await readEnv(envDir, fs4);
181976
182094
  for (const [key, value] of Object.entries(vars)) {
181977
182095
  process.env[key] = value;
181978
182096
  }
@@ -182094,7 +182212,7 @@ var defaultSpawnAppium = (bin, args, platform, env2) => {
182094
182212
  var readyBanner = "Appium REST http interface listener started on";
182095
182213
  var defaultStartTimeoutMs = 30000;
182096
182214
  var bannerBufferMaxBytes = 1024;
182097
- function waitForBanner(output, exitCode, timeoutMs4) {
182215
+ function waitForBanner(output, exitCode, timeoutMs3) {
182098
182216
  return new Promise((resolve10, reject) => {
182099
182217
  let done = false;
182100
182218
  function cleanup() {
@@ -182118,8 +182236,8 @@ function waitForBanner(output, exitCode, timeoutMs4) {
182118
182236
  };
182119
182237
  const timer = setTimeout(() => {
182120
182238
  cleanup();
182121
- reject(new Error(`Appium server did not start within ${timeoutMs4 / 1000}s`));
182122
- }, timeoutMs4);
182239
+ reject(new Error(`Appium server did not start within ${timeoutMs3 / 1000}s`));
182240
+ }, timeoutMs3);
182123
182241
  output.on("data", onData);
182124
182242
  const fail = (err) => {
182125
182243
  if (done)
@@ -182135,7 +182253,7 @@ async function createAppiumServer(envDir, signals, params) {
182135
182253
  const findFreePortFn = params?.deps?.findFreePort ?? findFreePort;
182136
182254
  const checkExists = params?.deps?.checkExists ?? existsSync2;
182137
182255
  const appiumHome = params?.options?.appiumHome ?? getAppiumHome();
182138
- const timeoutMs4 = params?.options?.startTimeoutMs ?? defaultStartTimeoutMs;
182256
+ const timeoutMs3 = params?.options?.startTimeoutMs ?? defaultStartTimeoutMs;
182139
182257
  const platform = params?.options?.platform ?? process.platform;
182140
182258
  const candidates = appiumCliCandidates(envDir, platform);
182141
182259
  const bin = candidates.find(checkExists);
@@ -182152,7 +182270,7 @@ async function createAppiumServer(envDir, signals, params) {
182152
182270
  proc.kill();
182153
182271
  };
182154
182272
  const unregister = signals.register(stop);
182155
- await waitForBanner(proc.output, proc.exitCode, timeoutMs4).catch((err) => {
182273
+ await waitForBanner(proc.output, proc.exitCode, timeoutMs3).catch((err) => {
182156
182274
  unregister();
182157
182275
  stop();
182158
182276
  throw err;
@@ -182203,13 +182321,13 @@ async function bootSequence(adb, serial, cancelled) {
182203
182321
  await new Promise((r2) => setTimeout(r2, pollIntervalMs));
182204
182322
  }
182205
182323
  }
182206
- function waitForBoot(adb, serial, timeoutMs4) {
182324
+ function waitForBoot(adb, serial, timeoutMs3) {
182207
182325
  return new Promise((resolve10, reject) => {
182208
182326
  let done = false;
182209
182327
  const timer = setTimeout(() => {
182210
182328
  done = true;
182211
- reject(new Error(`Android emulator did not finish booting within ${timeoutMs4 / 1000}s`));
182212
- }, timeoutMs4);
182329
+ reject(new Error(`Android emulator did not finish booting within ${timeoutMs3 / 1000}s`));
182330
+ }, timeoutMs3);
182213
182331
  bootSequence(adb, serial, () => done).then(() => {
182214
182332
  if (!done) {
182215
182333
  done = true;
@@ -182229,7 +182347,7 @@ async function createAndroidEmulator(params) {
182229
182347
  const { avdName, port } = params;
182230
182348
  const spawnFn = params.deps?.spawn ?? defaultSpawnEmulator;
182231
182349
  const adbFn = params.deps?.adb ?? defaultAdb;
182232
- const timeoutMs4 = params.options?.bootTimeoutMs ?? defaultBootTimeoutMs;
182350
+ const timeoutMs3 = params.options?.bootTimeoutMs ?? defaultBootTimeoutMs;
182233
182351
  const serial = `emulator-${port}`;
182234
182352
  const proc = spawnFn(emulatorBin(androidSdkHome(), process.platform), [
182235
182353
  "-avd",
@@ -182240,7 +182358,7 @@ async function createAndroidEmulator(params) {
182240
182358
  String(port)
182241
182359
  ]);
182242
182360
  try {
182243
- await waitForBoot(adbFn, serial, timeoutMs4);
182361
+ await waitForBoot(adbFn, serial, timeoutMs3);
182244
182362
  } catch (err) {
182245
182363
  proc.stop();
182246
182364
  throw err;
@@ -184753,7 +184871,7 @@ async function handlePublicApiCommand(ctx, spec, options) {
184753
184871
  return { error: exports_external.prettifyError(parsed.error) };
184754
184872
  const result = await ctx.platformClient.callPublicApi(spec.contract, parsed.data);
184755
184873
  if (!result.ok)
184756
- return { error: result.error };
184874
+ return failureFields(result);
184757
184875
  ctx.ui.output(result.value, renderHuman(result.value));
184758
184876
  return;
184759
184877
  }
@@ -184765,8 +184883,16 @@ var groupDescriptions = {
184765
184883
  var handWrittenContractNames = new Set(["flow.list"]);
184766
184884
  var skippedContractNames = new Set([
184767
184885
  ...handWrittenContractNames,
184768
- "issue.update"
184886
+ "issue.update",
184887
+ "runner.performAction"
184769
184888
  ]);
184889
+ var optionEnvironmentVariables = new Map([
184890
+ ["environmentId", "QAWOLF_ENVIRONMENT"],
184891
+ ["public.run.create.aiTaskId", "QAWOLF_AI_TASK_ID"]
184892
+ ]);
184893
+ function optionEnvironmentVariable(spec, field) {
184894
+ return optionEnvironmentVariables.get(`${spec.trpcPath}.${field}`) ?? optionEnvironmentVariables.get(field);
184895
+ }
184770
184896
  function resolveGroup(parent2, segment) {
184771
184897
  const existing = parent2.commands.find((command) => command.name() === segment);
184772
184898
  return existing ?? parent2.command(segment).description(groupDescriptions[segment] ?? `QA Wolf public API ${segment} commands`);
@@ -184783,7 +184909,13 @@ function registerSpec(program2, signals, spec, authDeps) {
184783
184909
  }
184784
184910
  const command = declareCommandKind(parent2.command(leafName), spec.kind).description(spec.description);
184785
184911
  for (const flag of spec.flags) {
184786
- if (flag.required) {
184912
+ const environmentVariable = optionEnvironmentVariable(spec, flag.field);
184913
+ if (environmentVariable) {
184914
+ const option = new Option(flag.flag, flag.description).env(environmentVariable);
184915
+ if (flag.required)
184916
+ option.makeOptionMandatory();
184917
+ command.addOption(option);
184918
+ } else if (flag.required) {
184787
184919
  command.requiredOption(flag.flag, flag.description);
184788
184920
  } else {
184789
184921
  command.option(flag.flag, flag.description);
@@ -184835,4 +184967,4 @@ createProgram({ signals }).parseAsync().catch(() => {
184835
184967
  process.exitCode = 1;
184836
184968
  }).finally(() => flushAndExit(typeof process.exitCode === "number" ? process.exitCode : 0));
184837
184969
 
184838
- //# debugId=C0B1B96CCF6C4A9564756E2164756E21
184970
+ //# debugId=6C7CEF86B6A2980364756E2164756E21