@mrrlin-dev/mcp 0.4.157 → 0.4.158

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 (3) hide show
  1. package/README.md +8 -0
  2. package/dist/bin.cjs +846 -217
  3. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -5258,8 +5258,8 @@ var require_utils = __commonJS({
5258
5258
  }
5259
5259
  return ind;
5260
5260
  }
5261
- function removeDotSegments(path34) {
5262
- let input = path34;
5261
+ function removeDotSegments(path36) {
5262
+ let input = path36;
5263
5263
  const output3 = [];
5264
5264
  let nextSlash = -1;
5265
5265
  let len = 0;
@@ -5668,8 +5668,8 @@ var require_schemes = __commonJS({
5668
5668
  }
5669
5669
  if (wsComponent.resourceName) {
5670
5670
  const queryIndex = wsComponent.resourceName.indexOf("?");
5671
- const path34 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
5672
- wsComponent.path = path34 && path34 !== "/" ? path34 : void 0;
5671
+ const path36 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
5672
+ wsComponent.path = path36 && path36 !== "/" ? path36 : void 0;
5673
5673
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
5674
5674
  wsComponent.resourceName = void 0;
5675
5675
  }
@@ -9305,7 +9305,7 @@ var require_windows = __commonJS({
9305
9305
  module2.exports = isexe;
9306
9306
  isexe.sync = sync;
9307
9307
  var fs16 = require("fs");
9308
- function checkPathExt(path34, options) {
9308
+ function checkPathExt(path36, options) {
9309
9309
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
9310
9310
  if (!pathext) {
9311
9311
  return true;
@@ -9316,25 +9316,25 @@ var require_windows = __commonJS({
9316
9316
  }
9317
9317
  for (var i = 0; i < pathext.length; i++) {
9318
9318
  var p = pathext[i].toLowerCase();
9319
- if (p && path34.substr(-p.length).toLowerCase() === p) {
9319
+ if (p && path36.substr(-p.length).toLowerCase() === p) {
9320
9320
  return true;
9321
9321
  }
9322
9322
  }
9323
9323
  return false;
9324
9324
  }
9325
- function checkStat(stat3, path34, options) {
9325
+ function checkStat(stat3, path36, options) {
9326
9326
  if (!stat3.isSymbolicLink() && !stat3.isFile()) {
9327
9327
  return false;
9328
9328
  }
9329
- return checkPathExt(path34, options);
9329
+ return checkPathExt(path36, options);
9330
9330
  }
9331
- function isexe(path34, options, cb) {
9332
- fs16.stat(path34, function(er, stat3) {
9333
- cb(er, er ? false : checkStat(stat3, path34, options));
9331
+ function isexe(path36, options, cb) {
9332
+ fs16.stat(path36, function(er, stat3) {
9333
+ cb(er, er ? false : checkStat(stat3, path36, options));
9334
9334
  });
9335
9335
  }
9336
- function sync(path34, options) {
9337
- return checkStat(fs16.statSync(path34), path34, options);
9336
+ function sync(path36, options) {
9337
+ return checkStat(fs16.statSync(path36), path36, options);
9338
9338
  }
9339
9339
  }
9340
9340
  });
@@ -9345,13 +9345,13 @@ var require_mode = __commonJS({
9345
9345
  module2.exports = isexe;
9346
9346
  isexe.sync = sync;
9347
9347
  var fs16 = require("fs");
9348
- function isexe(path34, options, cb) {
9349
- fs16.stat(path34, function(er, stat3) {
9348
+ function isexe(path36, options, cb) {
9349
+ fs16.stat(path36, function(er, stat3) {
9350
9350
  cb(er, er ? false : checkStat(stat3, options));
9351
9351
  });
9352
9352
  }
9353
- function sync(path34, options) {
9354
- return checkStat(fs16.statSync(path34), options);
9353
+ function sync(path36, options) {
9354
+ return checkStat(fs16.statSync(path36), options);
9355
9355
  }
9356
9356
  function checkStat(stat3, options) {
9357
9357
  return stat3.isFile() && checkMode(stat3, options);
@@ -9384,7 +9384,7 @@ var require_isexe = __commonJS({
9384
9384
  }
9385
9385
  module2.exports = isexe;
9386
9386
  isexe.sync = sync;
9387
- function isexe(path34, options, cb) {
9387
+ function isexe(path36, options, cb) {
9388
9388
  if (typeof options === "function") {
9389
9389
  cb = options;
9390
9390
  options = {};
@@ -9394,7 +9394,7 @@ var require_isexe = __commonJS({
9394
9394
  throw new TypeError("callback not provided");
9395
9395
  }
9396
9396
  return new Promise(function(resolve3, reject) {
9397
- isexe(path34, options || {}, function(er, is) {
9397
+ isexe(path36, options || {}, function(er, is) {
9398
9398
  if (er) {
9399
9399
  reject(er);
9400
9400
  } else {
@@ -9403,7 +9403,7 @@ var require_isexe = __commonJS({
9403
9403
  });
9404
9404
  });
9405
9405
  }
9406
- core(path34, options || {}, function(er, is) {
9406
+ core(path36, options || {}, function(er, is) {
9407
9407
  if (er) {
9408
9408
  if (er.code === "EACCES" || options && options.ignoreErrors) {
9409
9409
  er = null;
@@ -9413,9 +9413,9 @@ var require_isexe = __commonJS({
9413
9413
  cb(er, is);
9414
9414
  });
9415
9415
  }
9416
- function sync(path34, options) {
9416
+ function sync(path36, options) {
9417
9417
  try {
9418
- return core.sync(path34, options || {});
9418
+ return core.sync(path36, options || {});
9419
9419
  } catch (er) {
9420
9420
  if (options && options.ignoreErrors || er.code === "EACCES") {
9421
9421
  return false;
@@ -9431,7 +9431,7 @@ var require_isexe = __commonJS({
9431
9431
  var require_which = __commonJS({
9432
9432
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
9433
9433
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
9434
- var path34 = require("path");
9434
+ var path36 = require("path");
9435
9435
  var COLON = isWindows ? ";" : ":";
9436
9436
  var isexe = require_isexe();
9437
9437
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -9469,7 +9469,7 @@ var require_which = __commonJS({
9469
9469
  return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
9470
9470
  const ppRaw = pathEnv[i];
9471
9471
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
9472
- const pCmd = path34.join(pathPart, cmd);
9472
+ const pCmd = path36.join(pathPart, cmd);
9473
9473
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
9474
9474
  resolve3(subStep(p, i, 0));
9475
9475
  });
@@ -9496,7 +9496,7 @@ var require_which = __commonJS({
9496
9496
  for (let i = 0; i < pathEnv.length; i++) {
9497
9497
  const ppRaw = pathEnv[i];
9498
9498
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
9499
- const pCmd = path34.join(pathPart, cmd);
9499
+ const pCmd = path36.join(pathPart, cmd);
9500
9500
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
9501
9501
  for (let j = 0; j < pathExt.length; j++) {
9502
9502
  const cur = p + pathExt[j];
@@ -9544,7 +9544,7 @@ var require_path_key = __commonJS({
9544
9544
  var require_resolveCommand = __commonJS({
9545
9545
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
9546
9546
  "use strict";
9547
- var path34 = require("path");
9547
+ var path36 = require("path");
9548
9548
  var which = require_which();
9549
9549
  var getPathKey = require_path_key();
9550
9550
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -9562,7 +9562,7 @@ var require_resolveCommand = __commonJS({
9562
9562
  try {
9563
9563
  resolved = which.sync(parsed.command, {
9564
9564
  path: env[getPathKey({ env })],
9565
- pathExt: withoutPathExt ? path34.delimiter : void 0
9565
+ pathExt: withoutPathExt ? path36.delimiter : void 0
9566
9566
  });
9567
9567
  } catch (e) {
9568
9568
  } finally {
@@ -9571,7 +9571,7 @@ var require_resolveCommand = __commonJS({
9571
9571
  }
9572
9572
  }
9573
9573
  if (resolved) {
9574
- resolved = path34.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
9574
+ resolved = path36.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
9575
9575
  }
9576
9576
  return resolved;
9577
9577
  }
@@ -9625,8 +9625,8 @@ var require_shebang_command = __commonJS({
9625
9625
  if (!match) {
9626
9626
  return null;
9627
9627
  }
9628
- const [path34, argument] = match[0].replace(/#! ?/, "").split(" ");
9629
- const binary = path34.split("/").pop();
9628
+ const [path36, argument] = match[0].replace(/#! ?/, "").split(" ");
9629
+ const binary = path36.split("/").pop();
9630
9630
  if (binary === "env") {
9631
9631
  return argument;
9632
9632
  }
@@ -9661,7 +9661,7 @@ var require_readShebang = __commonJS({
9661
9661
  var require_parse2 = __commonJS({
9662
9662
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
9663
9663
  "use strict";
9664
- var path34 = require("path");
9664
+ var path36 = require("path");
9665
9665
  var resolveCommand = require_resolveCommand();
9666
9666
  var escape2 = require_escape();
9667
9667
  var readShebang = require_readShebang();
@@ -9686,7 +9686,7 @@ var require_parse2 = __commonJS({
9686
9686
  const needsShell = !isExecutableRegExp.test(commandFile);
9687
9687
  if (parsed.options.forceShell || needsShell) {
9688
9688
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
9689
- parsed.command = path34.normalize(parsed.command);
9689
+ parsed.command = path36.normalize(parsed.command);
9690
9690
  parsed.command = escape2.command(parsed.command);
9691
9691
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
9692
9692
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -9776,7 +9776,7 @@ var require_cross_spawn = __commonJS({
9776
9776
  var cp2 = require("child_process");
9777
9777
  var parse8 = require_parse2();
9778
9778
  var enoent = require_enoent();
9779
- function spawn9(command, args, options) {
9779
+ function spawn10(command, args, options) {
9780
9780
  const parsed = parse8(command, args, options);
9781
9781
  const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
9782
9782
  enoent.hookChildProcess(spawned, parsed);
@@ -9788,8 +9788,8 @@ var require_cross_spawn = __commonJS({
9788
9788
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
9789
9789
  return result;
9790
9790
  }
9791
- module2.exports = spawn9;
9792
- module2.exports.spawn = spawn9;
9791
+ module2.exports = spawn10;
9792
+ module2.exports.spawn = spawn10;
9793
9793
  module2.exports.sync = spawnSync9;
9794
9794
  module2.exports._parse = parse8;
9795
9795
  module2.exports._enoent = enoent;
@@ -9848,14 +9848,14 @@ var require_polyfills = __commonJS({
9848
9848
  fs16.fstatSync = statFixSync(fs16.fstatSync);
9849
9849
  fs16.lstatSync = statFixSync(fs16.lstatSync);
9850
9850
  if (fs16.chmod && !fs16.lchmod) {
9851
- fs16.lchmod = function(path34, mode, cb) {
9851
+ fs16.lchmod = function(path36, mode, cb) {
9852
9852
  if (cb) process.nextTick(cb);
9853
9853
  };
9854
9854
  fs16.lchmodSync = function() {
9855
9855
  };
9856
9856
  }
9857
9857
  if (fs16.chown && !fs16.lchown) {
9858
- fs16.lchown = function(path34, uid, gid, cb) {
9858
+ fs16.lchown = function(path36, uid, gid, cb) {
9859
9859
  if (cb) process.nextTick(cb);
9860
9860
  };
9861
9861
  fs16.lchownSync = function() {
@@ -9922,9 +9922,9 @@ var require_polyfills = __commonJS({
9922
9922
  };
9923
9923
  }(fs16.readSync);
9924
9924
  function patchLchmod(fs17) {
9925
- fs17.lchmod = function(path34, mode, callback) {
9925
+ fs17.lchmod = function(path36, mode, callback) {
9926
9926
  fs17.open(
9927
- path34,
9927
+ path36,
9928
9928
  constants2.O_WRONLY | constants2.O_SYMLINK,
9929
9929
  mode,
9930
9930
  function(err, fd) {
@@ -9940,8 +9940,8 @@ var require_polyfills = __commonJS({
9940
9940
  }
9941
9941
  );
9942
9942
  };
9943
- fs17.lchmodSync = function(path34, mode) {
9944
- var fd = fs17.openSync(path34, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
9943
+ fs17.lchmodSync = function(path36, mode) {
9944
+ var fd = fs17.openSync(path36, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
9945
9945
  var threw = true;
9946
9946
  var ret;
9947
9947
  try {
@@ -9962,8 +9962,8 @@ var require_polyfills = __commonJS({
9962
9962
  }
9963
9963
  function patchLutimes(fs17) {
9964
9964
  if (constants2.hasOwnProperty("O_SYMLINK") && fs17.futimes) {
9965
- fs17.lutimes = function(path34, at, mt, cb) {
9966
- fs17.open(path34, constants2.O_SYMLINK, function(er, fd) {
9965
+ fs17.lutimes = function(path36, at, mt, cb) {
9966
+ fs17.open(path36, constants2.O_SYMLINK, function(er, fd) {
9967
9967
  if (er) {
9968
9968
  if (cb) cb(er);
9969
9969
  return;
@@ -9975,8 +9975,8 @@ var require_polyfills = __commonJS({
9975
9975
  });
9976
9976
  });
9977
9977
  };
9978
- fs17.lutimesSync = function(path34, at, mt) {
9979
- var fd = fs17.openSync(path34, constants2.O_SYMLINK);
9978
+ fs17.lutimesSync = function(path36, at, mt) {
9979
+ var fd = fs17.openSync(path36, constants2.O_SYMLINK);
9980
9980
  var ret;
9981
9981
  var threw = true;
9982
9982
  try {
@@ -10094,11 +10094,11 @@ var require_legacy_streams = __commonJS({
10094
10094
  ReadStream,
10095
10095
  WriteStream
10096
10096
  };
10097
- function ReadStream(path34, options) {
10098
- if (!(this instanceof ReadStream)) return new ReadStream(path34, options);
10097
+ function ReadStream(path36, options) {
10098
+ if (!(this instanceof ReadStream)) return new ReadStream(path36, options);
10099
10099
  Stream.call(this);
10100
10100
  var self = this;
10101
- this.path = path34;
10101
+ this.path = path36;
10102
10102
  this.fd = null;
10103
10103
  this.readable = true;
10104
10104
  this.paused = false;
@@ -10143,10 +10143,10 @@ var require_legacy_streams = __commonJS({
10143
10143
  self._read();
10144
10144
  });
10145
10145
  }
10146
- function WriteStream(path34, options) {
10147
- if (!(this instanceof WriteStream)) return new WriteStream(path34, options);
10146
+ function WriteStream(path36, options) {
10147
+ if (!(this instanceof WriteStream)) return new WriteStream(path36, options);
10148
10148
  Stream.call(this);
10149
- this.path = path34;
10149
+ this.path = path36;
10150
10150
  this.fd = null;
10151
10151
  this.writable = true;
10152
10152
  this.flags = "w";
@@ -10289,14 +10289,14 @@ var require_graceful_fs = __commonJS({
10289
10289
  fs17.createWriteStream = createWriteStream;
10290
10290
  var fs$readFile = fs17.readFile;
10291
10291
  fs17.readFile = readFile10;
10292
- function readFile10(path34, options, cb) {
10292
+ function readFile10(path36, options, cb) {
10293
10293
  if (typeof options === "function")
10294
10294
  cb = options, options = null;
10295
- return go$readFile(path34, options, cb);
10296
- function go$readFile(path35, options2, cb2, startTime) {
10297
- return fs$readFile(path35, options2, function(err) {
10295
+ return go$readFile(path36, options, cb);
10296
+ function go$readFile(path37, options2, cb2, startTime) {
10297
+ return fs$readFile(path37, options2, function(err) {
10298
10298
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
10299
- enqueue([go$readFile, [path35, options2, cb2], err, startTime || Date.now(), Date.now()]);
10299
+ enqueue([go$readFile, [path37, options2, cb2], err, startTime || Date.now(), Date.now()]);
10300
10300
  else {
10301
10301
  if (typeof cb2 === "function")
10302
10302
  cb2.apply(this, arguments);
@@ -10306,14 +10306,14 @@ var require_graceful_fs = __commonJS({
10306
10306
  }
10307
10307
  var fs$writeFile = fs17.writeFile;
10308
10308
  fs17.writeFile = writeFile5;
10309
- function writeFile5(path34, data, options, cb) {
10309
+ function writeFile5(path36, data, options, cb) {
10310
10310
  if (typeof options === "function")
10311
10311
  cb = options, options = null;
10312
- return go$writeFile(path34, data, options, cb);
10313
- function go$writeFile(path35, data2, options2, cb2, startTime) {
10314
- return fs$writeFile(path35, data2, options2, function(err) {
10312
+ return go$writeFile(path36, data, options, cb);
10313
+ function go$writeFile(path37, data2, options2, cb2, startTime) {
10314
+ return fs$writeFile(path37, data2, options2, function(err) {
10315
10315
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
10316
- enqueue([go$writeFile, [path35, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
10316
+ enqueue([go$writeFile, [path37, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
10317
10317
  else {
10318
10318
  if (typeof cb2 === "function")
10319
10319
  cb2.apply(this, arguments);
@@ -10324,14 +10324,14 @@ var require_graceful_fs = __commonJS({
10324
10324
  var fs$appendFile = fs17.appendFile;
10325
10325
  if (fs$appendFile)
10326
10326
  fs17.appendFile = appendFile2;
10327
- function appendFile2(path34, data, options, cb) {
10327
+ function appendFile2(path36, data, options, cb) {
10328
10328
  if (typeof options === "function")
10329
10329
  cb = options, options = null;
10330
- return go$appendFile(path34, data, options, cb);
10331
- function go$appendFile(path35, data2, options2, cb2, startTime) {
10332
- return fs$appendFile(path35, data2, options2, function(err) {
10330
+ return go$appendFile(path36, data, options, cb);
10331
+ function go$appendFile(path37, data2, options2, cb2, startTime) {
10332
+ return fs$appendFile(path37, data2, options2, function(err) {
10333
10333
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
10334
- enqueue([go$appendFile, [path35, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
10334
+ enqueue([go$appendFile, [path37, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
10335
10335
  else {
10336
10336
  if (typeof cb2 === "function")
10337
10337
  cb2.apply(this, arguments);
@@ -10362,31 +10362,31 @@ var require_graceful_fs = __commonJS({
10362
10362
  var fs$readdir = fs17.readdir;
10363
10363
  fs17.readdir = readdir5;
10364
10364
  var noReaddirOptionVersions = /^v[0-5]\./;
10365
- function readdir5(path34, options, cb) {
10365
+ function readdir5(path36, options, cb) {
10366
10366
  if (typeof options === "function")
10367
10367
  cb = options, options = null;
10368
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path35, options2, cb2, startTime) {
10369
- return fs$readdir(path35, fs$readdirCallback(
10370
- path35,
10368
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path37, options2, cb2, startTime) {
10369
+ return fs$readdir(path37, fs$readdirCallback(
10370
+ path37,
10371
10371
  options2,
10372
10372
  cb2,
10373
10373
  startTime
10374
10374
  ));
10375
- } : function go$readdir2(path35, options2, cb2, startTime) {
10376
- return fs$readdir(path35, options2, fs$readdirCallback(
10377
- path35,
10375
+ } : function go$readdir2(path37, options2, cb2, startTime) {
10376
+ return fs$readdir(path37, options2, fs$readdirCallback(
10377
+ path37,
10378
10378
  options2,
10379
10379
  cb2,
10380
10380
  startTime
10381
10381
  ));
10382
10382
  };
10383
- return go$readdir(path34, options, cb);
10384
- function fs$readdirCallback(path35, options2, cb2, startTime) {
10383
+ return go$readdir(path36, options, cb);
10384
+ function fs$readdirCallback(path37, options2, cb2, startTime) {
10385
10385
  return function(err, files) {
10386
10386
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
10387
10387
  enqueue([
10388
10388
  go$readdir,
10389
- [path35, options2, cb2],
10389
+ [path37, options2, cb2],
10390
10390
  err,
10391
10391
  startTime || Date.now(),
10392
10392
  Date.now()
@@ -10457,7 +10457,7 @@ var require_graceful_fs = __commonJS({
10457
10457
  enumerable: true,
10458
10458
  configurable: true
10459
10459
  });
10460
- function ReadStream(path34, options) {
10460
+ function ReadStream(path36, options) {
10461
10461
  if (this instanceof ReadStream)
10462
10462
  return fs$ReadStream.apply(this, arguments), this;
10463
10463
  else
@@ -10477,7 +10477,7 @@ var require_graceful_fs = __commonJS({
10477
10477
  }
10478
10478
  });
10479
10479
  }
10480
- function WriteStream(path34, options) {
10480
+ function WriteStream(path36, options) {
10481
10481
  if (this instanceof WriteStream)
10482
10482
  return fs$WriteStream.apply(this, arguments), this;
10483
10483
  else
@@ -10495,22 +10495,22 @@ var require_graceful_fs = __commonJS({
10495
10495
  }
10496
10496
  });
10497
10497
  }
10498
- function createReadStream2(path34, options) {
10499
- return new fs17.ReadStream(path34, options);
10498
+ function createReadStream2(path36, options) {
10499
+ return new fs17.ReadStream(path36, options);
10500
10500
  }
10501
- function createWriteStream(path34, options) {
10502
- return new fs17.WriteStream(path34, options);
10501
+ function createWriteStream(path36, options) {
10502
+ return new fs17.WriteStream(path36, options);
10503
10503
  }
10504
10504
  var fs$open = fs17.open;
10505
10505
  fs17.open = open;
10506
- function open(path34, flags, mode, cb) {
10506
+ function open(path36, flags, mode, cb) {
10507
10507
  if (typeof mode === "function")
10508
10508
  cb = mode, mode = null;
10509
- return go$open(path34, flags, mode, cb);
10510
- function go$open(path35, flags2, mode2, cb2, startTime) {
10511
- return fs$open(path35, flags2, mode2, function(err, fd) {
10509
+ return go$open(path36, flags, mode, cb);
10510
+ function go$open(path37, flags2, mode2, cb2, startTime) {
10511
+ return fs$open(path37, flags2, mode2, function(err, fd) {
10512
10512
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
10513
- enqueue([go$open, [path35, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
10513
+ enqueue([go$open, [path37, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
10514
10514
  else {
10515
10515
  if (typeof cb2 === "function")
10516
10516
  cb2.apply(this, arguments);
@@ -11039,7 +11039,7 @@ var require_mtime_precision = __commonJS({
11039
11039
  var require_lockfile = __commonJS({
11040
11040
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
11041
11041
  "use strict";
11042
- var path34 = require("path");
11042
+ var path36 = require("path");
11043
11043
  var fs16 = require_graceful_fs();
11044
11044
  var retry = require_retry2();
11045
11045
  var onExit = require_signal_exit();
@@ -11050,7 +11050,7 @@ var require_lockfile = __commonJS({
11050
11050
  }
11051
11051
  function resolveCanonicalPath(file2, options, callback) {
11052
11052
  if (!options.realpath) {
11053
- return callback(null, path34.resolve(file2));
11053
+ return callback(null, path36.resolve(file2));
11054
11054
  }
11055
11055
  options.fs.realpath(file2, callback);
11056
11056
  }
@@ -18566,10 +18566,10 @@ var require_segments = __commonJS({
18566
18566
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
18567
18567
  const nodes = buildNodes(segs);
18568
18568
  const graph = buildGraph(nodes, version2);
18569
- const path34 = dijkstra.find_path(graph.map, "start", "end");
18569
+ const path36 = dijkstra.find_path(graph.map, "start", "end");
18570
18570
  const optimizedSegs = [];
18571
- for (let i = 1; i < path34.length - 1; i++) {
18572
- optimizedSegs.push(graph.table[path34[i]].node);
18571
+ for (let i = 1; i < path36.length - 1; i++) {
18572
+ optimizedSegs.push(graph.table[path36[i]].node);
18573
18573
  }
18574
18574
  return exports2.fromArray(mergeSegments(optimizedSegs));
18575
18575
  };
@@ -21046,7 +21046,7 @@ var require_png2 = __commonJS({
21046
21046
  });
21047
21047
  png.pack();
21048
21048
  };
21049
- exports2.renderToFile = function renderToFile(path34, qrData, options, cb) {
21049
+ exports2.renderToFile = function renderToFile(path36, qrData, options, cb) {
21050
21050
  if (typeof cb === "undefined") {
21051
21051
  cb = options;
21052
21052
  options = void 0;
@@ -21057,7 +21057,7 @@ var require_png2 = __commonJS({
21057
21057
  called = true;
21058
21058
  cb.apply(null, args);
21059
21059
  };
21060
- const stream = fs16.createWriteStream(path34);
21060
+ const stream = fs16.createWriteStream(path36);
21061
21061
  stream.on("error", done);
21062
21062
  stream.on("close", done);
21063
21063
  exports2.renderToFileStream(stream, qrData, options);
@@ -21119,14 +21119,14 @@ var require_utf8 = __commonJS({
21119
21119
  }
21120
21120
  return output3;
21121
21121
  };
21122
- exports2.renderToFile = function renderToFile(path34, qrData, options, cb) {
21122
+ exports2.renderToFile = function renderToFile(path36, qrData, options, cb) {
21123
21123
  if (typeof cb === "undefined") {
21124
21124
  cb = options;
21125
21125
  options = void 0;
21126
21126
  }
21127
21127
  const fs16 = require("fs");
21128
21128
  const utf8 = exports2.render(qrData, options);
21129
- fs16.writeFile(path34, utf8, cb);
21129
+ fs16.writeFile(path36, utf8, cb);
21130
21130
  };
21131
21131
  }
21132
21132
  });
@@ -21247,7 +21247,7 @@ var require_svg_tag = __commonJS({
21247
21247
  return str;
21248
21248
  }
21249
21249
  function qrToPath(data, size, margin) {
21250
- let path34 = "";
21250
+ let path36 = "";
21251
21251
  let moveBy = 0;
21252
21252
  let newRow = false;
21253
21253
  let lineLength = 0;
@@ -21258,19 +21258,19 @@ var require_svg_tag = __commonJS({
21258
21258
  if (data[i]) {
21259
21259
  lineLength++;
21260
21260
  if (!(i > 0 && col > 0 && data[i - 1])) {
21261
- path34 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
21261
+ path36 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
21262
21262
  moveBy = 0;
21263
21263
  newRow = false;
21264
21264
  }
21265
21265
  if (!(col + 1 < size && data[i + 1])) {
21266
- path34 += svgCmd("h", lineLength);
21266
+ path36 += svgCmd("h", lineLength);
21267
21267
  lineLength = 0;
21268
21268
  }
21269
21269
  } else {
21270
21270
  moveBy++;
21271
21271
  }
21272
21272
  }
21273
- return path34;
21273
+ return path36;
21274
21274
  }
21275
21275
  exports2.render = function render(qrData, options, cb) {
21276
21276
  const opts = Utils.getOptions(options);
@@ -21278,10 +21278,10 @@ var require_svg_tag = __commonJS({
21278
21278
  const data = qrData.modules.data;
21279
21279
  const qrcodesize = size + opts.margin * 2;
21280
21280
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
21281
- const path34 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
21281
+ const path36 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
21282
21282
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
21283
21283
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
21284
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path34 + "</svg>\n";
21284
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path36 + "</svg>\n";
21285
21285
  if (typeof cb === "function") {
21286
21286
  cb(null, svgTag);
21287
21287
  }
@@ -21295,7 +21295,7 @@ var require_svg = __commonJS({
21295
21295
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
21296
21296
  var svgTagRenderer = require_svg_tag();
21297
21297
  exports2.render = svgTagRenderer.render;
21298
- exports2.renderToFile = function renderToFile(path34, qrData, options, cb) {
21298
+ exports2.renderToFile = function renderToFile(path36, qrData, options, cb) {
21299
21299
  if (typeof cb === "undefined") {
21300
21300
  cb = options;
21301
21301
  options = void 0;
@@ -21303,7 +21303,7 @@ var require_svg = __commonJS({
21303
21303
  const fs16 = require("fs");
21304
21304
  const svgTag = exports2.render(qrData, options);
21305
21305
  const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
21306
- fs16.writeFile(path34, xmlStr, cb);
21306
+ fs16.writeFile(path36, xmlStr, cb);
21307
21307
  };
21308
21308
  }
21309
21309
  });
@@ -21461,8 +21461,8 @@ var require_server = __commonJS({
21461
21461
  cb
21462
21462
  };
21463
21463
  }
21464
- function getTypeFromFilename(path34) {
21465
- return path34.slice((path34.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
21464
+ function getTypeFromFilename(path36) {
21465
+ return path36.slice((path36.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
21466
21466
  }
21467
21467
  function getRendererFromType(type) {
21468
21468
  switch (type) {
@@ -21526,17 +21526,17 @@ var require_server = __commonJS({
21526
21526
  const renderer = getRendererFromType(params.opts.type);
21527
21527
  return render(renderer.renderToBuffer, text, params);
21528
21528
  };
21529
- exports2.toFile = function toFile(path34, text, opts, cb) {
21530
- if (typeof path34 !== "string" || !(typeof text === "string" || typeof text === "object")) {
21529
+ exports2.toFile = function toFile(path36, text, opts, cb) {
21530
+ if (typeof path36 !== "string" || !(typeof text === "string" || typeof text === "object")) {
21531
21531
  throw new Error("Invalid argument");
21532
21532
  }
21533
21533
  if (arguments.length < 3 && !canPromise()) {
21534
21534
  throw new Error("Too few arguments provided");
21535
21535
  }
21536
21536
  const params = checkParams(text, opts, cb);
21537
- const type = params.opts.type || getTypeFromFilename(path34);
21537
+ const type = params.opts.type || getTypeFromFilename(path36);
21538
21538
  const renderer = getRendererFromType(type);
21539
- const renderToFile = renderer.renderToFile.bind(null, path34);
21539
+ const renderToFile = renderer.renderToFile.bind(null, path36);
21540
21540
  return render(renderToFile, text, params);
21541
21541
  };
21542
21542
  exports2.toFileStream = function toFileStream(stream, text, opts) {
@@ -21661,11 +21661,11 @@ __export(bin_exports, {
21661
21661
  augmentProcessPathWithCommonDirs: () => augmentProcessPathWithCommonDirs
21662
21662
  });
21663
21663
  module.exports = __toCommonJS(bin_exports);
21664
- var import_node_path47 = __toESM(require("node:path"), 1);
21665
- var import_node_child_process27 = require("node:child_process");
21666
- var import_node_fs31 = require("node:fs");
21664
+ var import_node_path49 = __toESM(require("node:path"), 1);
21665
+ var import_node_child_process28 = require("node:child_process");
21666
+ var import_node_fs32 = require("node:fs");
21667
21667
  var import_node_os25 = require("node:os");
21668
- var import_node_path48 = __toESM(require("node:path"), 1);
21668
+ var import_node_path50 = __toESM(require("node:path"), 1);
21669
21669
 
21670
21670
  // src/install-codex.ts
21671
21671
  var import_promises = __toESM(require("node:fs/promises"), 1);
@@ -23572,10 +23572,10 @@ function mergeDefs(...defs) {
23572
23572
  function cloneDef(schema) {
23573
23573
  return mergeDefs(schema._zod.def);
23574
23574
  }
23575
- function getElementAtPath(obj, path34) {
23576
- if (!path34)
23575
+ function getElementAtPath(obj, path36) {
23576
+ if (!path36)
23577
23577
  return obj;
23578
- return path34.reduce((acc, key) => acc?.[key], obj);
23578
+ return path36.reduce((acc, key) => acc?.[key], obj);
23579
23579
  }
23580
23580
  function promiseAllObject(promisesObj) {
23581
23581
  const keys = Object.keys(promisesObj);
@@ -23984,11 +23984,11 @@ function explicitlyAborted(x, startIndex = 0) {
23984
23984
  }
23985
23985
  return false;
23986
23986
  }
23987
- function prefixIssues(path34, issues) {
23987
+ function prefixIssues(path36, issues) {
23988
23988
  return issues.map((iss) => {
23989
23989
  var _a3;
23990
23990
  (_a3 = iss).path ?? (_a3.path = []);
23991
- iss.path.unshift(path34);
23991
+ iss.path.unshift(path36);
23992
23992
  return iss;
23993
23993
  });
23994
23994
  }
@@ -24135,16 +24135,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
24135
24135
  }
24136
24136
  function formatError(error51, mapper = (issue2) => issue2.message) {
24137
24137
  const fieldErrors = { _errors: [] };
24138
- const processError = (error52, path34 = []) => {
24138
+ const processError = (error52, path36 = []) => {
24139
24139
  for (const issue2 of error52.issues) {
24140
24140
  if (issue2.code === "invalid_union" && issue2.errors.length) {
24141
- issue2.errors.map((issues) => processError({ issues }, [...path34, ...issue2.path]));
24141
+ issue2.errors.map((issues) => processError({ issues }, [...path36, ...issue2.path]));
24142
24142
  } else if (issue2.code === "invalid_key") {
24143
- processError({ issues: issue2.issues }, [...path34, ...issue2.path]);
24143
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
24144
24144
  } else if (issue2.code === "invalid_element") {
24145
- processError({ issues: issue2.issues }, [...path34, ...issue2.path]);
24145
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
24146
24146
  } else {
24147
- const fullpath = [...path34, ...issue2.path];
24147
+ const fullpath = [...path36, ...issue2.path];
24148
24148
  if (fullpath.length === 0) {
24149
24149
  fieldErrors._errors.push(mapper(issue2));
24150
24150
  } else {
@@ -24171,17 +24171,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
24171
24171
  }
24172
24172
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
24173
24173
  const result = { errors: [] };
24174
- const processError = (error52, path34 = []) => {
24174
+ const processError = (error52, path36 = []) => {
24175
24175
  var _a3, _b;
24176
24176
  for (const issue2 of error52.issues) {
24177
24177
  if (issue2.code === "invalid_union" && issue2.errors.length) {
24178
- issue2.errors.map((issues) => processError({ issues }, [...path34, ...issue2.path]));
24178
+ issue2.errors.map((issues) => processError({ issues }, [...path36, ...issue2.path]));
24179
24179
  } else if (issue2.code === "invalid_key") {
24180
- processError({ issues: issue2.issues }, [...path34, ...issue2.path]);
24180
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
24181
24181
  } else if (issue2.code === "invalid_element") {
24182
- processError({ issues: issue2.issues }, [...path34, ...issue2.path]);
24182
+ processError({ issues: issue2.issues }, [...path36, ...issue2.path]);
24183
24183
  } else {
24184
- const fullpath = [...path34, ...issue2.path];
24184
+ const fullpath = [...path36, ...issue2.path];
24185
24185
  if (fullpath.length === 0) {
24186
24186
  result.errors.push(mapper(issue2));
24187
24187
  continue;
@@ -24213,8 +24213,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
24213
24213
  }
24214
24214
  function toDotPath(_path) {
24215
24215
  const segs = [];
24216
- const path34 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
24217
- for (const seg of path34) {
24216
+ const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
24217
+ for (const seg of path36) {
24218
24218
  if (typeof seg === "number")
24219
24219
  segs.push(`[${seg}]`);
24220
24220
  else if (typeof seg === "symbol")
@@ -36906,13 +36906,13 @@ function resolveRef(ref, ctx) {
36906
36906
  if (!ref.startsWith("#")) {
36907
36907
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
36908
36908
  }
36909
- const path34 = ref.slice(1).split("/").filter(Boolean);
36910
- if (path34.length === 0) {
36909
+ const path36 = ref.slice(1).split("/").filter(Boolean);
36910
+ if (path36.length === 0) {
36911
36911
  return ctx.rootSchema;
36912
36912
  }
36913
36913
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
36914
- if (path34[0] === defsKey) {
36915
- const key = path34[1];
36914
+ if (path36[0] === defsKey) {
36915
+ const key = path36[1];
36916
36916
  if (!key || !ctx.defs[key]) {
36917
36917
  throw new Error(`Reference not found: ${ref}`);
36918
36918
  }
@@ -40998,7 +40998,7 @@ function createMrrlinClient(config2) {
40998
40998
  }
40999
40999
  });
41000
41000
  }
41001
- async function executeFetch(path34, init) {
41001
+ async function executeFetch(path36, init) {
41002
41002
  const method = (init?.method ?? "GET").toUpperCase();
41003
41003
  const dynamicHeaders = typeof config2.headers === "function" ? await config2.headers() : config2.headers;
41004
41004
  const headers = new Headers(dynamicHeaders ?? {});
@@ -41009,7 +41009,7 @@ function createMrrlinClient(config2) {
41009
41009
  if (token && !headers.has("authorization")) {
41010
41010
  headers.set("authorization", `Bearer ${token}`);
41011
41011
  }
41012
- const url2 = `${baseUrl}${path34}`;
41012
+ const url2 = `${baseUrl}${path36}`;
41013
41013
  const isIdempotent = method === "GET" || method === "HEAD";
41014
41014
  const maxAttempts = isIdempotent ? 3 : 1;
41015
41015
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
@@ -41045,13 +41045,13 @@ function createMrrlinClient(config2) {
41045
41045
  throw err;
41046
41046
  }
41047
41047
  }
41048
- throw new Error(`Failed to execute ${method} ${path34}`);
41048
+ throw new Error(`Failed to execute ${method} ${path36}`);
41049
41049
  }
41050
- async function handleResponseError(response, method, path34) {
41050
+ async function handleResponseError(response, method, path36) {
41051
41051
  const body = await response.text();
41052
41052
  let code = `HTTP_${response.status}`;
41053
41053
  let violations = null;
41054
- let message = `Mrrlin API ${method} ${path34} failed: ${response.status}`;
41054
+ let message = `Mrrlin API ${method} ${path36} failed: ${response.status}`;
41055
41055
  try {
41056
41056
  const parsed = JSON.parse(body);
41057
41057
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -41071,26 +41071,26 @@ function createMrrlinClient(config2) {
41071
41071
  throw new MrrlinApiError({
41072
41072
  code,
41073
41073
  method,
41074
- path: path34,
41074
+ path: path36,
41075
41075
  responseBody: body,
41076
41076
  status: response.status,
41077
41077
  violations,
41078
41078
  message
41079
41079
  });
41080
41080
  }
41081
- async function request(path34, init) {
41081
+ async function request(path36, init) {
41082
41082
  const method = init?.method ?? "GET";
41083
- const response = await executeFetch(path34, init);
41083
+ const response = await executeFetch(path36, init);
41084
41084
  if (!response.ok) {
41085
- await handleResponseError(response, method, path34);
41085
+ await handleResponseError(response, method, path36);
41086
41086
  }
41087
41087
  return response.json();
41088
41088
  }
41089
- async function requestText(path34, init) {
41089
+ async function requestText(path36, init) {
41090
41090
  const method = init?.method ?? "GET";
41091
- const response = await executeFetch(path34, init);
41091
+ const response = await executeFetch(path36, init);
41092
41092
  if (!response.ok) {
41093
- await handleResponseError(response, method, path34);
41093
+ await handleResponseError(response, method, path36);
41094
41094
  }
41095
41095
  return response.text();
41096
41096
  }
@@ -41253,16 +41253,16 @@ function createMrrlinClient(config2) {
41253
41253
  // rejected against the first, MrrlinTask[]-only overload) -- the `any` here is contained to
41254
41254
  // this one implementation signature; MrrlinClient's declared overloads keep callers precise.
41255
41255
  async listTasks(projectSlug, filters = {}, options) {
41256
- const path34 = buildTaskListPath(projectSlug, filters, options?.view);
41257
- const body = await request(path34, options?.signal ? { signal: options.signal } : void 0);
41256
+ const path36 = buildTaskListPath(projectSlug, filters, options?.view);
41257
+ const body = await request(path36, options?.signal ? { signal: options.signal } : void 0);
41258
41258
  if (options?.view === "summary") {
41259
41259
  return taskSummaryListResponseSchema.parse(body).data;
41260
41260
  }
41261
41261
  return taskListResponseSchema.parse(body).data;
41262
41262
  },
41263
41263
  async listTaskSummaries(projectSlug, filters = {}, options) {
41264
- const path34 = buildTaskListPath(projectSlug, filters, "summary");
41265
- const body = await request(path34, options?.signal ? { signal: options.signal } : void 0);
41264
+ const path36 = buildTaskListPath(projectSlug, filters, "summary");
41265
+ const body = await request(path36, options?.signal ? { signal: options.signal } : void 0);
41266
41266
  return taskSummaryListResponseSchema.parse(body).data;
41267
41267
  },
41268
41268
  async listTaxonomy(projectSlug) {
@@ -41271,7 +41271,7 @@ function createMrrlinClient(config2) {
41271
41271
  },
41272
41272
  async listWikiPages(projectSlug, filters = {}, options) {
41273
41273
  const view = options?.view ?? filters.view;
41274
- const path34 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
41274
+ const path36 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
41275
41275
  folder: filters.folder,
41276
41276
  id: filters.id,
41277
41277
  limit: filters.limit === void 0 ? void 0 : String(filters.limit),
@@ -41279,20 +41279,20 @@ function createMrrlinClient(config2) {
41279
41279
  taskId: filters.taskId,
41280
41280
  view
41281
41281
  });
41282
- const body = await request(path34, options?.signal ? { signal: options.signal } : void 0);
41282
+ const body = await request(path36, options?.signal ? { signal: options.signal } : void 0);
41283
41283
  if (view === "summary") {
41284
41284
  return wikiPageSummaryListResponseSchema.parse(body).data;
41285
41285
  }
41286
41286
  return wikiPageListResponseSchema.parse(body).data;
41287
41287
  },
41288
41288
  async searchWikiPages(projectSlug, query) {
41289
- const path34 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
41289
+ const path36 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
41290
41290
  folder: query.folder,
41291
41291
  limit: query.limit === void 0 ? void 0 : String(query.limit),
41292
41292
  pathPrefix: query.pathPrefix,
41293
41293
  q: query.q
41294
41294
  });
41295
- const body = await request(path34);
41295
+ const body = await request(path36);
41296
41296
  return wikiPageSearchResponseSchema.parse(body).data;
41297
41297
  },
41298
41298
  async updatePlan(projectSlug, planId, patch) {
@@ -45926,7 +45926,7 @@ function firstString(...values) {
45926
45926
  return null;
45927
45927
  }
45928
45928
  function runCodexExec(input, deps) {
45929
- const spawn9 = deps?.spawn ?? import_node_child_process6.spawn;
45929
+ const spawn10 = deps?.spawn ?? import_node_child_process6.spawn;
45930
45930
  const executable = input.codexExecutable ?? "codex";
45931
45931
  const sandbox = input.sandbox ?? "read-only";
45932
45932
  const fullPrompt = input.developerInstructions.trim() ? `${input.developerInstructions.trim()}
@@ -45972,7 +45972,7 @@ ${input.prompt}` : input.prompt;
45972
45972
  }
45973
45973
  let child;
45974
45974
  try {
45975
- child = spawn9(spawnCmd, spawnArgs, options);
45975
+ child = spawn10(spawnCmd, spawnArgs, options);
45976
45976
  } catch (err) {
45977
45977
  finish({ ok: false, error: `Failed to spawn codex exec: ${errMessage(err)}` });
45978
45978
  return;
@@ -46018,7 +46018,7 @@ function errMessage(err) {
46018
46018
  // ../../packages/agent-client/dist/providers/claude/exec.js
46019
46019
  var import_node_child_process7 = require("node:child_process");
46020
46020
  function runClaudeExec(input, deps) {
46021
- const spawn9 = deps?.spawn ?? import_node_child_process7.spawn;
46021
+ const spawn10 = deps?.spawn ?? import_node_child_process7.spawn;
46022
46022
  const executable = input.codexExecutable ?? "claude";
46023
46023
  const args = ["--print", "--output-format", "json", "--strict-mcp-config"];
46024
46024
  if (input.mcpConfig) {
@@ -46061,7 +46061,7 @@ function runClaudeExec(input, deps) {
46061
46061
  }
46062
46062
  let child;
46063
46063
  try {
46064
- child = spawn9(spawnCmd, spawnArgs, options);
46064
+ child = spawn10(spawnCmd, spawnArgs, options);
46065
46065
  } catch (err) {
46066
46066
  finish({ ok: false, error: `Failed to spawn ${executable} exec: ${errMessage2(err)}` });
46067
46067
  return;
@@ -46135,7 +46135,7 @@ function errMessage2(err) {
46135
46135
  // ../../packages/agent-client/dist/providers/agy/exec.js
46136
46136
  var import_node_child_process8 = require("node:child_process");
46137
46137
  function runAgyExec(input, deps) {
46138
- const spawn9 = deps?.spawn ?? import_node_child_process8.spawn;
46138
+ const spawn10 = deps?.spawn ?? import_node_child_process8.spawn;
46139
46139
  const executable = input.codexExecutable ?? "agy";
46140
46140
  const args = ["--output-format", "json"];
46141
46141
  if (input.sandbox === "read-only") {
@@ -46188,7 +46188,7 @@ function runAgyExec(input, deps) {
46188
46188
  }
46189
46189
  let child;
46190
46190
  try {
46191
- child = spawn9(spawnCmd, spawnArgs, options);
46191
+ child = spawn10(spawnCmd, spawnArgs, options);
46192
46192
  } catch (err) {
46193
46193
  finish({ ok: false, error: `Failed to spawn ${executable} exec: ${err instanceof Error ? err.message : String(err)}` });
46194
46194
  return;
@@ -49027,7 +49027,7 @@ var DEFAULT_STATUS_TIMEOUT_MS = 1e4;
49027
49027
  function errMessage3(err) {
49028
49028
  return err instanceof Error ? err.message : String(err);
49029
49029
  }
49030
- function runExternalAgentsStatus(bin, args, timeoutMs, spawn9) {
49030
+ function runExternalAgentsStatus(bin, args, timeoutMs, spawn10) {
49031
49031
  return new Promise((resolve3) => {
49032
49032
  let settled = false;
49033
49033
  const timerRef = { id: void 0 };
@@ -49040,7 +49040,7 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn9) {
49040
49040
  const options = { stdio: ["ignore", "pipe", "pipe"], env: process.env, shell: false };
49041
49041
  let child;
49042
49042
  try {
49043
- child = spawn9(bin, args, options);
49043
+ child = spawn10(bin, args, options);
49044
49044
  } catch (err) {
49045
49045
  finish({ stdout: "", error: `spawn ${bin} failed: ${errMessage3(err)}` });
49046
49046
  return;
@@ -49064,13 +49064,13 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn9) {
49064
49064
  });
49065
49065
  }
49066
49066
  async function fetchRegistrySnapshot(deps) {
49067
- const spawn9 = deps?.spawn ?? import_node_child_process11.spawn;
49067
+ const spawn10 = deps?.spawn ?? import_node_child_process11.spawn;
49068
49068
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
49069
49069
  const { stdout, error: error51 } = await runExternalAgentsStatus(
49070
49070
  command,
49071
49071
  [...prefixArgs, "status", "--json"],
49072
49072
  deps?.statusTimeoutMs ?? DEFAULT_STATUS_TIMEOUT_MS,
49073
- spawn9
49073
+ spawn10
49074
49074
  );
49075
49075
  if (error51) return { ok: false, error: error51 };
49076
49076
  try {
@@ -49114,7 +49114,7 @@ function estimateTokenCount(text) {
49114
49114
  function errMessage4(err) {
49115
49115
  return err instanceof Error ? err.message : String(err);
49116
49116
  }
49117
- function runExternalAgents(bin, args, label, timeoutMs, spawn9) {
49117
+ function runExternalAgents(bin, args, label, timeoutMs, spawn10) {
49118
49118
  return new Promise((resolve3) => {
49119
49119
  let settled = false;
49120
49120
  const timerRef = { id: void 0 };
@@ -49132,7 +49132,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn9) {
49132
49132
  };
49133
49133
  let child;
49134
49134
  try {
49135
- child = spawn9(bin, args, options);
49135
+ child = spawn10(bin, args, options);
49136
49136
  } catch (err) {
49137
49137
  finish({ code: null, stdout: "", error: `spawn ${bin} failed: ${errMessage4(err)}` });
49138
49138
  return;
@@ -49152,7 +49152,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn9) {
49152
49152
  });
49153
49153
  }
49154
49154
  async function pickPanel(input, deps) {
49155
- const spawn9 = deps?.spawn ?? import_node_child_process12.spawn;
49155
+ const spawn10 = deps?.spawn ?? import_node_child_process12.spawn;
49156
49156
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
49157
49157
  const args = [
49158
49158
  "pick",
@@ -49165,7 +49165,7 @@ async function pickPanel(input, deps) {
49165
49165
  "--exclude-providers",
49166
49166
  input.excludeProvider
49167
49167
  ];
49168
- const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs, spawn9);
49168
+ const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs, spawn10);
49169
49169
  if (r.error) return { ok: false, error: r.error };
49170
49170
  if (r.code === 3) return { ok: true, agents: [] };
49171
49171
  if (r.code !== 0) return { ok: false, error: `external-agents pick exited ${r.code}` };
@@ -49199,10 +49199,10 @@ function parseDispatch(agentId, stdout, exitCode) {
49199
49199
  return { ok: true, text: parsed.text, usage };
49200
49200
  }
49201
49201
  async function dispatchHead(agentId, prompt, timeoutMs, deps) {
49202
- const spawn9 = deps?.spawn ?? import_node_child_process12.spawn;
49202
+ const spawn10 = deps?.spawn ?? import_node_child_process12.spawn;
49203
49203
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
49204
49204
  const args = ["dispatch", agentId, "--json", redactSecretFormats(prompt)];
49205
- const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs, spawn9);
49205
+ const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs, spawn10);
49206
49206
  if (r.error) return { ok: false, error: r.error };
49207
49207
  return parseDispatch(agentId, r.stdout, r.code);
49208
49208
  }
@@ -58001,8 +58001,8 @@ async function findSessionDays(stateDir, sessionId) {
58001
58001
  function isRecord5(v) {
58002
58002
  return v !== null && typeof v === "object";
58003
58003
  }
58004
- function resolvePath(root, path34) {
58005
- const parts = path34.split(".");
58004
+ function resolvePath(root, path36) {
58005
+ const parts = path36.split(".");
58006
58006
  let cur = root;
58007
58007
  for (let i = 0; i < parts.length - 1; i += 1) {
58008
58008
  const part = parts[i];
@@ -58070,9 +58070,9 @@ async function gate(artifact, prose, ctx) {
58070
58070
  return { ok: true, gated: true, artifact: withheldExcerptClone(artifact) };
58071
58071
  }
58072
58072
  const maskedClone = typeof structuredClone === "function" ? structuredClone(artifact) : JSON.parse(JSON.stringify(artifact));
58073
- for (const { path: path34, masked } of fields) {
58074
- const target = resolvePath(maskedClone, path34);
58075
- if (!target) throw new Error(`pii-gate: path "${path34}" failed to resolve on the clone after validating on the original`);
58073
+ for (const { path: path36, masked } of fields) {
58074
+ const target = resolvePath(maskedClone, path36);
58075
+ if (!target) throw new Error(`pii-gate: path "${path36}" failed to resolve on the clone after validating on the original`);
58076
58076
  target.parent[target.key] = masked;
58077
58077
  }
58078
58078
  return { ok: true, gated: false, artifact: maskedClone };
@@ -58282,9 +58282,9 @@ var CheckoutRegistry = class {
58282
58282
  get(slug) {
58283
58283
  return this.read()[slug] ?? null;
58284
58284
  }
58285
- confirm(slug, path34, now) {
58285
+ confirm(slug, path36, now) {
58286
58286
  const all = this.read();
58287
- all[slug] = { path: path34, confirmedAt: now };
58287
+ all[slug] = { path: path36, confirmedAt: now };
58288
58288
  (0, import_node_fs8.writeFileSync)(this.file, JSON.stringify(all, null, 2));
58289
58289
  }
58290
58290
  /**
@@ -64126,7 +64126,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
64126
64126
  }
64127
64127
 
64128
64128
  // src/_generated/version.ts
64129
- var PKG_VERSION = "0.4.157";
64129
+ var PKG_VERSION = "0.4.158";
64130
64130
 
64131
64131
  // src/bridge-allowed-origins.ts
64132
64132
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -66148,15 +66148,15 @@ var cache = /* @__PURE__ */ new Map();
66148
66148
  function resolveInstallationId(stateDir) {
66149
66149
  const cached2 = cache.get(stateDir);
66150
66150
  if (cached2 !== void 0) return cached2;
66151
- const path34 = (0, import_node_path33.join)(stateDir, FILE_NAME);
66151
+ const path36 = (0, import_node_path33.join)(stateDir, FILE_NAME);
66152
66152
  let id;
66153
66153
  try {
66154
- id = (0, import_node_fs22.readFileSync)(path34, "utf8").trim();
66154
+ id = (0, import_node_fs22.readFileSync)(path36, "utf8").trim();
66155
66155
  if (!UUID.test(id)) throw new Error("unusable");
66156
66156
  } catch {
66157
66157
  id = (0, import_node_crypto19.randomUUID)();
66158
- (0, import_node_fs22.mkdirSync)((0, import_node_path33.dirname)(path34), { recursive: true });
66159
- (0, import_node_fs22.writeFileSync)(path34, `${id}
66158
+ (0, import_node_fs22.mkdirSync)((0, import_node_path33.dirname)(path36), { recursive: true });
66159
+ (0, import_node_fs22.writeFileSync)(path36, `${id}
66160
66160
  `, "utf8");
66161
66161
  }
66162
66162
  cache.set(stateDir, id);
@@ -68083,8 +68083,8 @@ function newArtifactId() {
68083
68083
  return `EA-${import_node_crypto20.default.randomUUID()}`;
68084
68084
  }
68085
68085
  var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
68086
- function isBlastRadiusFloorPath(path34) {
68087
- return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path34));
68086
+ function isBlastRadiusFloorPath(path36) {
68087
+ return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path36));
68088
68088
  }
68089
68089
  var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process24.execFile);
68090
68090
  async function gitOutput(cwd, args) {
@@ -74956,9 +74956,9 @@ var DirectorRelay = class {
74956
74956
 
74957
74957
  // src/remote-phone-relay.ts
74958
74958
  function loadOrCreateAgentDeviceKey() {
74959
- const path34 = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-device-key");
74959
+ const path36 = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-device-key");
74960
74960
  try {
74961
- const raw = JSON.parse((0, import_node_fs25.readFileSync)(path34, "utf8"));
74961
+ const raw = JSON.parse((0, import_node_fs25.readFileSync)(path36, "utf8"));
74962
74962
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
74963
74963
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
74964
74964
  }
@@ -74968,7 +74968,7 @@ function loadOrCreateAgentDeviceKey() {
74968
74968
  try {
74969
74969
  (0, import_node_fs25.mkdirSync)((0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin"), { recursive: true });
74970
74970
  (0, import_node_fs25.writeFileSync)(
74971
- path34,
74971
+ path36,
74972
74972
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
74973
74973
  { mode: 384 }
74974
74974
  );
@@ -82861,9 +82861,474 @@ async function uninstallPrompts(codexHome, names) {
82861
82861
  return out;
82862
82862
  }
82863
82863
 
82864
+ // src/connect.ts
82865
+ var import_node_child_process27 = require("node:child_process");
82866
+ var CONNECT_EXIT = {
82867
+ ok: 0,
82868
+ codeRejected: 3,
82869
+ unsupportedOs: 4,
82870
+ setupFailed: 5,
82871
+ healthTimeout: 6,
82872
+ apiUnreachable: 7
82873
+ };
82874
+ function spawnRedacted(command, args, opts, sinks) {
82875
+ return new Promise((resolve3) => {
82876
+ const child = (0, import_node_child_process27.spawn)(command, args, { cwd: opts.cwd, env: opts.env, stdio: ["ignore", "pipe", "pipe"] });
82877
+ const buffers = { stdout: "", stderr: "" };
82878
+ const feed = (stream, chunk) => {
82879
+ buffers[stream] += chunk.toString("utf8");
82880
+ let nl = buffers[stream].indexOf("\n");
82881
+ while (nl !== -1) {
82882
+ sinks[stream](redact(buffers[stream].slice(0, nl + 1)));
82883
+ buffers[stream] = buffers[stream].slice(nl + 1);
82884
+ nl = buffers[stream].indexOf("\n");
82885
+ }
82886
+ };
82887
+ const flush = () => {
82888
+ for (const stream of ["stdout", "stderr"]) {
82889
+ if (buffers[stream]) sinks[stream](redact(buffers[stream]));
82890
+ buffers[stream] = "";
82891
+ }
82892
+ };
82893
+ child.stdout?.on("data", (c) => feed("stdout", c));
82894
+ child.stderr?.on("data", (c) => feed("stderr", c));
82895
+ child.on("error", () => {
82896
+ flush();
82897
+ resolve3({ status: null });
82898
+ });
82899
+ child.on("close", (status) => {
82900
+ flush();
82901
+ resolve3({ status });
82902
+ });
82903
+ });
82904
+ }
82905
+ var HEALTH_TIMEOUT_MS = 6e4;
82906
+ var HEALTH_POLL_MS = 2e3;
82907
+ function parseCode(argv) {
82908
+ for (let i = 0; i < argv.length; i += 1) {
82909
+ const arg = argv[i] ?? "";
82910
+ if (arg === "--code") return (argv[i + 1] ?? "").trim() || null;
82911
+ if (arg.startsWith("--code=")) return arg.slice("--code=".length).trim() || null;
82912
+ }
82913
+ return null;
82914
+ }
82915
+ function isUnauthorized(error51) {
82916
+ return typeof error51 === "object" && error51 !== null && error51.status === 401;
82917
+ }
82918
+ async function runConnect(argv, deps) {
82919
+ const say = (message) => deps.log(`[mrrlin-mcp connect] ${message}`);
82920
+ const code = parseCode(argv);
82921
+ if (!code) {
82922
+ say("Usage: mrrlin-mcp connect --code <setup code>");
82923
+ return 2;
82924
+ }
82925
+ if (deps.platform === "win32") {
82926
+ say("Mrrlin's helper doesn't support Windows yet.");
82927
+ return CONNECT_EXIT.unsupportedOs;
82928
+ }
82929
+ const baseBody = {
82930
+ code,
82931
+ hostname: deps.hostname,
82932
+ os: `${deps.platform} ${deps.osRelease}`.trim(),
82933
+ cliVersion: deps.cliVersion
82934
+ };
82935
+ const stored = deps.readSecret();
82936
+ let result;
82937
+ try {
82938
+ try {
82939
+ result = await deps.redeem(stored ? { ...baseBody, credentialSecret: stored } : baseBody);
82940
+ } catch (error51) {
82941
+ if (!stored || !isUnauthorized(error51)) throw error51;
82942
+ result = await deps.redeem(baseBody);
82943
+ }
82944
+ } catch (error51) {
82945
+ if (isUnauthorized(error51)) {
82946
+ say("This setup code has expired or was already used. Ask Mrrlin for a new setup message.");
82947
+ return CONNECT_EXIT.codeRejected;
82948
+ }
82949
+ say("Could not reach Mrrlin. Check your internet connection and try again.");
82950
+ return CONNECT_EXIT.apiUnreachable;
82951
+ }
82952
+ if (result.kind === "redeemed") {
82953
+ try {
82954
+ deps.persistSecret(result.secret);
82955
+ } catch {
82956
+ say("Could not save this computer's credential.");
82957
+ return CONNECT_EXIT.setupFailed;
82958
+ }
82959
+ say("Saved this computer's credential.");
82960
+ } else {
82961
+ say("Already connected: this computer's existing credential claimed the code.");
82962
+ }
82963
+ for (const sub of [["configure", "bridge"], ["install-service"]]) {
82964
+ let run3;
82965
+ try {
82966
+ run3 = await deps.spawn([deps.scriptPath, ...sub], { cwd: deps.homedir, env: deps.env });
82967
+ } catch {
82968
+ run3 = { status: null };
82969
+ }
82970
+ if (run3.status !== 0) {
82971
+ say(`\`${sub.join(" ")}\` failed (exit ${run3.status ?? "none"}). Run \`mrrlin-mcp doctor\` for details.`);
82972
+ return CONNECT_EXIT.setupFailed;
82973
+ }
82974
+ say(`${sub.join(" ")}: done`);
82975
+ }
82976
+ if (deps.platform === "darwin") {
82977
+ let agent;
82978
+ try {
82979
+ agent = deps.installLaunchAgent();
82980
+ } catch {
82981
+ agent = { ok: false, message: "unexpected error" };
82982
+ }
82983
+ if (!agent.ok) {
82984
+ say(`Could not set up start-after-restart: ${redact(agent.message)}`);
82985
+ return CONNECT_EXIT.setupFailed;
82986
+ }
82987
+ say("Start after restart: set up.");
82988
+ } else {
82989
+ say("Optional: run `pm2 startup` and follow the command it prints to start the helper after a reboot.");
82990
+ }
82991
+ const started = deps.now();
82992
+ let healthy = false;
82993
+ for (; ; ) {
82994
+ try {
82995
+ const health = await deps.fetchHealth();
82996
+ if (health?.service?.apiAuth === "ok") {
82997
+ healthy = true;
82998
+ break;
82999
+ }
83000
+ } catch {
83001
+ }
83002
+ if (deps.now() - started >= HEALTH_TIMEOUT_MS) break;
83003
+ await deps.sleep(HEALTH_POLL_MS);
83004
+ }
83005
+ if (!healthy) {
83006
+ say("The helper did not report a working connection within 60 seconds. Run `mrrlin-mcp doctor`.");
83007
+ return CONNECT_EXIT.healthTimeout;
83008
+ }
83009
+ say("Helper is running and signed in.");
83010
+ let readiness = null;
83011
+ try {
83012
+ readiness = await deps.pushReadinessOnce();
83013
+ } catch {
83014
+ say("Connected, but could not report provider readiness yet; it updates within a minute.");
83015
+ return CONNECT_EXIT.ok;
83016
+ }
83017
+ if (readiness) {
83018
+ for (const provider of ["codex", "claude", "agy"]) {
83019
+ const entry = readiness[provider];
83020
+ if (!entry) continue;
83021
+ say(entry.ready ? `${provider}: ready` : `${provider}: not ready (${entry.details.map(redact).join("; ")})`);
83022
+ }
83023
+ }
83024
+ return CONNECT_EXIT.ok;
83025
+ }
83026
+
83027
+ // src/doctor.ts
83028
+ var import_node_fs31 = require("node:fs");
83029
+ var import_node_path46 = __toESM(require("node:path"), 1);
83030
+ var import_semver4 = __toESM(require_semver2(), 1);
83031
+ var ISO_TS = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
83032
+ var defaultLogFs = {
83033
+ listDir: (dir) => {
83034
+ try {
83035
+ return (0, import_node_fs31.readdirSync)(dir);
83036
+ } catch {
83037
+ return null;
83038
+ }
83039
+ },
83040
+ readFile: (p) => {
83041
+ try {
83042
+ return (0, import_node_fs31.readFileSync)(p, "utf8");
83043
+ } catch {
83044
+ return null;
83045
+ }
83046
+ }
83047
+ };
83048
+ function readRecentErrorEntries(stateDir, n, fs16 = defaultLogFs) {
83049
+ const logsDir = import_node_path46.default.join(stateDir, "logs");
83050
+ const names = (fs16.listDir(logsDir) ?? []).filter((name) => name.endsWith(".jsonl")).sort();
83051
+ const entries = [];
83052
+ for (const name of names) {
83053
+ const raw = fs16.readFile(import_node_path46.default.join(logsDir, name));
83054
+ if (!raw) continue;
83055
+ for (const line of raw.split("\n")) {
83056
+ if (!line.trim()) continue;
83057
+ let record2;
83058
+ try {
83059
+ record2 = JSON.parse(line);
83060
+ } catch {
83061
+ continue;
83062
+ }
83063
+ const payload = record2.payload;
83064
+ const payloadError = typeof payload?.error === "string" && payload.error.length > 0 ? payload.error : null;
83065
+ if (record2.type !== "error" && payloadError === null) continue;
83066
+ const rawText = payloadError ?? (typeof payload?.message === "string" ? payload.message : JSON.stringify(record2.payload ?? null));
83067
+ entries.push({ ts: typeof record2.ts === "string" && ISO_TS.test(record2.ts) ? record2.ts : "", text: redact(rawText).slice(0, 300) });
83068
+ }
83069
+ }
83070
+ return entries.slice(-n);
83071
+ }
83072
+ function configChecks(deps) {
83073
+ const fix = "mrrlin-mcp configure bridge";
83074
+ let claudeOk = false;
83075
+ const claudeRaw = deps.readFile(import_node_path46.default.join(deps.homedir, ".claude.json"));
83076
+ if (claudeRaw) {
83077
+ try {
83078
+ const parsed = JSON.parse(claudeRaw);
83079
+ claudeOk = Boolean(parsed.mcpServers && "mrrlin" in parsed.mcpServers);
83080
+ } catch {
83081
+ claudeOk = false;
83082
+ }
83083
+ }
83084
+ const codexPath = import_node_path46.default.join(deps.codexHome ?? import_node_path46.default.join(deps.homedir, ".codex"), "config.toml");
83085
+ const codexOk = /^\[mcp_servers\.mrrlin\]/m.test(deps.readFile(codexPath) ?? "");
83086
+ return [
83087
+ {
83088
+ id: "claudeConfig",
83089
+ ok: claudeOk,
83090
+ detail: claudeOk ? "Mrrlin is registered in ~/.claude.json" : "no Mrrlin entry in ~/.claude.json",
83091
+ fix: claudeOk ? null : fix,
83092
+ counted: true
83093
+ },
83094
+ {
83095
+ id: "codexConfig",
83096
+ ok: codexOk,
83097
+ detail: codexOk ? "Mrrlin is registered in the Codex config" : "no Mrrlin entry in the Codex config",
83098
+ fix: codexOk ? null : fix,
83099
+ counted: true
83100
+ }
83101
+ ];
83102
+ }
83103
+ async function runDoctor(flags, deps) {
83104
+ if (flags.logs) {
83105
+ const entries = readRecentErrorEntries(deps.stateDir, 20);
83106
+ if (entries.length === 0) {
83107
+ deps.print("No helper logs yet.");
83108
+ return 0;
83109
+ }
83110
+ for (const entry of entries) deps.print(redact(`${entry.ts} ${entry.text}`));
83111
+ return 0;
83112
+ }
83113
+ const checks = [];
83114
+ const major = Number(deps.nodeVersion.split(".")[0]);
83115
+ checks.push({
83116
+ id: "node",
83117
+ ok: major >= 22,
83118
+ detail: `Node ${deps.nodeVersion}`,
83119
+ fix: major >= 22 ? null : "install Node 22 or newer",
83120
+ counted: true
83121
+ });
83122
+ try {
83123
+ const latest = (await deps.npmLatest()).trim();
83124
+ const behind = import_semver4.default.valid(latest) !== null && import_semver4.default.valid(deps.installedVersion) !== null ? import_semver4.default.lt(deps.installedVersion, latest) : latest !== deps.installedVersion;
83125
+ checks.push({
83126
+ id: "version",
83127
+ ok: !behind,
83128
+ detail: behind ? `installed ${deps.installedVersion}; newer version ${latest} available - the setup message pins the tested version` : `${deps.installedVersion} is the latest`,
83129
+ fix: null,
83130
+ counted: false,
83131
+ info: true
83132
+ });
83133
+ } catch {
83134
+ checks.push({
83135
+ id: "version",
83136
+ ok: false,
83137
+ detail: `installed ${deps.installedVersion}; could not read the latest version`,
83138
+ fix: null,
83139
+ counted: false,
83140
+ info: true
83141
+ });
83142
+ }
83143
+ let online = false;
83144
+ try {
83145
+ online = await deps.pm2Online();
83146
+ } catch {
83147
+ online = false;
83148
+ }
83149
+ checks.push({
83150
+ id: "process",
83151
+ ok: online,
83152
+ detail: online ? "mrrlin-bridge is online" : "mrrlin-bridge is not running",
83153
+ fix: online ? null : "mrrlin-mcp install-service",
83154
+ counted: true
83155
+ });
83156
+ let health = null;
83157
+ try {
83158
+ health = await deps.fetchHealth();
83159
+ } catch {
83160
+ health = null;
83161
+ }
83162
+ const service = health?.service;
83163
+ const unreachable = "the helper is not answering on 127.0.0.1:8791";
83164
+ checks.push({
83165
+ id: "apiAuth",
83166
+ ok: service?.apiAuth === "ok",
83167
+ detail: service ? `apiAuth ${service.apiAuth ?? "unknown"}` : unreachable,
83168
+ fix: service?.apiAuth === "ok" ? null : service ? "run mrrlin-mcp connect with a new setup code from Mrrlin" : "mrrlin-mcp install-service",
83169
+ counted: true
83170
+ });
83171
+ let selected = null;
83172
+ try {
83173
+ selected = await deps.fetchSelectedProvider();
83174
+ } catch {
83175
+ selected = null;
83176
+ }
83177
+ const codexAuth = service?.codexAuth;
83178
+ const codexAuthFails = selected === "codex" && Boolean(service) && codexAuth !== "ok" && codexAuth !== "unknown";
83179
+ checks.push({
83180
+ id: "codexAuth",
83181
+ ok: codexAuth === "ok",
83182
+ detail: service ? `codexAuth ${codexAuth ?? "unknown"}` : unreachable,
83183
+ fix: codexAuthFails ? "run `codex login`" : null,
83184
+ counted: codexAuthFails,
83185
+ info: !codexAuthFails
83186
+ });
83187
+ checks.push({
83188
+ id: "pairing",
83189
+ ok: service?.pairing === "paired",
83190
+ detail: service ? `pairing ${service.pairing ?? "unpaired"}` : unreachable,
83191
+ fix: null,
83192
+ counted: false,
83193
+ info: true
83194
+ });
83195
+ const readiness = {};
83196
+ for (const provider of ["codex", "claude", "agy"]) {
83197
+ let result;
83198
+ try {
83199
+ result = await deps.verifyReadiness(provider);
83200
+ } catch {
83201
+ result = { ready: false, checks: { cli: false, version: false, auth: false, mcpReachable: false, smoke: false }, details: ["check failed to run"] };
83202
+ }
83203
+ readiness[provider] = result;
83204
+ const counted = selected === provider;
83205
+ checks.push({
83206
+ id: provider,
83207
+ ok: result.ready,
83208
+ detail: result.ready ? "ready" : redact(result.details.join("; ")) || "not ready",
83209
+ fix: result.ready || !counted ? null : `install and sign in to ${provider}, then run mrrlin-mcp doctor again`,
83210
+ counted,
83211
+ info: !counted
83212
+ });
83213
+ }
83214
+ checks.push(...configChecks(deps));
83215
+ const hook = deps.bootHookStatus();
83216
+ const hookOk = hook.status === "configured" || hook.status === "unknown";
83217
+ checks.push({
83218
+ id: "restart",
83219
+ ok: hookOk,
83220
+ detail: hook.status === "configured" ? `starts after a restart (${hook.label})` : hook.status === "unknown" ? "not checked on this platform" : hook.status === "registered_failing" ? `${hook.label} is registered but failed with exit code ${hook.lastExitCode}` : "nothing starts the helper after a restart",
83221
+ fix: hookOk ? null : "run mrrlin-mcp connect with a new setup code from Mrrlin",
83222
+ counted: true
83223
+ });
83224
+ try {
83225
+ await deps.pushReadiness(readiness);
83226
+ } catch {
83227
+ }
83228
+ if (flags.json) {
83229
+ deps.print(
83230
+ JSON.stringify({
83231
+ checks: checks.map(({ id, ok, detail, fix, info }) => ({
83232
+ id: redact(id),
83233
+ ok,
83234
+ status: info ? "info" : ok ? "ok" : "fail",
83235
+ detail: redact(detail),
83236
+ fix: fix === null ? null : redact(fix)
83237
+ }))
83238
+ })
83239
+ );
83240
+ } else {
83241
+ for (const c of checks) {
83242
+ const mark = c.info ? "-- " : c.ok ? "OK " : "FAIL";
83243
+ deps.print(redact(`${mark} ${c.id} ${c.detail}${c.ok || !c.fix ? "" : ` Fix: ${c.fix}`}`));
83244
+ }
83245
+ }
83246
+ return checks.every((c) => c.ok || !c.counted) ? 0 : 1;
83247
+ }
83248
+
83249
+ // src/launch-agent.ts
83250
+ var import_node_path47 = __toESM(require("node:path"), 1);
83251
+ var BRIDGE_LAUNCH_AGENT_LABEL = "com.mrrlin.director-bridge";
83252
+ function escapeXml(value) {
83253
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
83254
+ }
83255
+ function bridgeLaunchAgentPath(home) {
83256
+ return import_node_path47.default.join(home, "Library", "LaunchAgents", `${BRIDGE_LAUNCH_AGENT_LABEL}.plist`);
83257
+ }
83258
+ function renderBridgeLaunchAgent(input) {
83259
+ const { home, pm2Path, nodeDir } = input;
83260
+ const launchPath = `${nodeDir}:${import_node_path47.default.dirname(pm2Path)}:/usr/bin:/bin`;
83261
+ const logDir = `${home}/.mrrlin/director-bridge`;
83262
+ return `<?xml version="1.0" encoding="UTF-8"?>
83263
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
83264
+ <plist version="1.0">
83265
+ <dict>
83266
+ <key>Label</key>
83267
+ <string>${BRIDGE_LAUNCH_AGENT_LABEL}</string>
83268
+ <key>ProgramArguments</key>
83269
+ <array>
83270
+ <string>${escapeXml(pm2Path)}</string>
83271
+ <string>resurrect</string>
83272
+ </array>
83273
+ <key>EnvironmentVariables</key>
83274
+ <dict>
83275
+ <key>PATH</key>
83276
+ <string>${escapeXml(launchPath)}</string>
83277
+ <key>HOME</key>
83278
+ <string>${escapeXml(home)}</string>
83279
+ <key>PM2_HOME</key>
83280
+ <string>${escapeXml(`${home}/.pm2`)}</string>
83281
+ </dict>
83282
+ <key>RunAtLoad</key>
83283
+ <true/>
83284
+ <key>KeepAlive</key>
83285
+ <false/>
83286
+ <key>StandardOutPath</key>
83287
+ <string>${escapeXml(`${logDir}/launchd.out.log`)}</string>
83288
+ <key>StandardErrorPath</key>
83289
+ <string>${escapeXml(`${logDir}/launchd.err.log`)}</string>
83290
+ </dict>
83291
+ </plist>
83292
+ `;
83293
+ }
83294
+ function installBridgeLaunchAgent(deps) {
83295
+ if (deps.platform !== "darwin") {
83296
+ return { ok: true, message: "LaunchAgent is macOS only; nothing to do on this platform." };
83297
+ }
83298
+ const plistPath = bridgeLaunchAgentPath(deps.home);
83299
+ const domain2 = `gui/${deps.uid}`;
83300
+ try {
83301
+ deps.mkdirp(import_node_path47.default.dirname(plistPath));
83302
+ deps.writeFile(
83303
+ plistPath,
83304
+ renderBridgeLaunchAgent({ home: deps.home, pm2Path: deps.pm2Path, nodeDir: deps.nodeDir }),
83305
+ 420
83306
+ );
83307
+ } catch (error51) {
83308
+ return { ok: false, message: `Could not write ${plistPath}: ${error51 instanceof Error ? error51.message : String(error51)}` };
83309
+ }
83310
+ deps.launchctl(["bootout", `${domain2}/${BRIDGE_LAUNCH_AGENT_LABEL}`]);
83311
+ const boot = deps.launchctl(["bootstrap", domain2, plistPath]);
83312
+ if (boot.status !== 0) {
83313
+ return { ok: false, message: `launchctl bootstrap ${domain2} failed (exit ${boot.status ?? "none"}).` };
83314
+ }
83315
+ return { ok: true, message: `Installed ${plistPath}.` };
83316
+ }
83317
+ function removeBridgeLaunchAgent(deps) {
83318
+ if (deps.platform !== "darwin") {
83319
+ return { ok: true, message: "LaunchAgent is macOS only; nothing to remove on this platform." };
83320
+ }
83321
+ deps.launchctl(["bootout", `gui/${deps.uid}/${BRIDGE_LAUNCH_AGENT_LABEL}`]);
83322
+ try {
83323
+ deps.removeFile(bridgeLaunchAgentPath(deps.home));
83324
+ } catch {
83325
+ }
83326
+ return { ok: true, message: "Removed the LaunchAgent." };
83327
+ }
83328
+
82864
83329
  // src/extract/command.ts
82865
83330
  var import_promises18 = require("node:fs/promises");
82866
- var import_node_path46 = require("node:path");
83331
+ var import_node_path48 = require("node:path");
82867
83332
  function parseArgs(args) {
82868
83333
  const map2 = /* @__PURE__ */ new Map();
82869
83334
  for (let i = 0; i < args.length; i++) {
@@ -82900,7 +83365,7 @@ Missing required flag(s): ${missing.join(
82900
83365
  const days = await findSessionDays(deps.stateDir, sessionId);
82901
83366
  const matchingLines = [];
82902
83367
  for (const day of days) {
82903
- const logPath = (0, import_node_path46.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
83368
+ const logPath = (0, import_node_path48.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
82904
83369
  let raw;
82905
83370
  try {
82906
83371
  raw = await (0, import_promises18.readFile)(logPath, "utf8");
@@ -82990,27 +83455,27 @@ function augmentProcessPathWithCommonDirs() {
82990
83455
  if (isWin) return;
82991
83456
  const home = process.env.HOME || (0, import_node_os25.homedir)();
82992
83457
  const candidates = [
82993
- import_node_path48.default.join(home, ".local", "bin"),
82994
- import_node_path48.default.join(home, ".cargo", "bin"),
83458
+ import_node_path50.default.join(home, ".local", "bin"),
83459
+ import_node_path50.default.join(home, ".cargo", "bin"),
82995
83460
  "/usr/local/bin",
82996
83461
  "/opt/homebrew/bin"
82997
83462
  ];
82998
- const existing = (process.env.PATH || "").split(import_node_path48.default.delimiter).filter(Boolean);
83463
+ const existing = (process.env.PATH || "").split(import_node_path50.default.delimiter).filter(Boolean);
82999
83464
  const existingSet = new Set(existing);
83000
- const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs31.existsSync)(d));
83465
+ const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs32.existsSync)(d));
83001
83466
  if (toAdd.length > 0) {
83002
- process.env.PATH = [...existing, ...toAdd].join(import_node_path48.default.delimiter);
83467
+ process.env.PATH = [...existing, ...toAdd].join(import_node_path50.default.delimiter);
83003
83468
  }
83004
83469
  }
83005
83470
  augmentProcessPathWithCommonDirs();
83006
83471
  function pm2Runner(args) {
83007
- const r = (0, import_node_child_process27.spawnSync)("pm2", args, { encoding: "utf8" });
83472
+ const r = (0, import_node_child_process28.spawnSync)("pm2", args, { encoding: "utf8" });
83008
83473
  process.stderr.write(r.stdout ?? "");
83009
83474
  process.stderr.write(r.stderr ?? "");
83010
83475
  return { code: r.status ?? 1, stdout: r.stdout ?? "" };
83011
83476
  }
83012
83477
  function whichBin(bin) {
83013
- const r = (0, import_node_child_process27.spawnSync)("which", [bin], { encoding: "utf8" });
83478
+ const r = (0, import_node_child_process28.spawnSync)("which", [bin], { encoding: "utf8" });
83014
83479
  const out = (r.stdout ?? "").trim();
83015
83480
  return r.status === 0 && out ? out.split("\n")[0] ?? null : null;
83016
83481
  }
@@ -83019,15 +83484,15 @@ function bootHookStatus() {
83019
83484
  const uid = process.getuid?.();
83020
83485
  if (uid === void 0 || uid === 0) return { status: "unknown" };
83021
83486
  const home = process.env.HOME ?? (0, import_node_os25.homedir)();
83022
- const agents = import_node_path48.default.join(home, "Library", "LaunchAgents");
83487
+ const agents = import_node_path50.default.join(home, "Library", "LaunchAgents");
83023
83488
  const candidates = [
83024
- { label: "com.mrrlin.director-bridge", plist: import_node_path48.default.join(agents, "com.mrrlin.director-bridge.plist") },
83025
- { label: "com.PM2", plist: import_node_path48.default.join(agents, `pm2.${(0, import_node_os25.userInfo)().username}.plist`) }
83489
+ { label: "com.mrrlin.director-bridge", plist: import_node_path50.default.join(agents, "com.mrrlin.director-bridge.plist") },
83490
+ { label: "com.PM2", plist: import_node_path50.default.join(agents, `pm2.${(0, import_node_os25.userInfo)().username}.plist`) }
83026
83491
  ];
83027
83492
  for (const candidate of candidates) {
83028
- const printed = (0, import_node_child_process27.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
83493
+ const printed = (0, import_node_child_process28.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
83029
83494
  if (printed.status !== 0) continue;
83030
- if (!(0, import_node_fs31.existsSync)(candidate.plist)) continue;
83495
+ if (!(0, import_node_fs32.existsSync)(candidate.plist)) continue;
83031
83496
  const out = printed.stdout ?? "";
83032
83497
  const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
83033
83498
  const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
@@ -83037,6 +83502,145 @@ function bootHookStatus() {
83037
83502
  }
83038
83503
  return { status: "not_configured" };
83039
83504
  }
83505
+ function realLaunchAgentDeps() {
83506
+ return {
83507
+ platform: process.platform,
83508
+ home: process.env.HOME ?? (0, import_node_os25.homedir)(),
83509
+ uid: process.getuid?.() ?? 0,
83510
+ pm2Path: whichBin("pm2") ?? "pm2",
83511
+ nodeDir: import_node_path50.default.dirname(process.execPath),
83512
+ mkdirp: (dir) => {
83513
+ (0, import_node_fs32.mkdirSync)(dir, { recursive: true });
83514
+ },
83515
+ writeFile: (p, c, mode) => {
83516
+ (0, import_node_fs32.mkdirSync)(import_node_path50.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".mrrlin", "director-bridge"), { recursive: true, mode: 448 });
83517
+ (0, import_node_fs32.writeFileSync)(p, c, { mode });
83518
+ (0, import_node_fs32.chmodSync)(p, mode);
83519
+ },
83520
+ removeFile: (p) => (0, import_node_fs32.rmSync)(p, { force: true }),
83521
+ launchctl: (args) => ({ status: (0, import_node_child_process28.spawnSync)("launchctl", args, { encoding: "utf8" }).status })
83522
+ };
83523
+ }
83524
+ function bridgeHealthUrl() {
83525
+ return `http://127.0.0.1:${process.env.MRRLIN_DIRECTOR_BRIDGE_PORT ?? "8791"}/health`;
83526
+ }
83527
+ async function fetchBridgeHealth() {
83528
+ const res = await fetch(bridgeHealthUrl(), { signal: AbortSignal.timeout(3e3) });
83529
+ return res.ok ? await res.json() : null;
83530
+ }
83531
+ async function storedSecretClient() {
83532
+ const secret = readAgentSecret();
83533
+ if (!secret) return null;
83534
+ const baseUrl = readConfiguredApiBaseUrl();
83535
+ const provider = createAgentTokenProvider({ secret, baseUrl });
83536
+ try {
83537
+ await provider.getToken();
83538
+ } catch {
83539
+ return null;
83540
+ }
83541
+ const baseFetch = globalThis.fetch;
83542
+ return createMrrlinClient({
83543
+ baseUrl,
83544
+ fetch: async (input, init = {}) => {
83545
+ const headers = new Headers(init.headers ?? {});
83546
+ headers.set("authorization", `Bearer ${await provider.getToken()}`);
83547
+ return baseFetch(input, { ...init, headers });
83548
+ }
83549
+ });
83550
+ }
83551
+ async function pushReadinessWithStoredSecret(readiness) {
83552
+ const client = await storedSecretClient();
83553
+ if (!client) return null;
83554
+ let pushed = readiness ?? null;
83555
+ await runProviderReadinessCycle({
83556
+ push: (r) => {
83557
+ pushed = r;
83558
+ return client.putOperatorProviderReadiness(r);
83559
+ },
83560
+ verify: readiness ? async (p) => readiness[p] : void 0
83561
+ });
83562
+ return pushed;
83563
+ }
83564
+ function realConnectDeps() {
83565
+ return {
83566
+ platform: process.platform,
83567
+ homedir: process.env.HOME ?? (0, import_node_os25.homedir)(),
83568
+ hostname: (0, import_node_os25.hostname)(),
83569
+ osRelease: (0, import_node_os25.release)(),
83570
+ cliVersion: PKG_VERSION,
83571
+ env: process.env,
83572
+ scriptPath: process.argv[1] ?? "mrrlin-mcp",
83573
+ readSecret: () => readAgentSecret(),
83574
+ persistSecret: persistAgentSecret,
83575
+ redeem: (body) => createMrrlinClient({ baseUrl: readConfiguredApiBaseUrl() }).redeemSetupCode(body),
83576
+ spawn: async (args, o) => {
83577
+ return spawnRedacted(
83578
+ process.execPath,
83579
+ [...process.execArgv, ...args],
83580
+ o,
83581
+ { stdout: (c) => process.stdout.write(c), stderr: (c) => process.stderr.write(c) }
83582
+ );
83583
+ },
83584
+ fetchHealth: fetchBridgeHealth,
83585
+ installLaunchAgent: () => installBridgeLaunchAgent(realLaunchAgentDeps()),
83586
+ pushReadinessOnce: async () => {
83587
+ const pushed = await pushReadinessWithStoredSecret();
83588
+ return pushed;
83589
+ },
83590
+ log: (m) => process.stderr.write(`${m}
83591
+ `),
83592
+ sleep: (ms) => new Promise((resolve3) => setTimeout(resolve3, ms)),
83593
+ now: () => Date.now()
83594
+ };
83595
+ }
83596
+ function realDoctorDeps() {
83597
+ const home = process.env.HOME ?? (0, import_node_os25.homedir)();
83598
+ const runnerFor = (command) => (args) => {
83599
+ const r = (0, import_node_child_process28.spawnSync)(command, args, { encoding: "utf8", timeout: 8e3 });
83600
+ return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
83601
+ };
83602
+ return {
83603
+ nodeVersion: process.versions.node,
83604
+ installedVersion: PKG_VERSION,
83605
+ homedir: home,
83606
+ ...process.env.CODEX_HOME ? { codexHome: process.env.CODEX_HOME } : {},
83607
+ stateDir: resolveStateDir(),
83608
+ npmLatest: async () => {
83609
+ const r = (0, import_node_child_process28.spawnSync)("npm", ["view", "@mrrlin-dev/mcp", "version"], { encoding: "utf8", timeout: 5e3 });
83610
+ if (r.status !== 0 || !(r.stdout ?? "").trim()) throw new Error("npm view failed");
83611
+ return (r.stdout ?? "").trim();
83612
+ },
83613
+ pm2Online: async () => {
83614
+ const r = (0, import_node_child_process28.spawnSync)("pm2", ["jlist"], { encoding: "utf8", timeout: 8e3 });
83615
+ try {
83616
+ const list = JSON.parse(r.stdout ?? "[]");
83617
+ return list.some((a) => a.name === "mrrlin-bridge" && a.pm2_env?.status === "online");
83618
+ } catch {
83619
+ return false;
83620
+ }
83621
+ },
83622
+ fetchHealth: fetchBridgeHealth,
83623
+ fetchSelectedProvider: async () => {
83624
+ const client = await storedSecretClient();
83625
+ if (!client) return null;
83626
+ return (await client.getAgentProviderConfig()).agentProvider;
83627
+ },
83628
+ verifyReadiness: (provider) => verifyProviderReadiness(provider, runnerFor(provider)),
83629
+ readFile: (p) => {
83630
+ try {
83631
+ return (0, import_node_fs32.readFileSync)(p, "utf8");
83632
+ } catch {
83633
+ return null;
83634
+ }
83635
+ },
83636
+ bootHookStatus,
83637
+ pushReadiness: async (readiness) => {
83638
+ await pushReadinessWithStoredSecret(readiness);
83639
+ },
83640
+ print: (line) => process.stdout.write(`${line}
83641
+ `)
83642
+ };
83643
+ }
83040
83644
  var HELP_TEXT = `mrrlin-mcp - Mrrlin Phase 1 MCP server CLI
83041
83645
 
83042
83646
  Usage:
@@ -83163,6 +83767,22 @@ Usage:
83163
83767
  agent-credential file (0600). Used by the
83164
83768
  Director setup guide instead of a shell redirect.
83165
83769
 
83770
+ mrrlin-mcp connect --code Turn a one-time setup code into a running,
83771
+ <code> connected helper: saves the credential, runs
83772
+ configure bridge and install-service from your
83773
+ home folder, installs the macOS LaunchAgent,
83774
+ waits for a healthy connection. Exit codes: 0 ok,
83775
+ 2 usage, 3 code expired or used, 4 unsupported OS,
83776
+ 5 setup step failed, 6 health timeout, 7 API
83777
+ unreachable. Never prints the credential or code.
83778
+
83779
+ mrrlin-mcp doctor [--json] Check this computer's helper: Node, version,
83780
+ [--logs] process, sign-in, pairing, providers, tool
83781
+ entries, restart persistence. Each failing line
83782
+ carries one fix. --json prints the checks as
83783
+ JSON; --logs prints the last 20 helper errors.
83784
+ Prints no secret.
83785
+
83166
83786
  mrrlin-mcp install-service Write a pm2 ecosystem.config.cjs to
83167
83787
  ~/.mrrlin/ecosystem.config.cjs and call
83168
83788
  'pm2 startOrReload' + 'pm2 save' to register
@@ -83251,7 +83871,7 @@ async function main() {
83251
83871
  }
83252
83872
  case "external-agents-serve": {
83253
83873
  const { command: command2, args } = externalAgentsServeArgs();
83254
- const r = (0, import_node_child_process27.spawnSync)(command2, args, { stdio: "inherit", env: process.env });
83874
+ const r = (0, import_node_child_process28.spawnSync)(command2, args, { stdio: "inherit", env: process.env });
83255
83875
  process.exitCode = r.status ?? 1;
83256
83876
  return;
83257
83877
  }
@@ -83305,8 +83925,8 @@ async function main() {
83305
83925
  }
83306
83926
  }
83307
83927
  try {
83308
- const codexHome = process.env.CODEX_HOME ?? import_node_path48.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".codex");
83309
- (0, import_node_fs31.rmSync)(import_node_path48.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
83928
+ const codexHome = process.env.CODEX_HOME ?? import_node_path50.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".codex");
83929
+ (0, import_node_fs32.rmSync)(import_node_path50.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
83310
83930
  } catch {
83311
83931
  }
83312
83932
  const claudeResult = await installClaude({ binPath, force, serveEnv });
@@ -83328,7 +83948,7 @@ async function main() {
83328
83948
  );
83329
83949
  }
83330
83950
  const realProviderRunner = (command2) => (args) => {
83331
- const r = (0, import_node_child_process27.spawnSync)(command2, args, { encoding: "utf8", timeout: 8e3 });
83951
+ const r = (0, import_node_child_process28.spawnSync)(command2, args, { encoding: "utf8", timeout: 8e3 });
83332
83952
  return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
83333
83953
  };
83334
83954
  for (const provider of ["codex", "claude", "agy"]) {
@@ -83371,18 +83991,26 @@ async function main() {
83371
83991
  if (!result.ok) process.exit(2);
83372
83992
  return;
83373
83993
  }
83994
+ case "connect": {
83995
+ process.exitCode = await runConnect(rest, realConnectDeps());
83996
+ return;
83997
+ }
83998
+ case "doctor": {
83999
+ process.exitCode = await runDoctor({ json: rest.includes("--json"), logs: rest.includes("--logs") }, realDoctorDeps());
84000
+ return;
84001
+ }
83374
84002
  case "install-service": {
83375
84003
  const ok = installService({
83376
84004
  env: process.env,
83377
84005
  cwd: process.cwd(),
83378
84006
  writeFile: (p, c) => {
83379
- (0, import_node_fs31.mkdirSync)(import_node_path48.default.dirname(p), { recursive: true, mode: 448 });
83380
- (0, import_node_fs31.writeFileSync)(p, c, { mode: 384 });
84007
+ (0, import_node_fs32.mkdirSync)(import_node_path50.default.dirname(p), { recursive: true, mode: 448 });
84008
+ (0, import_node_fs32.writeFileSync)(p, c, { mode: 384 });
83381
84009
  },
83382
- writeExclusiveFile: (p, c) => (0, import_node_fs31.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
84010
+ writeExclusiveFile: (p, c) => (0, import_node_fs32.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
83383
84011
  listDir: (p) => {
83384
84012
  try {
83385
- return (0, import_node_fs31.readdirSync)(p);
84013
+ return (0, import_node_fs32.readdirSync)(p);
83386
84014
  } catch {
83387
84015
  return null;
83388
84016
  }
@@ -83393,7 +84021,7 @@ async function main() {
83393
84021
  // value", never a failed install. See readExistingTelemetryDefaultProject.
83394
84022
  readFile: (p) => {
83395
84023
  try {
83396
- return (0, import_node_fs31.readFileSync)(p, "utf8");
84024
+ return (0, import_node_fs32.readFileSync)(p, "utf8");
83397
84025
  } catch {
83398
84026
  return null;
83399
84027
  }
@@ -83414,17 +84042,18 @@ async function main() {
83414
84042
  runPm2: (a) => ({ code: pm2Runner(a).code }),
83415
84043
  removeFile: (p) => {
83416
84044
  try {
83417
- (0, import_node_fs31.rmSync)(p, { force: true });
84045
+ (0, import_node_fs32.rmSync)(p, { force: true });
83418
84046
  } catch {
83419
84047
  }
83420
84048
  },
83421
84049
  purgeSecret: purge,
83422
84050
  secretPath: agentCredentialPath(),
83423
84051
  tokenPath: operatorTokenPath(),
83424
- ecoPath: import_node_path48.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
84052
+ ecoPath: import_node_path50.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
83425
84053
  log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
83426
84054
  `)
83427
84055
  });
84056
+ removeBridgeLaunchAgent(realLaunchAgentDeps());
83428
84057
  return;
83429
84058
  }
83430
84059
  case "uninstall": {
@@ -83435,14 +84064,14 @@ async function main() {
83435
84064
  runPm2: (a) => ({ code: pm2Runner(a).code }),
83436
84065
  removeFile: (p) => {
83437
84066
  try {
83438
- (0, import_node_fs31.rmSync)(p, { force: true });
84067
+ (0, import_node_fs32.rmSync)(p, { force: true });
83439
84068
  } catch {
83440
84069
  }
83441
84070
  },
83442
84071
  purgeSecret: true,
83443
84072
  secretPath: agentCredentialPath(),
83444
84073
  tokenPath: operatorTokenPath(),
83445
- ecoPath: import_node_path48.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
84074
+ ecoPath: import_node_path50.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
83446
84075
  log
83447
84076
  });
83448
84077
  let codexOk = true;
@@ -83462,7 +84091,7 @@ async function main() {
83462
84091
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
83463
84092
  }
83464
84093
  try {
83465
- (0, import_node_fs31.rmSync)(import_node_path48.default.join(home, ".mrrlin"), { recursive: true, force: true });
84094
+ (0, import_node_fs32.rmSync)(import_node_path50.default.join(home, ".mrrlin"), { recursive: true, force: true });
83466
84095
  } catch {
83467
84096
  }
83468
84097
  log("removed ~/.mrrlin");
@@ -83503,7 +84132,7 @@ ${HELP_TEXT}`);
83503
84132
  }
83504
84133
  }
83505
84134
  function resolveSelfBinPath() {
83506
- return import_node_path47.default.resolve(process.argv[1] ?? process.execPath);
84135
+ return import_node_path49.default.resolve(process.argv[1] ?? process.execPath);
83507
84136
  }
83508
84137
  main().catch((error51) => {
83509
84138
  process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}