@osfactory/har 0.27.0 → 0.29.0

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/index.js +527 -231
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -873,14 +873,14 @@ var require_url_state_machine = __commonJS({
873
873
  return url.replace(/\u0009|\u000A|\u000D/g, "");
874
874
  }
875
875
  function shortenPath(url) {
876
- const path57 = url.path;
877
- if (path57.length === 0) {
876
+ const path58 = url.path;
877
+ if (path58.length === 0) {
878
878
  return;
879
879
  }
880
- if (url.scheme === "file" && path57.length === 1 && isNormalizedWindowsDriveLetter(path57[0])) {
880
+ if (url.scheme === "file" && path58.length === 1 && isNormalizedWindowsDriveLetter(path58[0])) {
881
881
  return;
882
882
  }
883
- path57.pop();
883
+ path58.pop();
884
884
  }
885
885
  function includesCredentials(url) {
886
886
  return url.username !== "" || url.password !== "";
@@ -2200,7 +2200,7 @@ var require_lib2 = __commonJS({
2200
2200
  let accum = [];
2201
2201
  let accumBytes = 0;
2202
2202
  let abort = false;
2203
- return new Body.Promise(function(resolve41, reject) {
2203
+ return new Body.Promise(function(resolve42, reject) {
2204
2204
  let resTimeout;
2205
2205
  if (_this4.timeout) {
2206
2206
  resTimeout = setTimeout(function() {
@@ -2234,7 +2234,7 @@ var require_lib2 = __commonJS({
2234
2234
  }
2235
2235
  clearTimeout(resTimeout);
2236
2236
  try {
2237
- resolve41(Buffer.concat(accum, accumBytes));
2237
+ resolve42(Buffer.concat(accum, accumBytes));
2238
2238
  } catch (err) {
2239
2239
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
2240
2240
  }
@@ -2909,7 +2909,7 @@ var require_lib2 = __commonJS({
2909
2909
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
2910
2910
  }
2911
2911
  Body.Promise = fetch3.Promise;
2912
- return new fetch3.Promise(function(resolve41, reject) {
2912
+ return new fetch3.Promise(function(resolve42, reject) {
2913
2913
  const request = new Request3(url, opts);
2914
2914
  const options = getNodeRequestOptions(request);
2915
2915
  const send = (options.protocol === "https:" ? https : http2).request;
@@ -3042,7 +3042,7 @@ var require_lib2 = __commonJS({
3042
3042
  requestOpts.body = void 0;
3043
3043
  requestOpts.headers.delete("content-length");
3044
3044
  }
3045
- resolve41(fetch3(new Request3(locationURL, requestOpts)));
3045
+ resolve42(fetch3(new Request3(locationURL, requestOpts)));
3046
3046
  finalize();
3047
3047
  return;
3048
3048
  }
@@ -3063,7 +3063,7 @@ var require_lib2 = __commonJS({
3063
3063
  const codings = headers.get("Content-Encoding");
3064
3064
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
3065
3065
  response = new Response3(body, response_options);
3066
- resolve41(response);
3066
+ resolve42(response);
3067
3067
  return;
3068
3068
  }
3069
3069
  const zlibOptions = {
@@ -3073,7 +3073,7 @@ var require_lib2 = __commonJS({
3073
3073
  if (codings == "gzip" || codings == "x-gzip") {
3074
3074
  body = body.pipe(zlib.createGunzip(zlibOptions));
3075
3075
  response = new Response3(body, response_options);
3076
- resolve41(response);
3076
+ resolve42(response);
3077
3077
  return;
3078
3078
  }
3079
3079
  if (codings == "deflate" || codings == "x-deflate") {
@@ -3085,12 +3085,12 @@ var require_lib2 = __commonJS({
3085
3085
  body = body.pipe(zlib.createInflateRaw());
3086
3086
  }
3087
3087
  response = new Response3(body, response_options);
3088
- resolve41(response);
3088
+ resolve42(response);
3089
3089
  });
3090
3090
  raw.on("end", function() {
3091
3091
  if (!response) {
3092
3092
  response = new Response3(body, response_options);
3093
- resolve41(response);
3093
+ resolve42(response);
3094
3094
  }
3095
3095
  });
3096
3096
  return;
@@ -3098,11 +3098,11 @@ var require_lib2 = __commonJS({
3098
3098
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
3099
3099
  body = body.pipe(zlib.createBrotliDecompress());
3100
3100
  response = new Response3(body, response_options);
3101
- resolve41(response);
3101
+ resolve42(response);
3102
3102
  return;
3103
3103
  }
3104
3104
  response = new Response3(body, response_options);
3105
- resolve41(response);
3105
+ resolve42(response);
3106
3106
  });
3107
3107
  writeToStream(req, request);
3108
3108
  });
@@ -6459,14 +6459,14 @@ __export(fileFromPath_exports, {
6459
6459
  fileFromPathSync: () => fileFromPathSync,
6460
6460
  isFile: () => isFile
6461
6461
  });
6462
- function createFileFromPath(path57, { mtimeMs, size }, filenameOrOptions, options = {}) {
6462
+ function createFileFromPath(path58, { mtimeMs, size }, filenameOrOptions, options = {}) {
6463
6463
  let filename;
6464
6464
  if (isPlainObject_default2(filenameOrOptions)) {
6465
6465
  [options, filename] = [filenameOrOptions, void 0];
6466
6466
  } else {
6467
6467
  filename = filenameOrOptions;
6468
6468
  }
6469
- const file = new FileFromPath({ path: path57, size, lastModified: mtimeMs });
6469
+ const file = new FileFromPath({ path: path58, size, lastModified: mtimeMs });
6470
6470
  if (!filename) {
6471
6471
  filename = file.name;
6472
6472
  }
@@ -6475,13 +6475,13 @@ function createFileFromPath(path57, { mtimeMs, size }, filenameOrOptions, option
6475
6475
  lastModified: file.lastModified
6476
6476
  });
6477
6477
  }
6478
- function fileFromPathSync(path57, filenameOrOptions, options = {}) {
6479
- const stats = (0, import_fs5.statSync)(path57);
6480
- return createFileFromPath(path57, stats, filenameOrOptions, options);
6478
+ function fileFromPathSync(path58, filenameOrOptions, options = {}) {
6479
+ const stats = (0, import_fs5.statSync)(path58);
6480
+ return createFileFromPath(path58, stats, filenameOrOptions, options);
6481
6481
  }
6482
- async function fileFromPath2(path57, filenameOrOptions, options) {
6483
- const stats = await import_fs5.promises.stat(path57);
6484
- return createFileFromPath(path57, stats, filenameOrOptions, options);
6482
+ async function fileFromPath2(path58, filenameOrOptions, options) {
6483
+ const stats = await import_fs5.promises.stat(path58);
6484
+ return createFileFromPath(path58, stats, filenameOrOptions, options);
6485
6485
  }
6486
6486
  var import_fs5, import_path5, import_node_domexception, __classPrivateFieldSet5, __classPrivateFieldGet6, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
6487
6487
  var init_fileFromPath = __esm({
@@ -8003,15 +8003,15 @@ var require_route = __commonJS({
8003
8003
  };
8004
8004
  }
8005
8005
  function wrapConversion(toModel, graph) {
8006
- const path57 = [graph[toModel].parent, toModel];
8006
+ const path58 = [graph[toModel].parent, toModel];
8007
8007
  let fn = conversions[graph[toModel].parent][toModel];
8008
8008
  let cur = graph[toModel].parent;
8009
8009
  while (graph[cur].parent) {
8010
- path57.unshift(graph[cur].parent);
8010
+ path58.unshift(graph[cur].parent);
8011
8011
  fn = link(conversions[graph[cur].parent][cur], fn);
8012
8012
  cur = graph[cur].parent;
8013
8013
  }
8014
- fn.conversion = path57;
8014
+ fn.conversion = path58;
8015
8015
  return fn;
8016
8016
  }
8017
8017
  module2.exports = function(fromModel) {
@@ -13941,7 +13941,7 @@ var require_iso2022 = __commonJS({
13941
13941
  // node_modules/chardet/index.js
13942
13942
  var require_chardet = __commonJS({
13943
13943
  "node_modules/chardet/index.js"(exports2, module2) {
13944
- var fs48 = require("fs");
13944
+ var fs49 = require("fs");
13945
13945
  var utf8 = require_utf8();
13946
13946
  var unicode = require_unicode();
13947
13947
  var mbcs = require_mbcs();
@@ -14015,28 +14015,28 @@ var require_chardet = __commonJS({
14015
14015
  var fd;
14016
14016
  var handler = function(err, buffer) {
14017
14017
  if (fd) {
14018
- fs48.closeSync(fd);
14018
+ fs49.closeSync(fd);
14019
14019
  }
14020
14020
  if (err) return cb(err, null);
14021
14021
  cb(null, self.detect(buffer, opts));
14022
14022
  };
14023
14023
  if (opts && opts.sampleSize) {
14024
- fd = fs48.openSync(filepath, "r"), sample = Buffer.allocUnsafe(opts.sampleSize);
14025
- fs48.read(fd, sample, 0, opts.sampleSize, null, function(err) {
14024
+ fd = fs49.openSync(filepath, "r"), sample = Buffer.allocUnsafe(opts.sampleSize);
14025
+ fs49.read(fd, sample, 0, opts.sampleSize, null, function(err) {
14026
14026
  handler(err, sample);
14027
14027
  });
14028
14028
  return;
14029
14029
  }
14030
- fs48.readFile(filepath, handler);
14030
+ fs49.readFile(filepath, handler);
14031
14031
  };
14032
14032
  module2.exports.detectFileSync = function(filepath, opts) {
14033
14033
  if (opts && opts.sampleSize) {
14034
- var fd = fs48.openSync(filepath, "r"), sample2 = Buffer.allocUnsafe(opts.sampleSize);
14035
- fs48.readSync(fd, sample2, 0, opts.sampleSize);
14036
- fs48.closeSync(fd);
14034
+ var fd = fs49.openSync(filepath, "r"), sample2 = Buffer.allocUnsafe(opts.sampleSize);
14035
+ fs49.readSync(fd, sample2, 0, opts.sampleSize);
14036
+ fs49.closeSync(fd);
14037
14037
  return self.detect(sample2, opts);
14038
14038
  }
14039
- return self.detect(fs48.readFileSync(filepath), opts);
14039
+ return self.detect(fs49.readFileSync(filepath), opts);
14040
14040
  };
14041
14041
  module2.exports.detectAll = function(buffer, opts) {
14042
14042
  if (typeof opts !== "object") {
@@ -17501,16 +17501,16 @@ var require_os_tmpdir = __commonJS({
17501
17501
  var isWindows = process.platform === "win32";
17502
17502
  var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
17503
17503
  module2.exports = function() {
17504
- var path57;
17504
+ var path58;
17505
17505
  if (isWindows) {
17506
- path57 = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
17506
+ path58 = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
17507
17507
  } else {
17508
- path57 = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
17508
+ path58 = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
17509
17509
  }
17510
- if (trailingSlashRe.test(path57)) {
17511
- path57 = path57.slice(0, -1);
17510
+ if (trailingSlashRe.test(path58)) {
17511
+ path58 = path58.slice(0, -1);
17512
17512
  }
17513
- return path57;
17513
+ return path58;
17514
17514
  };
17515
17515
  }
17516
17516
  });
@@ -17518,8 +17518,8 @@ var require_os_tmpdir = __commonJS({
17518
17518
  // node_modules/tmp/lib/tmp.js
17519
17519
  var require_tmp = __commonJS({
17520
17520
  "node_modules/tmp/lib/tmp.js"(exports2, module2) {
17521
- var fs48 = require("fs");
17522
- var path57 = require("path");
17521
+ var fs49 = require("fs");
17522
+ var path58 = require("path");
17523
17523
  var crypto6 = require("crypto");
17524
17524
  var osTmpDir = require_os_tmpdir();
17525
17525
  var _c2 = process.binding("constants");
@@ -17561,7 +17561,7 @@ var require_tmp = __commonJS({
17561
17561
  }
17562
17562
  function _generateTmpName(opts) {
17563
17563
  if (opts.name) {
17564
- return path57.join(opts.dir || tmpDir, opts.name);
17564
+ return path58.join(opts.dir || tmpDir, opts.name);
17565
17565
  }
17566
17566
  if (opts.template) {
17567
17567
  return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
@@ -17572,7 +17572,7 @@ var require_tmp = __commonJS({
17572
17572
  _randomChars(12),
17573
17573
  opts.postfix || ""
17574
17574
  ].join("");
17575
- return path57.join(opts.dir || tmpDir, name);
17575
+ return path58.join(opts.dir || tmpDir, name);
17576
17576
  }
17577
17577
  function tmpName(options, callback) {
17578
17578
  var args = _parseArguments(options, callback), opts = args[0], cb = args[1], tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
@@ -17582,7 +17582,7 @@ var require_tmp = __commonJS({
17582
17582
  return cb(new Error("Invalid template provided"));
17583
17583
  (function _getUniqueName() {
17584
17584
  const name = _generateTmpName(opts);
17585
- fs48.stat(name, function(err) {
17585
+ fs49.stat(name, function(err) {
17586
17586
  if (!err) {
17587
17587
  if (tries-- > 0) return _getUniqueName();
17588
17588
  return cb(new Error("Could not get a unique tmp filename, max tries reached " + name));
@@ -17600,7 +17600,7 @@ var require_tmp = __commonJS({
17600
17600
  do {
17601
17601
  const name = _generateTmpName(opts);
17602
17602
  try {
17603
- fs48.statSync(name);
17603
+ fs49.statSync(name);
17604
17604
  } catch (e2) {
17605
17605
  return name;
17606
17606
  }
@@ -17612,13 +17612,13 @@ var require_tmp = __commonJS({
17612
17612
  opts.postfix = _isUndefined(opts.postfix) ? ".tmp" : opts.postfix;
17613
17613
  tmpName(opts, function _tmpNameCreated(err, name) {
17614
17614
  if (err) return cb(err);
17615
- fs48.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
17615
+ fs49.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
17616
17616
  if (err2) return cb(err2);
17617
17617
  if (opts.discardDescriptor) {
17618
- return fs48.close(fd, function _discardCallback(err3) {
17618
+ return fs49.close(fd, function _discardCallback(err3) {
17619
17619
  if (err3) {
17620
17620
  try {
17621
- fs48.unlinkSync(name);
17621
+ fs49.unlinkSync(name);
17622
17622
  } catch (e2) {
17623
17623
  if (!isENOENT(e2)) {
17624
17624
  err3 = e2;
@@ -17641,9 +17641,9 @@ var require_tmp = __commonJS({
17641
17641
  opts.postfix = opts.postfix || ".tmp";
17642
17642
  const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
17643
17643
  const name = tmpNameSync(opts);
17644
- var fd = fs48.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
17644
+ var fd = fs49.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
17645
17645
  if (opts.discardDescriptor) {
17646
- fs48.closeSync(fd);
17646
+ fs49.closeSync(fd);
17647
17647
  fd = void 0;
17648
17648
  }
17649
17649
  return {
@@ -17655,9 +17655,9 @@ var require_tmp = __commonJS({
17655
17655
  function _rmdirRecursiveSync(root) {
17656
17656
  const dirs = [root];
17657
17657
  do {
17658
- var dir2 = dirs.pop(), deferred = false, files = fs48.readdirSync(dir2);
17658
+ var dir2 = dirs.pop(), deferred = false, files = fs49.readdirSync(dir2);
17659
17659
  for (var i2 = 0, length = files.length; i2 < length; i2++) {
17660
- var file2 = path57.join(dir2, files[i2]), stat = fs48.lstatSync(file2);
17660
+ var file2 = path58.join(dir2, files[i2]), stat = fs49.lstatSync(file2);
17661
17661
  if (stat.isDirectory()) {
17662
17662
  if (!deferred) {
17663
17663
  deferred = true;
@@ -17665,11 +17665,11 @@ var require_tmp = __commonJS({
17665
17665
  }
17666
17666
  dirs.push(file2);
17667
17667
  } else {
17668
- fs48.unlinkSync(file2);
17668
+ fs49.unlinkSync(file2);
17669
17669
  }
17670
17670
  }
17671
17671
  if (!deferred) {
17672
- fs48.rmdirSync(dir2);
17672
+ fs49.rmdirSync(dir2);
17673
17673
  }
17674
17674
  } while (dirs.length !== 0);
17675
17675
  }
@@ -17677,7 +17677,7 @@ var require_tmp = __commonJS({
17677
17677
  var args = _parseArguments(options, callback), opts = args[0], cb = args[1];
17678
17678
  tmpName(opts, function _tmpNameCreated(err, name) {
17679
17679
  if (err) return cb(err);
17680
- fs48.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
17680
+ fs49.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
17681
17681
  if (err2) return cb(err2);
17682
17682
  cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
17683
17683
  });
@@ -17686,7 +17686,7 @@ var require_tmp = __commonJS({
17686
17686
  function dirSync(options) {
17687
17687
  var args = _parseArguments(options), opts = args[0];
17688
17688
  const name = tmpNameSync(opts);
17689
- fs48.mkdirSync(name, opts.mode || DIR_MODE);
17689
+ fs49.mkdirSync(name, opts.mode || DIR_MODE);
17690
17690
  return {
17691
17691
  name,
17692
17692
  removeCallback: _prepareTmpDirRemoveCallback(name, opts)
@@ -17696,7 +17696,7 @@ var require_tmp = __commonJS({
17696
17696
  const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
17697
17697
  try {
17698
17698
  if (0 <= fdPath[0]) {
17699
- fs48.closeSync(fdPath[0]);
17699
+ fs49.closeSync(fdPath[0]);
17700
17700
  }
17701
17701
  } catch (e2) {
17702
17702
  if (!isEBADF(e2) && !isENOENT(e2)) {
@@ -17704,7 +17704,7 @@ var require_tmp = __commonJS({
17704
17704
  }
17705
17705
  }
17706
17706
  try {
17707
- fs48.unlinkSync(fdPath[1]);
17707
+ fs49.unlinkSync(fdPath[1]);
17708
17708
  } catch (e2) {
17709
17709
  if (!isENOENT(e2)) {
17710
17710
  throw e2;
@@ -17717,7 +17717,7 @@ var require_tmp = __commonJS({
17717
17717
  return removeCallback;
17718
17718
  }
17719
17719
  function _prepareTmpDirRemoveCallback(name, opts) {
17720
- const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs48.rmdirSync.bind(fs48);
17720
+ const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs49.rmdirSync.bind(fs49);
17721
17721
  const removeCallback = _prepareRemoveCallback(removeFunction, name);
17722
17722
  if (!opts.keep) {
17723
17723
  _removeObjects.unshift(removeCallback);
@@ -18868,7 +18868,7 @@ var require_Observable = __commonJS({
18868
18868
  Observable2.prototype.forEach = function(next, promiseCtor) {
18869
18869
  var _this = this;
18870
18870
  promiseCtor = getPromiseCtor(promiseCtor);
18871
- return new promiseCtor(function(resolve41, reject) {
18871
+ return new promiseCtor(function(resolve42, reject) {
18872
18872
  var subscriber = new Subscriber_1.SafeSubscriber({
18873
18873
  next: function(value) {
18874
18874
  try {
@@ -18879,7 +18879,7 @@ var require_Observable = __commonJS({
18879
18879
  }
18880
18880
  },
18881
18881
  error: reject,
18882
- complete: resolve41
18882
+ complete: resolve42
18883
18883
  });
18884
18884
  _this.subscribe(subscriber);
18885
18885
  });
@@ -18901,14 +18901,14 @@ var require_Observable = __commonJS({
18901
18901
  Observable2.prototype.toPromise = function(promiseCtor) {
18902
18902
  var _this = this;
18903
18903
  promiseCtor = getPromiseCtor(promiseCtor);
18904
- return new promiseCtor(function(resolve41, reject) {
18904
+ return new promiseCtor(function(resolve42, reject) {
18905
18905
  var value;
18906
18906
  _this.subscribe(function(x2) {
18907
18907
  return value = x2;
18908
18908
  }, function(err) {
18909
18909
  return reject(err);
18910
18910
  }, function() {
18911
- return resolve41(value);
18911
+ return resolve42(value);
18912
18912
  });
18913
18913
  });
18914
18914
  };
@@ -21004,11 +21004,11 @@ var require_innerFrom = __commonJS({
21004
21004
  "use strict";
21005
21005
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
21006
21006
  function adopt(value) {
21007
- return value instanceof P2 ? value : new P2(function(resolve41) {
21008
- resolve41(value);
21007
+ return value instanceof P2 ? value : new P2(function(resolve42) {
21008
+ resolve42(value);
21009
21009
  });
21010
21010
  }
21011
- return new (P2 || (P2 = Promise))(function(resolve41, reject) {
21011
+ return new (P2 || (P2 = Promise))(function(resolve42, reject) {
21012
21012
  function fulfilled(value) {
21013
21013
  try {
21014
21014
  step(generator.next(value));
@@ -21024,7 +21024,7 @@ var require_innerFrom = __commonJS({
21024
21024
  }
21025
21025
  }
21026
21026
  function step(result) {
21027
- result.done ? resolve41(result.value) : adopt(result.value).then(fulfilled, rejected);
21027
+ result.done ? resolve42(result.value) : adopt(result.value).then(fulfilled, rejected);
21028
21028
  }
21029
21029
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21030
21030
  });
@@ -21106,14 +21106,14 @@ var require_innerFrom = __commonJS({
21106
21106
  }, i2);
21107
21107
  function verb(n2) {
21108
21108
  i2[n2] = o2[n2] && function(v2) {
21109
- return new Promise(function(resolve41, reject) {
21110
- v2 = o2[n2](v2), settle(resolve41, reject, v2.done, v2.value);
21109
+ return new Promise(function(resolve42, reject) {
21110
+ v2 = o2[n2](v2), settle(resolve42, reject, v2.done, v2.value);
21111
21111
  });
21112
21112
  };
21113
21113
  }
21114
- function settle(resolve41, reject, d2, v2) {
21114
+ function settle(resolve42, reject, d2, v2) {
21115
21115
  Promise.resolve(v2).then(function(v3) {
21116
- resolve41({ value: v3, done: d2 });
21116
+ resolve42({ value: v3, done: d2 });
21117
21117
  }, reject);
21118
21118
  }
21119
21119
  };
@@ -21732,7 +21732,7 @@ var require_lastValueFrom = __commonJS({
21732
21732
  var EmptyError_1 = require_EmptyError();
21733
21733
  function lastValueFrom2(source, config2) {
21734
21734
  var hasConfig = typeof config2 === "object";
21735
- return new Promise(function(resolve41, reject) {
21735
+ return new Promise(function(resolve42, reject) {
21736
21736
  var _hasValue = false;
21737
21737
  var _value;
21738
21738
  source.subscribe({
@@ -21743,9 +21743,9 @@ var require_lastValueFrom = __commonJS({
21743
21743
  error: reject,
21744
21744
  complete: function() {
21745
21745
  if (_hasValue) {
21746
- resolve41(_value);
21746
+ resolve42(_value);
21747
21747
  } else if (hasConfig) {
21748
- resolve41(config2.defaultValue);
21748
+ resolve42(config2.defaultValue);
21749
21749
  } else {
21750
21750
  reject(new EmptyError_1.EmptyError());
21751
21751
  }
@@ -21767,16 +21767,16 @@ var require_firstValueFrom = __commonJS({
21767
21767
  var Subscriber_1 = require_Subscriber();
21768
21768
  function firstValueFrom(source, config2) {
21769
21769
  var hasConfig = typeof config2 === "object";
21770
- return new Promise(function(resolve41, reject) {
21770
+ return new Promise(function(resolve42, reject) {
21771
21771
  var subscriber = new Subscriber_1.SafeSubscriber({
21772
21772
  next: function(value) {
21773
- resolve41(value);
21773
+ resolve42(value);
21774
21774
  subscriber.unsubscribe();
21775
21775
  },
21776
21776
  error: reject,
21777
21777
  complete: function() {
21778
21778
  if (hasConfig) {
21779
- resolve41(config2.defaultValue);
21779
+ resolve42(config2.defaultValue);
21780
21780
  } else {
21781
21781
  reject(new EmptyError_1.EmptyError());
21782
21782
  }
@@ -25739,7 +25739,7 @@ var require_share = __commonJS({
25739
25739
  subscriber.add(function() {
25740
25740
  refCount--;
25741
25741
  if (refCount === 0 && !hasErrored && !hasCompleted) {
25742
- resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
25742
+ resetConnection = handleReset2(resetAndUnsubscribe, resetOnRefCountZero);
25743
25743
  }
25744
25744
  });
25745
25745
  dest.subscribe(subscriber);
@@ -25751,13 +25751,13 @@ var require_share = __commonJS({
25751
25751
  error: function(err) {
25752
25752
  hasErrored = true;
25753
25753
  cancelReset();
25754
- resetConnection = handleReset(reset, resetOnError, err);
25754
+ resetConnection = handleReset2(reset, resetOnError, err);
25755
25755
  dest.error(err);
25756
25756
  },
25757
25757
  complete: function() {
25758
25758
  hasCompleted = true;
25759
25759
  cancelReset();
25760
- resetConnection = handleReset(reset, resetOnComplete);
25760
+ resetConnection = handleReset2(reset, resetOnComplete);
25761
25761
  dest.complete();
25762
25762
  }
25763
25763
  });
@@ -25767,7 +25767,7 @@ var require_share = __commonJS({
25767
25767
  };
25768
25768
  }
25769
25769
  exports2.share = share;
25770
- function handleReset(reset, on) {
25770
+ function handleReset2(reset, on) {
25771
25771
  var args = [];
25772
25772
  for (var _i = 2; _i < arguments.length; _i++) {
25773
25773
  args[_i - 2] = arguments[_i];
@@ -27569,14 +27569,14 @@ var require_run_async = __commonJS({
27569
27569
  return function() {
27570
27570
  var args = arguments;
27571
27571
  var originalThis = this;
27572
- var promise = new Promise(function(resolve41, reject) {
27572
+ var promise = new Promise(function(resolve42, reject) {
27573
27573
  var resolved = false;
27574
27574
  const wrappedResolve = function(value) {
27575
27575
  if (resolved) {
27576
27576
  console.warn("Run-async promise already resolved.");
27577
27577
  }
27578
27578
  resolved = true;
27579
- resolve41(value);
27579
+ resolve42(value);
27580
27580
  };
27581
27581
  var rejected = false;
27582
27582
  const wrappedReject = function(value) {
@@ -30605,7 +30605,7 @@ var require_compile = __commonJS({
30605
30605
  const schOrFunc = root.refs[ref];
30606
30606
  if (schOrFunc)
30607
30607
  return schOrFunc;
30608
- let _sch = resolve41.call(this, root, ref);
30608
+ let _sch = resolve42.call(this, root, ref);
30609
30609
  if (_sch === void 0) {
30610
30610
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
30611
30611
  const { schemaId } = this.opts;
@@ -30632,7 +30632,7 @@ var require_compile = __commonJS({
30632
30632
  function sameSchemaEnv(s1, s2) {
30633
30633
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
30634
30634
  }
30635
- function resolve41(root, ref) {
30635
+ function resolve42(root, ref) {
30636
30636
  let sch;
30637
30637
  while (typeof (sch = this.refs[ref]) == "string")
30638
30638
  ref = sch;
@@ -30850,8 +30850,8 @@ var require_utils2 = __commonJS({
30850
30850
  }
30851
30851
  return ind;
30852
30852
  }
30853
- function removeDotSegments(path57) {
30854
- let input = path57;
30853
+ function removeDotSegments(path58) {
30854
+ let input = path58;
30855
30855
  const output = [];
30856
30856
  let nextSlash = -1;
30857
30857
  let len = 0;
@@ -31103,8 +31103,8 @@ var require_schemes = __commonJS({
31103
31103
  wsComponent.secure = void 0;
31104
31104
  }
31105
31105
  if (wsComponent.resourceName) {
31106
- const [path57, query] = wsComponent.resourceName.split("?");
31107
- wsComponent.path = path57 && path57 !== "/" ? path57 : void 0;
31106
+ const [path58, query] = wsComponent.resourceName.split("?");
31107
+ wsComponent.path = path58 && path58 !== "/" ? path58 : void 0;
31108
31108
  wsComponent.query = query;
31109
31109
  wsComponent.resourceName = void 0;
31110
31110
  }
@@ -31263,7 +31263,7 @@ var require_fast_uri = __commonJS({
31263
31263
  }
31264
31264
  return uri;
31265
31265
  }
31266
- function resolve41(baseURI, relativeURI, options) {
31266
+ function resolve42(baseURI, relativeURI, options) {
31267
31267
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
31268
31268
  const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
31269
31269
  schemelessOptions.skipEscape = true;
@@ -31521,7 +31521,7 @@ var require_fast_uri = __commonJS({
31521
31521
  var fastUri = {
31522
31522
  SCHEMES,
31523
31523
  normalize: normalize3,
31524
- resolve: resolve41,
31524
+ resolve: resolve42,
31525
31525
  resolveComponent,
31526
31526
  equal,
31527
31527
  serialize,
@@ -34497,12 +34497,12 @@ var require_dist = __commonJS({
34497
34497
  throw new Error(`Unknown format "${name}"`);
34498
34498
  return f2;
34499
34499
  };
34500
- function addFormats(ajv, list, fs48, exportName) {
34500
+ function addFormats(ajv, list, fs49, exportName) {
34501
34501
  var _a3;
34502
34502
  var _b2;
34503
34503
  (_a3 = (_b2 = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
34504
34504
  for (const f2 of list)
34505
- ajv.addFormat(f2, fs48[f2]);
34505
+ ajv.addFormat(f2, fs49[f2]);
34506
34506
  }
34507
34507
  module2.exports = exports2 = formatsPlugin;
34508
34508
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -35786,11 +35786,11 @@ var parser = new YargsParser({
35786
35786
  resolve: import_path2.resolve,
35787
35787
  // TODO: figure out a way to combine ESM and CJS coverage, such that
35788
35788
  // we can exercise all the lines below:
35789
- require: (path57) => {
35789
+ require: (path58) => {
35790
35790
  if (typeof require !== "undefined") {
35791
- return require(path57);
35792
- } else if (path57.match(/\.json$/)) {
35793
- return JSON.parse((0, import_fs2.readFileSync)(path57, "utf8"));
35791
+ return require(path58);
35792
+ } else if (path58.match(/\.json$/)) {
35793
+ return JSON.parse((0, import_fs2.readFileSync)(path58, "utf8"));
35794
35794
  } else {
35795
35795
  throw Error("only .json config files are supported in ESM");
35796
35796
  }
@@ -38316,12 +38316,12 @@ var YargsInstance = class {
38316
38316
  async getCompletion(args, done) {
38317
38317
  argsert("<array> [function]", [args, done], arguments.length);
38318
38318
  if (!done) {
38319
- return new Promise((resolve41, reject) => {
38319
+ return new Promise((resolve42, reject) => {
38320
38320
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
38321
38321
  if (err)
38322
38322
  reject(err);
38323
38323
  else
38324
- resolve41(completions);
38324
+ resolve42(completions);
38325
38325
  });
38326
38326
  });
38327
38327
  } else {
@@ -40474,8 +40474,8 @@ function getErrorMap() {
40474
40474
 
40475
40475
  // node_modules/zod/v3/helpers/parseUtil.js
40476
40476
  var makeIssue = (params) => {
40477
- const { data, path: path57, errorMaps, issueData } = params;
40478
- const fullPath = [...path57, ...issueData.path || []];
40477
+ const { data, path: path58, errorMaps, issueData } = params;
40478
+ const fullPath = [...path58, ...issueData.path || []];
40479
40479
  const fullIssue = {
40480
40480
  ...issueData,
40481
40481
  path: fullPath
@@ -40591,11 +40591,11 @@ var errorUtil;
40591
40591
 
40592
40592
  // node_modules/zod/v3/types.js
40593
40593
  var ParseInputLazyPath = class {
40594
- constructor(parent, value, path57, key) {
40594
+ constructor(parent, value, path58, key) {
40595
40595
  this._cachedPath = [];
40596
40596
  this.parent = parent;
40597
40597
  this.data = value;
40598
- this._path = path57;
40598
+ this._path = path58;
40599
40599
  this._key = key;
40600
40600
  }
40601
40601
  get path() {
@@ -44378,6 +44378,53 @@ var UnregisterRepoResultSchema = external_exports.object({
44378
44378
  deleteWorktrees: external_exports.boolean(),
44379
44379
  worktrees: external_exports.array(UnregisterWorktreeResultSchema)
44380
44380
  });
44381
+ var ResetMissionControlInputSchema = external_exports.object({
44382
+ confirm: external_exports.literal("RESET"),
44383
+ /**
44384
+ * When true, delete `.har/{runs,validations,state,slots}` under each registered
44385
+ * repository path (best-effort; Docker often cannot see host paths).
44386
+ */
44387
+ scrubLocalHarness: external_exports.boolean().optional().default(true)
44388
+ });
44389
+ var HarnessScrubResultSchema = external_exports.object({
44390
+ path: external_exports.string(),
44391
+ directory: external_exports.string(),
44392
+ deleted: external_exports.boolean(),
44393
+ error: external_exports.string().optional()
44394
+ });
44395
+ var ResetMissionControlResultSchema = external_exports.object({
44396
+ ok: external_exports.literal(true),
44397
+ repositoriesDeleted: external_exports.number().int().nonnegative(),
44398
+ unregisteredCleared: external_exports.number().int().nonnegative(),
44399
+ scrubLocalHarness: external_exports.boolean(),
44400
+ scrubbed: external_exports.array(HarnessScrubResultSchema),
44401
+ repoPaths: external_exports.array(external_exports.string())
44402
+ });
44403
+ var DeleteWorktreesInputSchema = external_exports.object({
44404
+ worktrees: external_exports.array(
44405
+ external_exports.object({
44406
+ repoId: external_exports.string().min(1),
44407
+ slotId: external_exports.number().int().positive()
44408
+ })
44409
+ ).min(1),
44410
+ /**
44411
+ * When true (default), also drop Mission Control slot rows when the path is
44412
+ * already missing on disk (stale dashboard entries).
44413
+ */
44414
+ clearMissing: external_exports.boolean().optional().default(true)
44415
+ });
44416
+ var DeleteWorktreeResultSchema = external_exports.object({
44417
+ repoId: external_exports.string(),
44418
+ slotId: external_exports.number(),
44419
+ path: external_exports.string(),
44420
+ deleted: external_exports.boolean(),
44421
+ clearedFromDashboard: external_exports.boolean(),
44422
+ error: external_exports.string().optional()
44423
+ });
44424
+ var DeleteWorktreesResultSchema = external_exports.object({
44425
+ ok: external_exports.literal(true),
44426
+ results: external_exports.array(DeleteWorktreeResultSchema)
44427
+ });
44381
44428
  var SyncRunsInputSchema = external_exports.object({
44382
44429
  runs: external_exports.array(RunRecordSchema)
44383
44430
  });
@@ -44734,16 +44781,16 @@ async function handleAgentSkills(options) {
44734
44781
  }
44735
44782
  async function askYesNo(question) {
44736
44783
  const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
44737
- return new Promise((resolve41) => {
44784
+ return new Promise((resolve42) => {
44738
44785
  process.stderr.write(`${question} `);
44739
44786
  rl.once("line", (answer) => {
44740
44787
  rl.close();
44741
44788
  const trimmed = answer.trim();
44742
44789
  if (trimmed === "") {
44743
- resolve41(true);
44790
+ resolve42(true);
44744
44791
  return;
44745
44792
  }
44746
- resolve41(/^y(es)?$/i.test(trimmed));
44793
+ resolve42(/^y(es)?$/i.test(trimmed));
44747
44794
  });
44748
44795
  });
44749
44796
  }
@@ -45601,13 +45648,13 @@ var MultipartBody = class {
45601
45648
  // node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs
45602
45649
  var import_web = require("node:stream/web");
45603
45650
  var fileFromPathWarned = false;
45604
- async function fileFromPath3(path57, ...args) {
45651
+ async function fileFromPath3(path58, ...args) {
45605
45652
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
45606
45653
  if (!fileFromPathWarned) {
45607
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path57)}) instead`);
45654
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path58)}) instead`);
45608
45655
  fileFromPathWarned = true;
45609
45656
  }
45610
- return await _fileFromPath(path57, ...args);
45657
+ return await _fileFromPath(path58, ...args);
45611
45658
  }
45612
45659
  var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
45613
45660
  var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -46103,8 +46150,8 @@ async function defaultParseResponse(props) {
46103
46150
  }
46104
46151
  var APIPromise = class _APIPromise extends Promise {
46105
46152
  constructor(responsePromise, parseResponse = defaultParseResponse) {
46106
- super((resolve41) => {
46107
- resolve41(null);
46153
+ super((resolve42) => {
46154
+ resolve42(null);
46108
46155
  });
46109
46156
  this.responsePromise = responsePromise;
46110
46157
  this.parseResponse = parseResponse;
@@ -46204,29 +46251,29 @@ var APIClient = class {
46204
46251
  defaultIdempotencyKey() {
46205
46252
  return `stainless-node-retry-${uuid4()}`;
46206
46253
  }
46207
- get(path57, opts) {
46208
- return this.methodRequest("get", path57, opts);
46254
+ get(path58, opts) {
46255
+ return this.methodRequest("get", path58, opts);
46209
46256
  }
46210
- post(path57, opts) {
46211
- return this.methodRequest("post", path57, opts);
46257
+ post(path58, opts) {
46258
+ return this.methodRequest("post", path58, opts);
46212
46259
  }
46213
- patch(path57, opts) {
46214
- return this.methodRequest("patch", path57, opts);
46260
+ patch(path58, opts) {
46261
+ return this.methodRequest("patch", path58, opts);
46215
46262
  }
46216
- put(path57, opts) {
46217
- return this.methodRequest("put", path57, opts);
46263
+ put(path58, opts) {
46264
+ return this.methodRequest("put", path58, opts);
46218
46265
  }
46219
- delete(path57, opts) {
46220
- return this.methodRequest("delete", path57, opts);
46266
+ delete(path58, opts) {
46267
+ return this.methodRequest("delete", path58, opts);
46221
46268
  }
46222
- methodRequest(method, path57, opts) {
46269
+ methodRequest(method, path58, opts) {
46223
46270
  return this.request(Promise.resolve(opts).then(async (opts2) => {
46224
46271
  const body = opts2 && isBlobLike(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
46225
- return { method, path: path57, ...opts2, body };
46272
+ return { method, path: path58, ...opts2, body };
46226
46273
  }));
46227
46274
  }
46228
- getAPIList(path57, Page, opts) {
46229
- return this.requestAPIList(Page, { method: "get", path: path57, ...opts });
46275
+ getAPIList(path58, Page, opts) {
46276
+ return this.requestAPIList(Page, { method: "get", path: path58, ...opts });
46230
46277
  }
46231
46278
  calculateContentLength(body) {
46232
46279
  if (typeof body === "string") {
@@ -46244,10 +46291,10 @@ var APIClient = class {
46244
46291
  return null;
46245
46292
  }
46246
46293
  buildRequest(options) {
46247
- const { method, path: path57, query, headers = {} } = options;
46294
+ const { method, path: path58, query, headers = {} } = options;
46248
46295
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
46249
46296
  const contentLength = this.calculateContentLength(body);
46250
- const url = this.buildURL(path57, query);
46297
+ const url = this.buildURL(path58, query);
46251
46298
  if ("timeout" in options)
46252
46299
  validatePositiveInteger("timeout", options.timeout);
46253
46300
  const timeout = options.timeout ?? this.timeout;
@@ -46356,8 +46403,8 @@ var APIClient = class {
46356
46403
  const request = this.makeRequest(options, null);
46357
46404
  return new PagePromise(this, request, Page);
46358
46405
  }
46359
- buildURL(path57, query) {
46360
- const url = isAbsoluteURL(path57) ? new URL(path57) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path57.startsWith("/") ? path57.slice(1) : path57));
46406
+ buildURL(path58, query) {
46407
+ const url = isAbsoluteURL(path58) ? new URL(path58) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path58.startsWith("/") ? path58.slice(1) : path58));
46361
46408
  const defaultQuery = this.defaultQuery();
46362
46409
  if (!isEmptyObj(defaultQuery)) {
46363
46410
  query = { ...defaultQuery, ...query };
@@ -46642,7 +46689,7 @@ var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i");
46642
46689
  var isAbsoluteURL = (url) => {
46643
46690
  return startsWithSchemeRegexp.test(url);
46644
46691
  };
46645
- var sleep = (ms) => new Promise((resolve41) => setTimeout(resolve41, ms));
46692
+ var sleep = (ms) => new Promise((resolve42) => setTimeout(resolve42, ms));
46646
46693
  var validatePositiveInteger = (name, n2) => {
46647
46694
  if (typeof n2 !== "number" || !Number.isInteger(n2)) {
46648
46695
  throw new AnthropicError(`${name} must be an integer`);
@@ -47133,12 +47180,12 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
47133
47180
  }
47134
47181
  return this._emit("error", new AnthropicError(String(error3)));
47135
47182
  });
47136
- __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_connectedPromise, new Promise((resolve41, reject) => {
47137
- __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveConnectedPromise, resolve41, "f");
47183
+ __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_connectedPromise, new Promise((resolve42, reject) => {
47184
+ __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveConnectedPromise, resolve42, "f");
47138
47185
  __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_rejectConnectedPromise, reject, "f");
47139
47186
  }), "f");
47140
- __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_endPromise, new Promise((resolve41, reject) => {
47141
- __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveEndPromise, resolve41, "f");
47187
+ __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_endPromise, new Promise((resolve42, reject) => {
47188
+ __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveEndPromise, resolve42, "f");
47142
47189
  __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_rejectEndPromise, reject, "f");
47143
47190
  }), "f");
47144
47191
  __classPrivateFieldGet8(this, _PromptCachingBetaMessageStream_connectedPromise, "f").catch(() => {
@@ -47267,11 +47314,11 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
47267
47314
  * const message = await stream.emitted('message') // rejects if the stream errors
47268
47315
  */
47269
47316
  emitted(event) {
47270
- return new Promise((resolve41, reject) => {
47317
+ return new Promise((resolve42, reject) => {
47271
47318
  __classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_catchingPromiseCreated, true, "f");
47272
47319
  if (event !== "error")
47273
47320
  this.once("error", reject);
47274
- this.once(event, resolve41);
47321
+ this.once(event, resolve42);
47275
47322
  });
47276
47323
  }
47277
47324
  async done() {
@@ -47498,7 +47545,7 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
47498
47545
  if (done) {
47499
47546
  return { value: void 0, done: true };
47500
47547
  }
47501
- return new Promise((resolve41, reject) => readQueue.push({ resolve: resolve41, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
47548
+ return new Promise((resolve42, reject) => readQueue.push({ resolve: resolve42, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
47502
47549
  }
47503
47550
  const chunk = pushQueue.shift();
47504
47551
  return { value: chunk, done: false };
@@ -47646,12 +47693,12 @@ var MessageStream = class _MessageStream {
47646
47693
  }
47647
47694
  return this._emit("error", new AnthropicError(String(error3)));
47648
47695
  });
47649
- __classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve41, reject) => {
47650
- __classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve41, "f");
47696
+ __classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve42, reject) => {
47697
+ __classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve42, "f");
47651
47698
  __classPrivateFieldSet8(this, _MessageStream_rejectConnectedPromise, reject, "f");
47652
47699
  }), "f");
47653
- __classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve41, reject) => {
47654
- __classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve41, "f");
47700
+ __classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve42, reject) => {
47701
+ __classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve42, "f");
47655
47702
  __classPrivateFieldSet8(this, _MessageStream_rejectEndPromise, reject, "f");
47656
47703
  }), "f");
47657
47704
  __classPrivateFieldGet9(this, _MessageStream_connectedPromise, "f").catch(() => {
@@ -47780,11 +47827,11 @@ var MessageStream = class _MessageStream {
47780
47827
  * const message = await stream.emitted('message') // rejects if the stream errors
47781
47828
  */
47782
47829
  emitted(event) {
47783
- return new Promise((resolve41, reject) => {
47830
+ return new Promise((resolve42, reject) => {
47784
47831
  __classPrivateFieldSet8(this, _MessageStream_catchingPromiseCreated, true, "f");
47785
47832
  if (event !== "error")
47786
47833
  this.once("error", reject);
47787
- this.once(event, resolve41);
47834
+ this.once(event, resolve42);
47788
47835
  });
47789
47836
  }
47790
47837
  async done() {
@@ -48011,7 +48058,7 @@ var MessageStream = class _MessageStream {
48011
48058
  if (done) {
48012
48059
  return { value: void 0, done: true };
48013
48060
  }
48014
- return new Promise((resolve41, reject) => readQueue.push({ resolve: resolve41, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
48061
+ return new Promise((resolve42, reject) => readQueue.push({ resolve: resolve42, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
48015
48062
  }
48016
48063
  const chunk = pushQueue.shift();
48017
48064
  return { value: chunk, done: false };
@@ -48271,11 +48318,11 @@ async function promptApplyAgentMdProposal(repoPath) {
48271
48318
  }
48272
48319
  async function askYesNo2(question) {
48273
48320
  const rl = readline2.createInterface({ input: process.stdin, output: process.stderr });
48274
- return new Promise((resolve41) => {
48321
+ return new Promise((resolve42) => {
48275
48322
  process.stderr.write(`${question} `);
48276
48323
  rl.once("line", (answer) => {
48277
48324
  rl.close();
48278
- resolve41(/^y(es)?$/i.test(answer.trim()));
48325
+ resolve42(/^y(es)?$/i.test(answer.trim()));
48279
48326
  });
48280
48327
  });
48281
48328
  }
@@ -48505,7 +48552,7 @@ async function executeAuthoringToolCall(toolName, input, repoPath, harnessDir, c
48505
48552
  }
48506
48553
  async function askUser(question, options) {
48507
48554
  const rl = readline3.createInterface({ input: process.stdin, output: process.stderr });
48508
- return new Promise((resolve41) => {
48555
+ return new Promise((resolve42) => {
48509
48556
  process.stderr.write("\n");
48510
48557
  process.stderr.write(`\u2753 ${question}
48511
48558
  `);
@@ -48516,7 +48563,7 @@ async function askUser(question, options) {
48516
48563
  process.stderr.write("> ");
48517
48564
  rl.once("line", (answer) => {
48518
48565
  rl.close();
48519
- resolve41(answer.trim());
48566
+ resolve42(answer.trim());
48520
48567
  });
48521
48568
  });
48522
48569
  }
@@ -48660,7 +48707,7 @@ function runScript(scriptPath, args = [], options = {}) {
48660
48707
  function runScriptCapture(scriptPath, args = [], options = {}) {
48661
48708
  const stream = options.stream ?? false;
48662
48709
  const { stream: _stream, ...spawnOptions } = options;
48663
- return new Promise((resolve41) => {
48710
+ return new Promise((resolve42) => {
48664
48711
  const proc = (0, import_child_process.spawn)("bash", [scriptPath, ...args], {
48665
48712
  ...spawnOptions,
48666
48713
  stdio: ["inherit", "pipe", "pipe"]
@@ -48675,13 +48722,13 @@ function runScriptCapture(scriptPath, args = [], options = {}) {
48675
48722
  stderr += d2;
48676
48723
  if (stream) process.stderr.write(d2);
48677
48724
  });
48678
- proc.on("close", (code) => resolve41({ stdout, stderr, code: code ?? 0 }));
48725
+ proc.on("close", (code) => resolve42({ stdout, stderr, code: code ?? 0 }));
48679
48726
  });
48680
48727
  }
48681
48728
  function runShellCommand(command2, options = {}) {
48682
48729
  const stream = options.stream ?? false;
48683
48730
  const { stream: _stream, ...spawnOptions } = options;
48684
- return new Promise((resolve41) => {
48731
+ return new Promise((resolve42) => {
48685
48732
  const proc = (0, import_child_process.spawn)("bash", ["-lc", command2], {
48686
48733
  ...spawnOptions,
48687
48734
  stdio: ["inherit", "pipe", "pipe"]
@@ -48696,7 +48743,7 @@ function runShellCommand(command2, options = {}) {
48696
48743
  stderr += d2;
48697
48744
  if (stream) process.stderr.write(d2);
48698
48745
  });
48699
- proc.on("close", (code) => resolve41({ stdout, stderr, code: code ?? 0 }));
48746
+ proc.on("close", (code) => resolve42({ stdout, stderr, code: code ?? 0 }));
48700
48747
  });
48701
48748
  }
48702
48749
 
@@ -49877,12 +49924,12 @@ function printAdaptationPrompt(content) {
49877
49924
  }
49878
49925
  function askYesNo3(question) {
49879
49926
  const rl = readline4.createInterface({ input: process.stdin, output: process.stderr });
49880
- return new Promise((resolve41) => {
49927
+ return new Promise((resolve42) => {
49881
49928
  process.stderr.write(`${question} `);
49882
49929
  rl.once("line", (answer) => {
49883
49930
  rl.close();
49884
49931
  const trimmed = answer.trim();
49885
- resolve41(trimmed === "" || /^y(es)?$/i.test(trimmed));
49932
+ resolve42(trimmed === "" || /^y(es)?$/i.test(trimmed));
49886
49933
  });
49887
49934
  });
49888
49935
  }
@@ -49969,16 +50016,16 @@ async function promptScaffoldCursorRule(exists) {
49969
50016
  }
49970
50017
  async function askYesNo4(question) {
49971
50018
  const rl = readline5.createInterface({ input: process.stdin, output: process.stderr });
49972
- return new Promise((resolve41) => {
50019
+ return new Promise((resolve42) => {
49973
50020
  process.stderr.write(`${question} `);
49974
50021
  rl.once("line", (answer) => {
49975
50022
  rl.close();
49976
50023
  const trimmed = answer.trim();
49977
50024
  if (trimmed === "") {
49978
- resolve41(true);
50025
+ resolve42(true);
49979
50026
  return;
49980
50027
  }
49981
- resolve41(/^y(es)?$/i.test(trimmed));
50028
+ resolve42(/^y(es)?$/i.test(trimmed));
49982
50029
  });
49983
50030
  });
49984
50031
  }
@@ -50405,6 +50452,13 @@ function listRegisteredRepos() {
50405
50452
  }
50406
50453
  return kept;
50407
50454
  }
50455
+ function clearRegisteredRepos() {
50456
+ const registry2 = readRegistry();
50457
+ const count = registry2.repos.length;
50458
+ if (count === 0) return 0;
50459
+ writeRegistry({ repos: [] });
50460
+ return count;
50461
+ }
50408
50462
 
50409
50463
  // src/core/control-sync.ts
50410
50464
  init_portal_credentials();
@@ -52521,7 +52575,7 @@ async function waitForControlApi(apiUrl = getControlApiUrl(), timeoutMs = 6e4, i
52521
52575
  const deadline = Date.now() + timeoutMs;
52522
52576
  while (Date.now() < deadline) {
52523
52577
  if (await isControlApiReachable(apiUrl)) return true;
52524
- await new Promise((resolve41) => setTimeout(resolve41, intervalMs));
52578
+ await new Promise((resolve42) => setTimeout(resolve42, intervalMs));
52525
52579
  }
52526
52580
  return false;
52527
52581
  }
@@ -53756,12 +53810,12 @@ async function recordCommitAssociation(cwd) {
53756
53810
  // src/core/commit-gate-onboarding.ts
53757
53811
  function askYesNo5(question) {
53758
53812
  const rl = readline6.createInterface({ input: process.stdin, output: process.stderr });
53759
- return new Promise((resolve41) => {
53813
+ return new Promise((resolve42) => {
53760
53814
  process.stderr.write(`${question} `);
53761
53815
  rl.once("line", (answer) => {
53762
53816
  rl.close();
53763
53817
  const trimmed = answer.trim();
53764
- resolve41(trimmed === "" || /^y(es)?$/i.test(trimmed));
53818
+ resolve42(trimmed === "" || /^y(es)?$/i.test(trimmed));
53765
53819
  });
53766
53820
  });
53767
53821
  }
@@ -54471,8 +54525,8 @@ async function handleLaunch(argv) {
54471
54525
  console.error(guard.reason ?? "");
54472
54526
  const readline10 = await import("readline");
54473
54527
  const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
54474
- const answer = await new Promise((resolve41) => {
54475
- rl.question("Replace this slot? [y/N] ", resolve41);
54528
+ const answer = await new Promise((resolve42) => {
54529
+ rl.question("Replace this slot? [y/N] ", resolve42);
54476
54530
  });
54477
54531
  rl.close();
54478
54532
  if (!/^[Yy]$/.test(answer.trim())) {
@@ -54488,8 +54542,8 @@ async function handleLaunch(argv) {
54488
54542
  warn("Worktree has uncommitted changes.");
54489
54543
  const readline10 = await import("readline");
54490
54544
  const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
54491
- const answer = await new Promise((resolve41) => {
54492
- rl.question("Discard uncommitted changes? [y/N] ", resolve41);
54545
+ const answer = await new Promise((resolve42) => {
54546
+ rl.question("Discard uncommitted changes? [y/N] ", resolve42);
54493
54547
  });
54494
54548
  rl.close();
54495
54549
  if (!/^[Yy]$/.test(answer.trim())) {
@@ -54706,7 +54760,7 @@ function printNextSteps(auto2) {
54706
54760
  }
54707
54761
 
54708
54762
  // src/cli/commands/control.ts
54709
- var path52 = __toESM(require("path"));
54763
+ var path53 = __toESM(require("path"));
54710
54764
 
54711
54765
  // node_modules/@inquirer/core/dist/esm/lib/key.mjs
54712
54766
  var isUpKey = (key) => (
@@ -55726,13 +55780,13 @@ var PromisePolyfill = class extends Promise {
55726
55780
  // Available starting from Node 22
55727
55781
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
55728
55782
  static withResolver() {
55729
- let resolve41;
55783
+ let resolve42;
55730
55784
  let reject;
55731
55785
  const promise = new Promise((res, rej) => {
55732
- resolve41 = res;
55786
+ resolve42 = res;
55733
55787
  reject = rej;
55734
55788
  });
55735
- return { promise, resolve: resolve41, reject };
55789
+ return { promise, resolve: resolve42, reject };
55736
55790
  }
55737
55791
  };
55738
55792
 
@@ -55749,7 +55803,7 @@ function createPrompt(view) {
55749
55803
  output
55750
55804
  });
55751
55805
  const screen = new ScreenManager(rl);
55752
- const { promise, resolve: resolve41, reject } = PromisePolyfill.withResolver();
55806
+ const { promise, resolve: resolve42, reject } = PromisePolyfill.withResolver();
55753
55807
  const cancel = () => reject(new CancelPromptError());
55754
55808
  if (signal) {
55755
55809
  const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
@@ -55773,7 +55827,7 @@ function createPrompt(view) {
55773
55827
  cycle(() => {
55774
55828
  try {
55775
55829
  const nextView = view(config2, (value) => {
55776
- setImmediate(() => resolve41(value));
55830
+ setImmediate(() => resolve42(value));
55777
55831
  });
55778
55832
  const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
55779
55833
  screen.render(content, bottomContent);
@@ -56760,9 +56814,9 @@ var import_run_async = __toESM(require_run_async(), 1);
56760
56814
  var import_mute_stream2 = __toESM(require_lib3(), 1);
56761
56815
  var import_ansi_escapes5 = __toESM(require_ansi_escapes(), 1);
56762
56816
  var _2 = {
56763
- set: (obj, path57 = "", value) => {
56817
+ set: (obj, path58 = "", value) => {
56764
56818
  let pointer = obj;
56765
- path57.split(".").forEach((key, index, arr) => {
56819
+ path58.split(".").forEach((key, index, arr) => {
56766
56820
  if (key === "__proto__" || key === "constructor")
56767
56821
  return;
56768
56822
  if (index === arr.length - 1) {
@@ -56773,8 +56827,8 @@ var _2 = {
56773
56827
  pointer = pointer[key];
56774
56828
  });
56775
56829
  },
56776
- get: (obj, path57 = "", defaultValue) => {
56777
- const travel = (regexp) => String.prototype.split.call(path57, regexp).filter(Boolean).reduce(
56830
+ get: (obj, path58 = "", defaultValue) => {
56831
+ const travel = (regexp) => String.prototype.split.call(path58, regexp).filter(Boolean).reduce(
56778
56832
  // @ts-expect-error implicit any on res[key]
56779
56833
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
56780
56834
  obj
@@ -56888,7 +56942,7 @@ var PromptsRunner = class {
56888
56942
  throw new Error(`Prompt for type ${question.type} not found`);
56889
56943
  }
56890
56944
  let cleanupSignal;
56891
- const promptFn = isPromptConstructor(prompt2) ? (q2, { signal: signal2 } = {}) => new Promise((resolve41, reject) => {
56945
+ const promptFn = isPromptConstructor(prompt2) ? (q2, { signal: signal2 } = {}) => new Promise((resolve42, reject) => {
56892
56946
  const rl = import_node_readline.default.createInterface(setupReadlineOptions(this.opt));
56893
56947
  rl.resume();
56894
56948
  const onClose = () => {
@@ -56924,7 +56978,7 @@ var PromptsRunner = class {
56924
56978
  cleanupSignal = void 0;
56925
56979
  };
56926
56980
  }
56927
- activePrompt.run().then(resolve41, reject).finally(cleanup);
56981
+ activePrompt.run().then(resolve42, reject).finally(cleanup);
56928
56982
  }) : prompt2;
56929
56983
  const { signal: moduleSignal } = this.opt;
56930
56984
  if (moduleSignal?.aborted) {
@@ -57097,7 +57151,7 @@ function openBrowser(url) {
57097
57151
  }
57098
57152
  async function loginViaBrowser(portalUrl, openUrl = openBrowser) {
57099
57153
  const state = (0, import_crypto.randomUUID)();
57100
- return new Promise((resolve41, reject) => {
57154
+ return new Promise((resolve42, reject) => {
57101
57155
  let timer;
57102
57156
  const server = http.createServer((req, res) => {
57103
57157
  const requestUrl = new URL(req.url ?? "", "http://127.0.0.1");
@@ -57120,7 +57174,7 @@ async function loginViaBrowser(portalUrl, openUrl = openBrowser) {
57120
57174
  res.writeHead(200, { "Content-Type": "text/html" });
57121
57175
  res.end("<h1>Logged in</h1><p>You can close this tab and return to the terminal.</p>");
57122
57176
  cleanup();
57123
- resolve41({ portalUrl, token, workspace, email: email2, createdAt: (/* @__PURE__ */ new Date()).toISOString() });
57177
+ resolve42({ portalUrl, token, workspace, email: email2, createdAt: (/* @__PURE__ */ new Date()).toISOString() });
57124
57178
  });
57125
57179
  const cleanup = () => {
57126
57180
  clearTimeout(timer);
@@ -57207,8 +57261,8 @@ async function askYesNo6(question) {
57207
57261
  if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
57208
57262
  const readline10 = await import("readline");
57209
57263
  const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
57210
- const answer = await new Promise((resolve41) => {
57211
- rl.question(question, resolve41);
57264
+ const answer = await new Promise((resolve42) => {
57265
+ rl.question(question, resolve42);
57212
57266
  });
57213
57267
  rl.close();
57214
57268
  return /^[Yy]$/.test(answer.trim());
@@ -57349,6 +57403,162 @@ async function unregisterRepoWithControl(options) {
57349
57403
  };
57350
57404
  }
57351
57405
 
57406
+ // src/core/control-reset.ts
57407
+ init_control_config();
57408
+
57409
+ // src/core/harness-scrub.ts
57410
+ var fs47 = __toESM(require("fs"));
57411
+ var path52 = __toESM(require("path"));
57412
+ var HARNESS_SCRUB_DIRS = ["runs", "validations", "state", "slots"];
57413
+ function scrubLocalHarnessDirs(repoPath) {
57414
+ const results = [];
57415
+ const resolved = path52.resolve(repoPath);
57416
+ if (!fs47.existsSync(resolved)) {
57417
+ for (const directory of HARNESS_SCRUB_DIRS) {
57418
+ results.push({
57419
+ path: path52.join(resolved, ".har", directory),
57420
+ directory,
57421
+ deleted: false,
57422
+ error: "repository path does not exist"
57423
+ });
57424
+ }
57425
+ return results;
57426
+ }
57427
+ for (const directory of HARNESS_SCRUB_DIRS) {
57428
+ const target = path52.join(resolved, ".har", directory);
57429
+ if (!fs47.existsSync(target)) {
57430
+ results.push({ path: target, directory, deleted: true });
57431
+ continue;
57432
+ }
57433
+ try {
57434
+ fs47.rmSync(target, { recursive: true, force: true });
57435
+ results.push({
57436
+ path: target,
57437
+ directory,
57438
+ deleted: !fs47.existsSync(target),
57439
+ error: fs47.existsSync(target) ? "failed to remove directory" : void 0
57440
+ });
57441
+ } catch (err) {
57442
+ results.push({
57443
+ path: target,
57444
+ directory,
57445
+ deleted: !fs47.existsSync(target),
57446
+ error: err instanceof Error ? err.message : String(err)
57447
+ });
57448
+ }
57449
+ }
57450
+ return results;
57451
+ }
57452
+ function scrubLocalHarnessForRepos(repoPaths) {
57453
+ const results = [];
57454
+ const seen = /* @__PURE__ */ new Set();
57455
+ for (const repoPath of repoPaths) {
57456
+ const key = path52.resolve(repoPath);
57457
+ if (seen.has(key)) continue;
57458
+ seen.add(key);
57459
+ results.push(...scrubLocalHarnessDirs(key));
57460
+ }
57461
+ return results;
57462
+ }
57463
+
57464
+ // src/core/control-reset.ts
57465
+ async function askYesNo7(question) {
57466
+ if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
57467
+ const readline10 = await import("readline");
57468
+ const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
57469
+ const answer = await new Promise((resolve42) => {
57470
+ rl.question(question, resolve42);
57471
+ });
57472
+ rl.close();
57473
+ return /^[Yy]$/.test(answer.trim());
57474
+ }
57475
+ async function confirmControlReset(options) {
57476
+ if (options.yes) return true;
57477
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
57478
+ throw new Error("Non-interactive terminal \u2014 pass --yes");
57479
+ }
57480
+ return askYesNo7(
57481
+ `Clear Mission Control data for ${options.repoCount} registered repositor${options.repoCount === 1 ? "y" : "ies"} (and scrub local .har history)? [y/N] `
57482
+ );
57483
+ }
57484
+ async function resetMissionControlFromCli(options = {}) {
57485
+ const apiUrl = options.apiUrl ?? getControlApiUrl();
57486
+ const scrubLocalHarness = options.scrubLocalHarness !== false;
57487
+ const clearRegistry = options.clearRegistry !== false;
57488
+ const registryPaths = listRegisteredRepos();
57489
+ let apiRepoPaths = [];
57490
+ let apiUnreachable = false;
57491
+ let repositoriesDeleted = 0;
57492
+ let unregisteredCleared = 0;
57493
+ let apiScrubbed = [];
57494
+ if (!options.dryRun) {
57495
+ try {
57496
+ const listResponse = await fetch(`${apiUrl}/api/repos`, {
57497
+ signal: AbortSignal.timeout(5e3)
57498
+ });
57499
+ if (listResponse.ok) {
57500
+ const repos = await listResponse.json();
57501
+ apiRepoPaths = repos.map((repo) => repo.path);
57502
+ } else {
57503
+ apiUnreachable = true;
57504
+ }
57505
+ } catch {
57506
+ apiUnreachable = true;
57507
+ }
57508
+ }
57509
+ const repoPaths = [.../* @__PURE__ */ new Set([...registryPaths, ...apiRepoPaths])].sort();
57510
+ let scrubbed = [];
57511
+ if (scrubLocalHarness) {
57512
+ scrubbed = options.dryRun ? repoPaths.flatMap(
57513
+ (repoPath) => ["runs", "validations", "state", "slots"].map((directory) => ({
57514
+ path: `${repoPath}/.har/${directory}`,
57515
+ directory,
57516
+ deleted: false
57517
+ }))
57518
+ ) : scrubLocalHarnessForRepos(repoPaths);
57519
+ }
57520
+ if (!options.dryRun && !apiUnreachable) {
57521
+ const response = await fetch(`${apiUrl}/api/reset`, {
57522
+ method: "POST",
57523
+ headers: { "Content-Type": "application/json" },
57524
+ body: JSON.stringify({
57525
+ confirm: "RESET",
57526
+ // Host scrub already ran; skip duplicate best-effort inside Docker/API.
57527
+ scrubLocalHarness: false
57528
+ })
57529
+ });
57530
+ if (!response.ok) {
57531
+ const text = await response.text().catch(() => "");
57532
+ throw new Error(`Control API ${response.status}: ${text || response.statusText}`);
57533
+ }
57534
+ const payload = await response.json();
57535
+ repositoriesDeleted = payload.repositoriesDeleted;
57536
+ unregisteredCleared = payload.unregisteredCleared;
57537
+ apiScrubbed = payload.scrubbed ?? [];
57538
+ } else if (!options.dryRun && apiUnreachable) {
57539
+ }
57540
+ let registryCleared = false;
57541
+ if (clearRegistry) {
57542
+ if (options.dryRun) {
57543
+ registryCleared = registryPaths.length > 0;
57544
+ } else {
57545
+ registryCleared = clearRegisteredRepos() > 0;
57546
+ }
57547
+ }
57548
+ return {
57549
+ ok: true,
57550
+ dryRun: options.dryRun === true,
57551
+ repositoriesDeleted: options.dryRun ? repoPaths.length : repositoriesDeleted,
57552
+ unregisteredCleared,
57553
+ scrubLocalHarness,
57554
+ clearRegistry,
57555
+ registryCleared,
57556
+ repoPaths,
57557
+ scrubbed: scrubbed.length > 0 ? scrubbed : apiScrubbed,
57558
+ apiUnreachable: apiUnreachable || void 0
57559
+ };
57560
+ }
57561
+
57352
57562
  // src/cli/commands/control.ts
57353
57563
  var controlCommand = {
57354
57564
  command: "control <subcommand>",
@@ -57421,9 +57631,27 @@ var controlCommand = {
57421
57631
  describe: "Store this ingest token directly instead of browser login"
57422
57632
  }),
57423
57633
  handleLogin
57634
+ ).command(
57635
+ "reset",
57636
+ "Clear all Mission Control data and optionally scrub local .har history",
57637
+ (y2) => y2.option("api-url", { type: "string", describe: "Control API URL" }).option("yes", {
57638
+ alias: "y",
57639
+ type: "boolean",
57640
+ default: false,
57641
+ describe: "Skip confirmation prompt"
57642
+ }).option("no-scrub-local", {
57643
+ type: "boolean",
57644
+ default: false,
57645
+ describe: "Keep local .har/{runs,validations,state,slots} directories"
57646
+ }).option("keep-registry", {
57647
+ type: "boolean",
57648
+ default: false,
57649
+ describe: "Keep ~/.har/repos.json entries (default clears them)"
57650
+ }).option("dry-run", { type: "boolean", default: false }).option("json", { type: "boolean", default: false }),
57651
+ handleReset
57424
57652
  ).demandCommand(
57425
57653
  1,
57426
- "Please specify a subcommand: up, down, register, unregister, sync, watch, login"
57654
+ "Please specify a subcommand: up, down, register, unregister, sync, watch, login, reset"
57427
57655
  ),
57428
57656
  handler: () => {
57429
57657
  }
@@ -57484,7 +57712,7 @@ async function handleDown() {
57484
57712
  process.exit(code);
57485
57713
  }
57486
57714
  async function handleRegister(argv) {
57487
- const repoPath = path52.resolve(argv.repo);
57715
+ const repoPath = path53.resolve(argv.repo);
57488
57716
  header("har control register");
57489
57717
  info(`Repository: ${repoPath}`);
57490
57718
  try {
@@ -57507,8 +57735,76 @@ async function handleRegister(argv) {
57507
57735
  process.exit(1);
57508
57736
  }
57509
57737
  }
57738
+ async function handleReset(argv) {
57739
+ try {
57740
+ const repoCount = listRegisteredRepos().length;
57741
+ if (!argv.yes && !argv.dryRun) {
57742
+ const proceed = await confirmControlReset({ yes: false, repoCount });
57743
+ if (!proceed) {
57744
+ error("Aborted \u2014 Mission Control left unchanged.");
57745
+ process.exit(2);
57746
+ }
57747
+ }
57748
+ const result = await resetMissionControlFromCli({
57749
+ apiUrl: argv.apiUrl,
57750
+ dryRun: argv.dryRun,
57751
+ scrubLocalHarness: !argv.noScrubLocal,
57752
+ clearRegistry: !argv.keepRegistry
57753
+ });
57754
+ if (argv.json) {
57755
+ process.stdout.write(JSON.stringify(result, null, 2) + "\n");
57756
+ return;
57757
+ }
57758
+ header("har control reset");
57759
+ if (argv.dryRun) {
57760
+ info(
57761
+ `Dry run \u2014 would clear Mission Control for ${result.repoPaths.length} repositor${result.repoPaths.length === 1 ? "y" : "ies"}`
57762
+ );
57763
+ if (result.scrubLocalHarness) {
57764
+ info(`Would scrub ${result.scrubbed.length} local .har director${result.scrubbed.length === 1 ? "y" : "ies"}`);
57765
+ }
57766
+ if (result.clearRegistry) {
57767
+ info("Would clear local sync registry (~/.har/repos.json)");
57768
+ }
57769
+ return;
57770
+ }
57771
+ if (result.apiUnreachable) {
57772
+ warn("Mission Control API unreachable \u2014 dashboard DB not cleared");
57773
+ } else {
57774
+ success(
57775
+ `Cleared ${result.repositoriesDeleted} repositor${result.repositoriesDeleted === 1 ? "y" : "ies"} from Mission Control`
57776
+ );
57777
+ if (result.unregisteredCleared > 0) {
57778
+ success(`Cleared ${result.unregisteredCleared} unregister blocklist entr${result.unregisteredCleared === 1 ? "y" : "ies"}`);
57779
+ }
57780
+ }
57781
+ if (result.scrubLocalHarness) {
57782
+ const deleted = result.scrubbed.filter((row) => row.deleted).length;
57783
+ const failed = result.scrubbed.filter((row) => !row.deleted && row.error);
57784
+ success(`Scrubbed ${deleted} local .har director${deleted === 1 ? "y" : "ies"}`);
57785
+ for (const failure of failed) {
57786
+ warn(`Failed to delete ${failure.path}: ${failure.error}`);
57787
+ }
57788
+ }
57789
+ if (result.registryCleared) {
57790
+ success("Cleared local sync registry (~/.har/repos.json)");
57791
+ } else if (result.clearRegistry) {
57792
+ info("Local sync registry was already empty");
57793
+ }
57794
+ info("Re-register with: har control register --repo <path>");
57795
+ } catch (err) {
57796
+ if (argv.json) {
57797
+ process.stdout.write(
57798
+ JSON.stringify({ ok: false, error: err.message }, null, 2) + "\n"
57799
+ );
57800
+ process.exit(1);
57801
+ }
57802
+ error(err.message);
57803
+ process.exit(1);
57804
+ }
57805
+ }
57510
57806
  async function handleUnregister(argv) {
57511
- const repoPath = path52.resolve(argv.repo);
57807
+ const repoPath = path53.resolve(argv.repo);
57512
57808
  const worktrees = listUnregisterWorktreeCandidates(repoPath);
57513
57809
  try {
57514
57810
  let deleteWorktrees = argv.deleteWorktrees;
@@ -57669,7 +57965,7 @@ async function handleWatch(argv) {
57669
57965
  };
57670
57966
  const tick = async () => {
57671
57967
  if (argv.repo) {
57672
- await syncOne(path52.resolve(argv.repo));
57968
+ await syncOne(path53.resolve(argv.repo));
57673
57969
  return;
57674
57970
  }
57675
57971
  try {
@@ -57719,11 +58015,11 @@ async function handleLogin(argv) {
57719
58015
  }
57720
58016
 
57721
58017
  // src/cli/commands/hooks.ts
57722
- var path54 = __toESM(require("path"));
58018
+ var path55 = __toESM(require("path"));
57723
58019
 
57724
58020
  // src/core/claude-hooks.ts
57725
- var fs47 = __toESM(require("fs"));
57726
- var path53 = __toESM(require("path"));
58021
+ var fs48 = __toESM(require("fs"));
58022
+ var path54 = __toESM(require("path"));
57727
58023
  var CLAUDE_GUARD_RELATIVE_PATH = ".har/hooks/claude-worktree-guard.sh";
57728
58024
  var CLAUDE_SETTINGS_RELATIVE_PATH = ".claude/settings.json";
57729
58025
  var GUARD_MATCHER = "Edit|Write|MultiEdit|NotebookEdit";
@@ -57734,8 +58030,8 @@ function isHarGuardEntry(entry) {
57734
58030
  );
57735
58031
  }
57736
58032
  function readSettings(settingsPath) {
57737
- if (!fs47.existsSync(settingsPath)) return {};
57738
- const raw = fs47.readFileSync(settingsPath, "utf8").trim();
58033
+ if (!fs48.existsSync(settingsPath)) return {};
58034
+ const raw = fs48.readFileSync(settingsPath, "utf8").trim();
57739
58035
  if (raw === "") return {};
57740
58036
  const parsed = JSON.parse(raw);
57741
58037
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
@@ -57744,19 +58040,19 @@ function readSettings(settingsPath) {
57744
58040
  return parsed;
57745
58041
  }
57746
58042
  function writeSettings(settingsPath, settings) {
57747
- fs47.mkdirSync(path53.dirname(settingsPath), { recursive: true });
57748
- fs47.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
58043
+ fs48.mkdirSync(path54.dirname(settingsPath), { recursive: true });
58044
+ fs48.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
57749
58045
  }
57750
58046
  function installClaudeGuard(repoPath) {
57751
58047
  const templatePath = resolveTemplateFile("claude-worktree-guard.sh.template");
57752
58048
  if (!templatePath) {
57753
58049
  throw new Error("Guard template not found (claude-worktree-guard.sh.template). Run npm run build.");
57754
58050
  }
57755
- const guardScript = path53.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
57756
- fs47.mkdirSync(path53.dirname(guardScript), { recursive: true });
57757
- fs47.copyFileSync(templatePath, guardScript);
57758
- fs47.chmodSync(guardScript, 493);
57759
- const settingsPath = path53.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
58051
+ const guardScript = path54.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
58052
+ fs48.mkdirSync(path54.dirname(guardScript), { recursive: true });
58053
+ fs48.copyFileSync(templatePath, guardScript);
58054
+ fs48.chmodSync(guardScript, 493);
58055
+ const settingsPath = path54.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
57760
58056
  const settings = readSettings(settingsPath);
57761
58057
  const hooks = settings.hooks ?? {};
57762
58058
  const preToolUse = (hooks.PreToolUse ?? []).filter((entry) => !isHarGuardEntry(entry));
@@ -57770,15 +58066,15 @@ function installClaudeGuard(repoPath) {
57770
58066
  }
57771
58067
  function uninstallClaudeGuard(repoPath) {
57772
58068
  let removed = false;
57773
- const guardScript = path53.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
57774
- if (fs47.existsSync(guardScript)) {
57775
- fs47.rmSync(guardScript);
58069
+ const guardScript = path54.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
58070
+ if (fs48.existsSync(guardScript)) {
58071
+ fs48.rmSync(guardScript);
57776
58072
  removed = true;
57777
- const parent = path53.dirname(guardScript);
57778
- if (fs47.existsSync(parent) && fs47.readdirSync(parent).length === 0) fs47.rmdirSync(parent);
58073
+ const parent = path54.dirname(guardScript);
58074
+ if (fs48.existsSync(parent) && fs48.readdirSync(parent).length === 0) fs48.rmdirSync(parent);
57779
58075
  }
57780
- const settingsPath = path53.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
57781
- if (fs47.existsSync(settingsPath)) {
58076
+ const settingsPath = path54.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
58077
+ if (fs48.existsSync(settingsPath)) {
57782
58078
  const settings = readSettings(settingsPath);
57783
58079
  const preToolUse = settings.hooks?.PreToolUse;
57784
58080
  if (preToolUse) {
@@ -57803,8 +58099,8 @@ function uninstallClaudeGuard(repoPath) {
57803
58099
  return { removed };
57804
58100
  }
57805
58101
  function claudeGuardInstalled(repoPath) {
57806
- const settingsPath = path53.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
57807
- if (!fs47.existsSync(settingsPath)) return false;
58102
+ const settingsPath = path54.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
58103
+ if (!fs48.existsSync(settingsPath)) return false;
57808
58104
  try {
57809
58105
  const settings = readSettings(settingsPath);
57810
58106
  return (settings.hooks?.PreToolUse ?? []).some(isHarGuardEntry);
@@ -57820,7 +58116,7 @@ function repoOption(y2) {
57820
58116
  function handleInstall2(argv) {
57821
58117
  try {
57822
58118
  if (argv.claude) {
57823
- const result2 = installClaudeGuard(path54.resolve(argv.repo));
58119
+ const result2 = installClaudeGuard(path55.resolve(argv.repo));
57824
58120
  success("Claude Code worktree guard installed.");
57825
58121
  info(`Guard script: ${result2.guardScript}`);
57826
58122
  info(`Settings: ${result2.settingsPath} (PreToolUse: Edit|Write|MultiEdit|NotebookEdit)`);
@@ -57828,7 +58124,7 @@ function handleInstall2(argv) {
57828
58124
  info("Commit both files so the guard travels with the repo.");
57829
58125
  return;
57830
58126
  }
57831
- const result = installHooks({ repoPath: path54.resolve(argv.repo), force: argv.force });
58127
+ const result = installHooks({ repoPath: path55.resolve(argv.repo), force: argv.force });
57832
58128
  success(`Commit gate installed in ${result.hooksDir}`);
57833
58129
  info(`pre-commit: ${result.preCommit}, post-commit: ${result.postCommit}`);
57834
58130
  info("Commits of unverified change batches will be blocked in agent worktrees.");
@@ -57841,7 +58137,7 @@ function handleInstall2(argv) {
57841
58137
  function handleUninstall(argv) {
57842
58138
  try {
57843
58139
  if (argv.claude) {
57844
- const result2 = uninstallClaudeGuard(path54.resolve(argv.repo));
58140
+ const result2 = uninstallClaudeGuard(path55.resolve(argv.repo));
57845
58141
  if (result2.removed) {
57846
58142
  success("Claude Code worktree guard removed.");
57847
58143
  } else {
@@ -57849,7 +58145,7 @@ function handleUninstall(argv) {
57849
58145
  }
57850
58146
  return;
57851
58147
  }
57852
- const result = uninstallHooks(path54.resolve(argv.repo));
58148
+ const result = uninstallHooks(path55.resolve(argv.repo));
57853
58149
  if (result.removed) {
57854
58150
  success(`Commit gate removed from ${result.hooksDir}`);
57855
58151
  } else {
@@ -57862,7 +58158,7 @@ function handleUninstall(argv) {
57862
58158
  }
57863
58159
  function handleStatus2(argv) {
57864
58160
  try {
57865
- const status = getHooksStatus(path54.resolve(argv.repo));
58161
+ const status = getHooksStatus(path55.resolve(argv.repo));
57866
58162
  if (argv.json) {
57867
58163
  process.stdout.write(`${JSON.stringify(status, null, 2)}
57868
58164
  `);
@@ -57880,7 +58176,7 @@ function handleStatus2(argv) {
57880
58176
  );
57881
58177
  info(`Effective: ${status.effectiveMode} (in this checkout)`);
57882
58178
  info(
57883
- `Claude guard: ${claudeGuardInstalled(path54.resolve(argv.repo)) ? `installed (${CLAUDE_GUARD_RELATIVE_PATH})` : "not installed"}`
58179
+ `Claude guard: ${claudeGuardInstalled(path55.resolve(argv.repo)) ? `installed (${CLAUDE_GUARD_RELATIVE_PATH})` : "not installed"}`
57884
58180
  );
57885
58181
  } catch (err) {
57886
58182
  error(err instanceof Error ? err.message : String(err));
@@ -58141,10 +58437,10 @@ function assignProp(target, prop, value) {
58141
58437
  configurable: true
58142
58438
  });
58143
58439
  }
58144
- function getElementAtPath(obj, path57) {
58145
- if (!path57)
58440
+ function getElementAtPath(obj, path58) {
58441
+ if (!path58)
58146
58442
  return obj;
58147
- return path57.reduce((acc, key) => acc?.[key], obj);
58443
+ return path58.reduce((acc, key) => acc?.[key], obj);
58148
58444
  }
58149
58445
  function promiseAllObject(promisesObj) {
58150
58446
  const keys = Object.keys(promisesObj);
@@ -58464,11 +58760,11 @@ function aborted(x2, startIndex = 0) {
58464
58760
  }
58465
58761
  return false;
58466
58762
  }
58467
- function prefixIssues(path57, issues) {
58763
+ function prefixIssues(path58, issues) {
58468
58764
  return issues.map((iss) => {
58469
58765
  var _a3;
58470
58766
  (_a3 = iss).path ?? (_a3.path = []);
58471
- iss.path.unshift(path57);
58767
+ iss.path.unshift(path58);
58472
58768
  return iss;
58473
58769
  });
58474
58770
  }
@@ -63791,7 +64087,7 @@ var Protocol = class {
63791
64087
  return;
63792
64088
  }
63793
64089
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
63794
- await new Promise((resolve41) => setTimeout(resolve41, pollInterval));
64090
+ await new Promise((resolve42) => setTimeout(resolve42, pollInterval));
63795
64091
  options?.signal?.throwIfAborted();
63796
64092
  }
63797
64093
  } catch (error3) {
@@ -63808,7 +64104,7 @@ var Protocol = class {
63808
64104
  */
63809
64105
  request(request, resultSchema, options) {
63810
64106
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
63811
- return new Promise((resolve41, reject) => {
64107
+ return new Promise((resolve42, reject) => {
63812
64108
  const earlyReject = (error3) => {
63813
64109
  reject(error3);
63814
64110
  };
@@ -63886,7 +64182,7 @@ var Protocol = class {
63886
64182
  if (!parseResult.success) {
63887
64183
  reject(parseResult.error);
63888
64184
  } else {
63889
- resolve41(parseResult.data);
64185
+ resolve42(parseResult.data);
63890
64186
  }
63891
64187
  } catch (error3) {
63892
64188
  reject(error3);
@@ -64147,12 +64443,12 @@ var Protocol = class {
64147
64443
  }
64148
64444
  } catch {
64149
64445
  }
64150
- return new Promise((resolve41, reject) => {
64446
+ return new Promise((resolve42, reject) => {
64151
64447
  if (signal.aborted) {
64152
64448
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
64153
64449
  return;
64154
64450
  }
64155
- const timeoutId = setTimeout(resolve41, interval);
64451
+ const timeoutId = setTimeout(resolve42, interval);
64156
64452
  signal.addEventListener("abort", () => {
64157
64453
  clearTimeout(timeoutId);
64158
64454
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -64942,7 +65238,7 @@ var Server = class extends Protocol {
64942
65238
  };
64943
65239
 
64944
65240
  // src/mcp/server.ts
64945
- var path55 = __toESM(require("path"));
65241
+ var path56 = __toESM(require("path"));
64946
65242
 
64947
65243
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
64948
65244
  var import_node_process3 = __toESM(require("node:process"), 1);
@@ -65025,12 +65321,12 @@ var StdioServerTransport = class {
65025
65321
  this.onclose?.();
65026
65322
  }
65027
65323
  send(message) {
65028
- return new Promise((resolve41) => {
65324
+ return new Promise((resolve42) => {
65029
65325
  const json = serializeMessage(message);
65030
65326
  if (this._stdout.write(json)) {
65031
- resolve41();
65327
+ resolve42();
65032
65328
  } else {
65033
- this._stdout.once("drain", resolve41);
65329
+ this._stdout.once("drain", resolve42);
65034
65330
  }
65035
65331
  });
65036
65332
  }
@@ -65605,7 +65901,7 @@ async function handleMcpToolCall(toolName, args, defaultRepo = ".") {
65605
65901
  const input = ControlUpInputSchema.parse({ ...args, repo });
65606
65902
  const result = await startControlAndSync({
65607
65903
  detach: input.detach,
65608
- cwd: path55.resolve(input.repo)
65904
+ cwd: path56.resolve(input.repo)
65609
65905
  });
65610
65906
  if (result.code !== 0) {
65611
65907
  return {
@@ -65784,7 +66080,7 @@ var preferencesCommand = {
65784
66080
  };
65785
66081
 
65786
66082
  // src/cli/commands/telemetry.ts
65787
- var path56 = __toESM(require("path"));
66083
+ var path57 = __toESM(require("path"));
65788
66084
  init_control_config();
65789
66085
  init_otel_hooks();
65790
66086
  init_telemetry_config();
@@ -65871,7 +66167,7 @@ async function handleOff() {
65871
66167
  info("Mission Control will not auto-start. Existing usage rows are kept.");
65872
66168
  }
65873
66169
  async function handleWriteEnv(argv) {
65874
- const repoPath = path56.resolve(argv.repo);
66170
+ const repoPath = path57.resolve(argv.repo);
65875
66171
  const harnessRoot = resolveHarnessRoot(repoPath);
65876
66172
  const session = readSlotRegistry(harnessRoot, argv.agentId);
65877
66173
  const workDir = argv.workDir ?? session?.workDir ?? repoPath;
@@ -65883,7 +66179,7 @@ async function handleWriteEnv(argv) {
65883
66179
  suffix,
65884
66180
  createdAt: session?.createdAt
65885
66181
  });
65886
- const envFile = argv.envFile ?? path56.join(workDir, `.env.agent.${argv.agentId}`);
66182
+ const envFile = argv.envFile ?? path57.join(workDir, `.env.agent.${argv.agentId}`);
65887
66183
  const attrs = {
65888
66184
  sessionKey,
65889
66185
  agentId: argv.agentId,
@@ -65902,7 +66198,7 @@ async function handleWriteEnv(argv) {
65902
66198
  success(`Wrote session attribution to ${envFile}`);
65903
66199
  }
65904
66200
  function handlePrintEnv(argv) {
65905
- const repoPath = path56.resolve(argv.repo);
66201
+ const repoPath = path57.resolve(argv.repo);
65906
66202
  const workDir = argv.workDir ?? repoPath;
65907
66203
  const sessionKey = buildSessionKey({
65908
66204
  branch: argv.branch,