@mrrlin-dev/mcp 0.3.23 → 0.3.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.cjs +304 -245
  2. package/package.json +6 -6
package/dist/bin.cjs CHANGED
@@ -7729,14 +7729,14 @@ var require_polyfills = __commonJS({
7729
7729
  fs7.fstatSync = statFixSync(fs7.fstatSync);
7730
7730
  fs7.lstatSync = statFixSync(fs7.lstatSync);
7731
7731
  if (fs7.chmod && !fs7.lchmod) {
7732
- fs7.lchmod = function(path15, mode, cb) {
7732
+ fs7.lchmod = function(path16, mode, cb) {
7733
7733
  if (cb) process.nextTick(cb);
7734
7734
  };
7735
7735
  fs7.lchmodSync = function() {
7736
7736
  };
7737
7737
  }
7738
7738
  if (fs7.chown && !fs7.lchown) {
7739
- fs7.lchown = function(path15, uid, gid, cb) {
7739
+ fs7.lchown = function(path16, uid, gid, cb) {
7740
7740
  if (cb) process.nextTick(cb);
7741
7741
  };
7742
7742
  fs7.lchownSync = function() {
@@ -7803,9 +7803,9 @@ var require_polyfills = __commonJS({
7803
7803
  };
7804
7804
  }(fs7.readSync);
7805
7805
  function patchLchmod(fs8) {
7806
- fs8.lchmod = function(path15, mode, callback) {
7806
+ fs8.lchmod = function(path16, mode, callback) {
7807
7807
  fs8.open(
7808
- path15,
7808
+ path16,
7809
7809
  constants.O_WRONLY | constants.O_SYMLINK,
7810
7810
  mode,
7811
7811
  function(err, fd) {
@@ -7821,8 +7821,8 @@ var require_polyfills = __commonJS({
7821
7821
  }
7822
7822
  );
7823
7823
  };
7824
- fs8.lchmodSync = function(path15, mode) {
7825
- var fd = fs8.openSync(path15, constants.O_WRONLY | constants.O_SYMLINK, mode);
7824
+ fs8.lchmodSync = function(path16, mode) {
7825
+ var fd = fs8.openSync(path16, constants.O_WRONLY | constants.O_SYMLINK, mode);
7826
7826
  var threw = true;
7827
7827
  var ret;
7828
7828
  try {
@@ -7843,8 +7843,8 @@ var require_polyfills = __commonJS({
7843
7843
  }
7844
7844
  function patchLutimes(fs8) {
7845
7845
  if (constants.hasOwnProperty("O_SYMLINK") && fs8.futimes) {
7846
- fs8.lutimes = function(path15, at, mt, cb) {
7847
- fs8.open(path15, constants.O_SYMLINK, function(er, fd) {
7846
+ fs8.lutimes = function(path16, at, mt, cb) {
7847
+ fs8.open(path16, constants.O_SYMLINK, function(er, fd) {
7848
7848
  if (er) {
7849
7849
  if (cb) cb(er);
7850
7850
  return;
@@ -7856,8 +7856,8 @@ var require_polyfills = __commonJS({
7856
7856
  });
7857
7857
  });
7858
7858
  };
7859
- fs8.lutimesSync = function(path15, at, mt) {
7860
- var fd = fs8.openSync(path15, constants.O_SYMLINK);
7859
+ fs8.lutimesSync = function(path16, at, mt) {
7860
+ var fd = fs8.openSync(path16, constants.O_SYMLINK);
7861
7861
  var ret;
7862
7862
  var threw = true;
7863
7863
  try {
@@ -7975,11 +7975,11 @@ var require_legacy_streams = __commonJS({
7975
7975
  ReadStream,
7976
7976
  WriteStream
7977
7977
  };
7978
- function ReadStream(path15, options) {
7979
- if (!(this instanceof ReadStream)) return new ReadStream(path15, options);
7978
+ function ReadStream(path16, options) {
7979
+ if (!(this instanceof ReadStream)) return new ReadStream(path16, options);
7980
7980
  Stream.call(this);
7981
7981
  var self = this;
7982
- this.path = path15;
7982
+ this.path = path16;
7983
7983
  this.fd = null;
7984
7984
  this.readable = true;
7985
7985
  this.paused = false;
@@ -8024,10 +8024,10 @@ var require_legacy_streams = __commonJS({
8024
8024
  self._read();
8025
8025
  });
8026
8026
  }
8027
- function WriteStream(path15, options) {
8028
- if (!(this instanceof WriteStream)) return new WriteStream(path15, options);
8027
+ function WriteStream(path16, options) {
8028
+ if (!(this instanceof WriteStream)) return new WriteStream(path16, options);
8029
8029
  Stream.call(this);
8030
- this.path = path15;
8030
+ this.path = path16;
8031
8031
  this.fd = null;
8032
8032
  this.writable = true;
8033
8033
  this.flags = "w";
@@ -8170,14 +8170,14 @@ var require_graceful_fs = __commonJS({
8170
8170
  fs8.createWriteStream = createWriteStream;
8171
8171
  var fs$readFile = fs8.readFile;
8172
8172
  fs8.readFile = readFile2;
8173
- function readFile2(path15, options, cb) {
8173
+ function readFile2(path16, options, cb) {
8174
8174
  if (typeof options === "function")
8175
8175
  cb = options, options = null;
8176
- return go$readFile(path15, options, cb);
8177
- function go$readFile(path16, options2, cb2, startTime) {
8178
- return fs$readFile(path16, options2, function(err) {
8176
+ return go$readFile(path16, options, cb);
8177
+ function go$readFile(path17, options2, cb2, startTime) {
8178
+ return fs$readFile(path17, options2, function(err) {
8179
8179
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8180
- enqueue([go$readFile, [path16, options2, cb2], err, startTime || Date.now(), Date.now()]);
8180
+ enqueue([go$readFile, [path17, options2, cb2], err, startTime || Date.now(), Date.now()]);
8181
8181
  else {
8182
8182
  if (typeof cb2 === "function")
8183
8183
  cb2.apply(this, arguments);
@@ -8187,14 +8187,14 @@ var require_graceful_fs = __commonJS({
8187
8187
  }
8188
8188
  var fs$writeFile = fs8.writeFile;
8189
8189
  fs8.writeFile = writeFile;
8190
- function writeFile(path15, data, options, cb) {
8190
+ function writeFile(path16, data, options, cb) {
8191
8191
  if (typeof options === "function")
8192
8192
  cb = options, options = null;
8193
- return go$writeFile(path15, data, options, cb);
8194
- function go$writeFile(path16, data2, options2, cb2, startTime) {
8195
- return fs$writeFile(path16, data2, options2, function(err) {
8193
+ return go$writeFile(path16, data, options, cb);
8194
+ function go$writeFile(path17, data2, options2, cb2, startTime) {
8195
+ return fs$writeFile(path17, data2, options2, function(err) {
8196
8196
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8197
- enqueue([go$writeFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8197
+ enqueue([go$writeFile, [path17, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8198
8198
  else {
8199
8199
  if (typeof cb2 === "function")
8200
8200
  cb2.apply(this, arguments);
@@ -8205,14 +8205,14 @@ var require_graceful_fs = __commonJS({
8205
8205
  var fs$appendFile = fs8.appendFile;
8206
8206
  if (fs$appendFile)
8207
8207
  fs8.appendFile = appendFile;
8208
- function appendFile(path15, data, options, cb) {
8208
+ function appendFile(path16, data, options, cb) {
8209
8209
  if (typeof options === "function")
8210
8210
  cb = options, options = null;
8211
- return go$appendFile(path15, data, options, cb);
8212
- function go$appendFile(path16, data2, options2, cb2, startTime) {
8213
- return fs$appendFile(path16, data2, options2, function(err) {
8211
+ return go$appendFile(path16, data, options, cb);
8212
+ function go$appendFile(path17, data2, options2, cb2, startTime) {
8213
+ return fs$appendFile(path17, data2, options2, function(err) {
8214
8214
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8215
- enqueue([go$appendFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8215
+ enqueue([go$appendFile, [path17, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8216
8216
  else {
8217
8217
  if (typeof cb2 === "function")
8218
8218
  cb2.apply(this, arguments);
@@ -8243,31 +8243,31 @@ var require_graceful_fs = __commonJS({
8243
8243
  var fs$readdir = fs8.readdir;
8244
8244
  fs8.readdir = readdir2;
8245
8245
  var noReaddirOptionVersions = /^v[0-5]\./;
8246
- function readdir2(path15, options, cb) {
8246
+ function readdir2(path16, options, cb) {
8247
8247
  if (typeof options === "function")
8248
8248
  cb = options, options = null;
8249
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path16, options2, cb2, startTime) {
8250
- return fs$readdir(path16, fs$readdirCallback(
8251
- path16,
8249
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path17, options2, cb2, startTime) {
8250
+ return fs$readdir(path17, fs$readdirCallback(
8251
+ path17,
8252
8252
  options2,
8253
8253
  cb2,
8254
8254
  startTime
8255
8255
  ));
8256
- } : function go$readdir2(path16, options2, cb2, startTime) {
8257
- return fs$readdir(path16, options2, fs$readdirCallback(
8258
- path16,
8256
+ } : function go$readdir2(path17, options2, cb2, startTime) {
8257
+ return fs$readdir(path17, options2, fs$readdirCallback(
8258
+ path17,
8259
8259
  options2,
8260
8260
  cb2,
8261
8261
  startTime
8262
8262
  ));
8263
8263
  };
8264
- return go$readdir(path15, options, cb);
8265
- function fs$readdirCallback(path16, options2, cb2, startTime) {
8264
+ return go$readdir(path16, options, cb);
8265
+ function fs$readdirCallback(path17, options2, cb2, startTime) {
8266
8266
  return function(err, files) {
8267
8267
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8268
8268
  enqueue([
8269
8269
  go$readdir,
8270
- [path16, options2, cb2],
8270
+ [path17, options2, cb2],
8271
8271
  err,
8272
8272
  startTime || Date.now(),
8273
8273
  Date.now()
@@ -8338,7 +8338,7 @@ var require_graceful_fs = __commonJS({
8338
8338
  enumerable: true,
8339
8339
  configurable: true
8340
8340
  });
8341
- function ReadStream(path15, options) {
8341
+ function ReadStream(path16, options) {
8342
8342
  if (this instanceof ReadStream)
8343
8343
  return fs$ReadStream.apply(this, arguments), this;
8344
8344
  else
@@ -8358,7 +8358,7 @@ var require_graceful_fs = __commonJS({
8358
8358
  }
8359
8359
  });
8360
8360
  }
8361
- function WriteStream(path15, options) {
8361
+ function WriteStream(path16, options) {
8362
8362
  if (this instanceof WriteStream)
8363
8363
  return fs$WriteStream.apply(this, arguments), this;
8364
8364
  else
@@ -8376,22 +8376,22 @@ var require_graceful_fs = __commonJS({
8376
8376
  }
8377
8377
  });
8378
8378
  }
8379
- function createReadStream(path15, options) {
8380
- return new fs8.ReadStream(path15, options);
8379
+ function createReadStream(path16, options) {
8380
+ return new fs8.ReadStream(path16, options);
8381
8381
  }
8382
- function createWriteStream(path15, options) {
8383
- return new fs8.WriteStream(path15, options);
8382
+ function createWriteStream(path16, options) {
8383
+ return new fs8.WriteStream(path16, options);
8384
8384
  }
8385
8385
  var fs$open = fs8.open;
8386
8386
  fs8.open = open;
8387
- function open(path15, flags, mode, cb) {
8387
+ function open(path16, flags, mode, cb) {
8388
8388
  if (typeof mode === "function")
8389
8389
  cb = mode, mode = null;
8390
- return go$open(path15, flags, mode, cb);
8391
- function go$open(path16, flags2, mode2, cb2, startTime) {
8392
- return fs$open(path16, flags2, mode2, function(err, fd) {
8390
+ return go$open(path16, flags, mode, cb);
8391
+ function go$open(path17, flags2, mode2, cb2, startTime) {
8392
+ return fs$open(path17, flags2, mode2, function(err, fd) {
8393
8393
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8394
- enqueue([go$open, [path16, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
8394
+ enqueue([go$open, [path17, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
8395
8395
  else {
8396
8396
  if (typeof cb2 === "function")
8397
8397
  cb2.apply(this, arguments);
@@ -8920,7 +8920,7 @@ var require_mtime_precision = __commonJS({
8920
8920
  var require_lockfile = __commonJS({
8921
8921
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
8922
8922
  "use strict";
8923
- var path15 = require("path");
8923
+ var path16 = require("path");
8924
8924
  var fs7 = require_graceful_fs();
8925
8925
  var retry = require_retry2();
8926
8926
  var onExit = require_signal_exit();
@@ -8931,7 +8931,7 @@ var require_lockfile = __commonJS({
8931
8931
  }
8932
8932
  function resolveCanonicalPath(file2, options, callback) {
8933
8933
  if (!options.realpath) {
8934
- return callback(null, path15.resolve(file2));
8934
+ return callback(null, path16.resolve(file2));
8935
8935
  }
8936
8936
  options.fs.realpath(file2, callback);
8937
8937
  }
@@ -10795,10 +10795,10 @@ var require_segments = __commonJS({
10795
10795
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
10796
10796
  const nodes = buildNodes(segs);
10797
10797
  const graph = buildGraph(nodes, version2);
10798
- const path15 = dijkstra.find_path(graph.map, "start", "end");
10798
+ const path16 = dijkstra.find_path(graph.map, "start", "end");
10799
10799
  const optimizedSegs = [];
10800
- for (let i = 1; i < path15.length - 1; i++) {
10801
- optimizedSegs.push(graph.table[path15[i]].node);
10800
+ for (let i = 1; i < path16.length - 1; i++) {
10801
+ optimizedSegs.push(graph.table[path16[i]].node);
10802
10802
  }
10803
10803
  return exports2.fromArray(mergeSegments(optimizedSegs));
10804
10804
  };
@@ -13275,7 +13275,7 @@ var require_png2 = __commonJS({
13275
13275
  });
13276
13276
  png.pack();
13277
13277
  };
13278
- exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
13278
+ exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
13279
13279
  if (typeof cb === "undefined") {
13280
13280
  cb = options;
13281
13281
  options = void 0;
@@ -13286,7 +13286,7 @@ var require_png2 = __commonJS({
13286
13286
  called = true;
13287
13287
  cb.apply(null, args);
13288
13288
  };
13289
- const stream = fs7.createWriteStream(path15);
13289
+ const stream = fs7.createWriteStream(path16);
13290
13290
  stream.on("error", done);
13291
13291
  stream.on("close", done);
13292
13292
  exports2.renderToFileStream(stream, qrData, options);
@@ -13348,14 +13348,14 @@ var require_utf8 = __commonJS({
13348
13348
  }
13349
13349
  return output3;
13350
13350
  };
13351
- exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
13351
+ exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
13352
13352
  if (typeof cb === "undefined") {
13353
13353
  cb = options;
13354
13354
  options = void 0;
13355
13355
  }
13356
13356
  const fs7 = require("fs");
13357
13357
  const utf8 = exports2.render(qrData, options);
13358
- fs7.writeFile(path15, utf8, cb);
13358
+ fs7.writeFile(path16, utf8, cb);
13359
13359
  };
13360
13360
  }
13361
13361
  });
@@ -13476,7 +13476,7 @@ var require_svg_tag = __commonJS({
13476
13476
  return str;
13477
13477
  }
13478
13478
  function qrToPath(data, size, margin) {
13479
- let path15 = "";
13479
+ let path16 = "";
13480
13480
  let moveBy = 0;
13481
13481
  let newRow = false;
13482
13482
  let lineLength = 0;
@@ -13487,19 +13487,19 @@ var require_svg_tag = __commonJS({
13487
13487
  if (data[i]) {
13488
13488
  lineLength++;
13489
13489
  if (!(i > 0 && col > 0 && data[i - 1])) {
13490
- path15 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
13490
+ path16 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
13491
13491
  moveBy = 0;
13492
13492
  newRow = false;
13493
13493
  }
13494
13494
  if (!(col + 1 < size && data[i + 1])) {
13495
- path15 += svgCmd("h", lineLength);
13495
+ path16 += svgCmd("h", lineLength);
13496
13496
  lineLength = 0;
13497
13497
  }
13498
13498
  } else {
13499
13499
  moveBy++;
13500
13500
  }
13501
13501
  }
13502
- return path15;
13502
+ return path16;
13503
13503
  }
13504
13504
  exports2.render = function render(qrData, options, cb) {
13505
13505
  const opts = Utils.getOptions(options);
@@ -13507,10 +13507,10 @@ var require_svg_tag = __commonJS({
13507
13507
  const data = qrData.modules.data;
13508
13508
  const qrcodesize = size + opts.margin * 2;
13509
13509
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
13510
- const path15 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
13510
+ const path16 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
13511
13511
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
13512
13512
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
13513
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path15 + "</svg>\n";
13513
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path16 + "</svg>\n";
13514
13514
  if (typeof cb === "function") {
13515
13515
  cb(null, svgTag);
13516
13516
  }
@@ -13524,7 +13524,7 @@ var require_svg = __commonJS({
13524
13524
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
13525
13525
  var svgTagRenderer = require_svg_tag();
13526
13526
  exports2.render = svgTagRenderer.render;
13527
- exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
13527
+ exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
13528
13528
  if (typeof cb === "undefined") {
13529
13529
  cb = options;
13530
13530
  options = void 0;
@@ -13532,7 +13532,7 @@ var require_svg = __commonJS({
13532
13532
  const fs7 = require("fs");
13533
13533
  const svgTag = exports2.render(qrData, options);
13534
13534
  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;
13535
- fs7.writeFile(path15, xmlStr, cb);
13535
+ fs7.writeFile(path16, xmlStr, cb);
13536
13536
  };
13537
13537
  }
13538
13538
  });
@@ -13690,8 +13690,8 @@ var require_server = __commonJS({
13690
13690
  cb
13691
13691
  };
13692
13692
  }
13693
- function getTypeFromFilename(path15) {
13694
- return path15.slice((path15.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
13693
+ function getTypeFromFilename(path16) {
13694
+ return path16.slice((path16.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
13695
13695
  }
13696
13696
  function getRendererFromType(type) {
13697
13697
  switch (type) {
@@ -13755,17 +13755,17 @@ var require_server = __commonJS({
13755
13755
  const renderer = getRendererFromType(params.opts.type);
13756
13756
  return render(renderer.renderToBuffer, text, params);
13757
13757
  };
13758
- exports2.toFile = function toFile(path15, text, opts, cb) {
13759
- if (typeof path15 !== "string" || !(typeof text === "string" || typeof text === "object")) {
13758
+ exports2.toFile = function toFile(path16, text, opts, cb) {
13759
+ if (typeof path16 !== "string" || !(typeof text === "string" || typeof text === "object")) {
13760
13760
  throw new Error("Invalid argument");
13761
13761
  }
13762
13762
  if (arguments.length < 3 && !canPromise()) {
13763
13763
  throw new Error("Too few arguments provided");
13764
13764
  }
13765
13765
  const params = checkParams(text, opts, cb);
13766
- const type = params.opts.type || getTypeFromFilename(path15);
13766
+ const type = params.opts.type || getTypeFromFilename(path16);
13767
13767
  const renderer = getRendererFromType(type);
13768
- const renderToFile = renderer.renderToFile.bind(null, path15);
13768
+ const renderToFile = renderer.renderToFile.bind(null, path16);
13769
13769
  return render(renderToFile, text, params);
13770
13770
  };
13771
13771
  exports2.toFileStream = function toFileStream(stream, text, opts) {
@@ -16983,8 +16983,8 @@ var require_utils3 = __commonJS({
16983
16983
  }
16984
16984
  return ind;
16985
16985
  }
16986
- function removeDotSegments(path15) {
16987
- let input = path15;
16986
+ function removeDotSegments(path16) {
16987
+ let input = path16;
16988
16988
  const output3 = [];
16989
16989
  let nextSlash = -1;
16990
16990
  let len = 0;
@@ -17236,8 +17236,8 @@ var require_schemes = __commonJS({
17236
17236
  wsComponent.secure = void 0;
17237
17237
  }
17238
17238
  if (wsComponent.resourceName) {
17239
- const [path15, query] = wsComponent.resourceName.split("?");
17240
- wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
17239
+ const [path16, query] = wsComponent.resourceName.split("?");
17240
+ wsComponent.path = path16 && path16 !== "/" ? path16 : void 0;
17241
17241
  wsComponent.query = query;
17242
17242
  wsComponent.resourceName = void 0;
17243
17243
  }
@@ -20644,11 +20644,11 @@ var require_dist = __commonJS({
20644
20644
  });
20645
20645
 
20646
20646
  // src/bin.ts
20647
- var import_node_path19 = __toESM(require("node:path"), 1);
20647
+ var import_node_path20 = __toESM(require("node:path"), 1);
20648
20648
  var import_node_child_process9 = require("node:child_process");
20649
20649
  var import_node_fs14 = require("node:fs");
20650
20650
  var import_node_os11 = require("node:os");
20651
- var import_node_path20 = __toESM(require("node:path"), 1);
20651
+ var import_node_path21 = __toESM(require("node:path"), 1);
20652
20652
 
20653
20653
  // src/install-codex.ts
20654
20654
  var import_promises = __toESM(require("node:fs/promises"), 1);
@@ -20980,7 +20980,7 @@ ${block}`;
20980
20980
  var import_node_fs11 = __toESM(require("node:fs"), 1);
20981
20981
  var import_node_http = __toESM(require("node:http"), 1);
20982
20982
  var import_node_os7 = __toESM(require("node:os"), 1);
20983
- var import_node_path12 = __toESM(require("node:path"), 1);
20983
+ var import_node_path13 = __toESM(require("node:path"), 1);
20984
20984
  var import_node_child_process7 = require("node:child_process");
20985
20985
  var import_node_crypto7 = __toESM(require("node:crypto"), 1);
20986
20986
 
@@ -22537,10 +22537,10 @@ function mergeDefs(...defs) {
22537
22537
  function cloneDef(schema) {
22538
22538
  return mergeDefs(schema._zod.def);
22539
22539
  }
22540
- function getElementAtPath(obj, path15) {
22541
- if (!path15)
22540
+ function getElementAtPath(obj, path16) {
22541
+ if (!path16)
22542
22542
  return obj;
22543
- return path15.reduce((acc, key) => acc?.[key], obj);
22543
+ return path16.reduce((acc, key) => acc?.[key], obj);
22544
22544
  }
22545
22545
  function promiseAllObject(promisesObj) {
22546
22546
  const keys = Object.keys(promisesObj);
@@ -22949,11 +22949,11 @@ function explicitlyAborted(x, startIndex = 0) {
22949
22949
  }
22950
22950
  return false;
22951
22951
  }
22952
- function prefixIssues(path15, issues) {
22952
+ function prefixIssues(path16, issues) {
22953
22953
  return issues.map((iss) => {
22954
22954
  var _a3;
22955
22955
  (_a3 = iss).path ?? (_a3.path = []);
22956
- iss.path.unshift(path15);
22956
+ iss.path.unshift(path16);
22957
22957
  return iss;
22958
22958
  });
22959
22959
  }
@@ -23100,16 +23100,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
23100
23100
  }
23101
23101
  function formatError(error51, mapper = (issue2) => issue2.message) {
23102
23102
  const fieldErrors = { _errors: [] };
23103
- const processError = (error52, path15 = []) => {
23103
+ const processError = (error52, path16 = []) => {
23104
23104
  for (const issue2 of error52.issues) {
23105
23105
  if (issue2.code === "invalid_union" && issue2.errors.length) {
23106
- issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
23106
+ issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
23107
23107
  } else if (issue2.code === "invalid_key") {
23108
- processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
23108
+ processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
23109
23109
  } else if (issue2.code === "invalid_element") {
23110
- processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
23110
+ processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
23111
23111
  } else {
23112
- const fullpath = [...path15, ...issue2.path];
23112
+ const fullpath = [...path16, ...issue2.path];
23113
23113
  if (fullpath.length === 0) {
23114
23114
  fieldErrors._errors.push(mapper(issue2));
23115
23115
  } else {
@@ -23136,17 +23136,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
23136
23136
  }
23137
23137
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
23138
23138
  const result = { errors: [] };
23139
- const processError = (error52, path15 = []) => {
23139
+ const processError = (error52, path16 = []) => {
23140
23140
  var _a3, _b;
23141
23141
  for (const issue2 of error52.issues) {
23142
23142
  if (issue2.code === "invalid_union" && issue2.errors.length) {
23143
- issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
23143
+ issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
23144
23144
  } else if (issue2.code === "invalid_key") {
23145
- processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
23145
+ processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
23146
23146
  } else if (issue2.code === "invalid_element") {
23147
- processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
23147
+ processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
23148
23148
  } else {
23149
- const fullpath = [...path15, ...issue2.path];
23149
+ const fullpath = [...path16, ...issue2.path];
23150
23150
  if (fullpath.length === 0) {
23151
23151
  result.errors.push(mapper(issue2));
23152
23152
  continue;
@@ -23178,8 +23178,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
23178
23178
  }
23179
23179
  function toDotPath(_path) {
23180
23180
  const segs = [];
23181
- const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23182
- for (const seg of path15) {
23181
+ const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23182
+ for (const seg of path16) {
23183
23183
  if (typeof seg === "number")
23184
23184
  segs.push(`[${seg}]`);
23185
23185
  else if (typeof seg === "symbol")
@@ -35871,13 +35871,13 @@ function resolveRef(ref, ctx) {
35871
35871
  if (!ref.startsWith("#")) {
35872
35872
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
35873
35873
  }
35874
- const path15 = ref.slice(1).split("/").filter(Boolean);
35875
- if (path15.length === 0) {
35874
+ const path16 = ref.slice(1).split("/").filter(Boolean);
35875
+ if (path16.length === 0) {
35876
35876
  return ctx.rootSchema;
35877
35877
  }
35878
35878
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
35879
- if (path15[0] === defsKey) {
35880
- const key = path15[1];
35879
+ if (path16[0] === defsKey) {
35880
+ const key = path16[1];
35881
35881
  if (!key || !ctx.defs[key]) {
35882
35882
  throw new Error(`Reference not found: ${ref}`);
35883
35883
  }
@@ -37718,18 +37718,18 @@ function createMrrlinClient(config2) {
37718
37718
  const customFetch = config2.fetch ?? globalThis.fetch;
37719
37719
  const baseUrl = config2.baseUrl.replace(/\/$/, "");
37720
37720
  const token = config2.token;
37721
- async function request(path15, init) {
37721
+ async function request(path16, init) {
37722
37722
  const method = init?.method ?? "GET";
37723
37723
  const headers = new Headers(init?.headers ?? {});
37724
37724
  if (token && !headers.has("authorization")) {
37725
37725
  headers.set("authorization", `Bearer ${token}`);
37726
37726
  }
37727
- const response = await customFetch(`${baseUrl}${path15}`, { ...init, headers });
37727
+ const response = await customFetch(`${baseUrl}${path16}`, { ...init, headers });
37728
37728
  if (!response.ok) {
37729
37729
  const body = await response.text();
37730
37730
  let code = `HTTP_${response.status}`;
37731
37731
  let violations = null;
37732
- let message = `Mrrlin API ${method} ${path15} failed: ${response.status}`;
37732
+ let message = `Mrrlin API ${method} ${path16} failed: ${response.status}`;
37733
37733
  try {
37734
37734
  const parsed = JSON.parse(body);
37735
37735
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -37749,7 +37749,7 @@ function createMrrlinClient(config2) {
37749
37749
  throw new MrrlinApiError({
37750
37750
  code,
37751
37751
  method,
37752
- path: path15,
37752
+ path: path16,
37753
37753
  responseBody: body,
37754
37754
  status: response.status,
37755
37755
  violations,
@@ -38004,7 +38004,7 @@ function createMrrlinClient(config2) {
38004
38004
  return taskEventListResponseSchema.parse(body).data;
38005
38005
  },
38006
38006
  async listTasks(projectSlug, filters = {}) {
38007
- const path15 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
38007
+ const path16 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
38008
38008
  assignee: filters.assignee,
38009
38009
  autonomyLevel: filters.autonomyLevel,
38010
38010
  blockedBy: filters.blockedBy,
@@ -38016,7 +38016,7 @@ function createMrrlinClient(config2) {
38016
38016
  subcategory: filters.subcategory,
38017
38017
  type: filters.type
38018
38018
  });
38019
- const body = await request(path15);
38019
+ const body = await request(path16);
38020
38020
  return taskListResponseSchema.parse(body).data;
38021
38021
  },
38022
38022
  async listTaxonomy(projectSlug) {
@@ -38024,22 +38024,22 @@ function createMrrlinClient(config2) {
38024
38024
  return taxonomyListResponseSchema.parse(body).data;
38025
38025
  },
38026
38026
  async listWikiPages(projectSlug, filters = {}) {
38027
- const path15 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
38027
+ const path16 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
38028
38028
  folder: filters.folder,
38029
38029
  q: filters.q,
38030
38030
  taskId: filters.taskId
38031
38031
  });
38032
- const body = await request(path15);
38032
+ const body = await request(path16);
38033
38033
  return wikiPageListResponseSchema.parse(body).data;
38034
38034
  },
38035
38035
  async searchWikiPages(projectSlug, query) {
38036
- const path15 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
38036
+ const path16 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
38037
38037
  folder: query.folder,
38038
38038
  limit: query.limit === void 0 ? void 0 : String(query.limit),
38039
38039
  pathPrefix: query.pathPrefix,
38040
38040
  q: query.q
38041
38041
  });
38042
- const body = await request(path15);
38042
+ const body = await request(path16);
38043
38043
  return wikiPageSearchResponseSchema.parse(body).data;
38044
38044
  },
38045
38045
  async updatePlan(projectSlug, planId, patch) {
@@ -38723,7 +38723,8 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
38723
38723
  if (drainOnQuiet && driftConfirmed && !shutdownCalled) {
38724
38724
  const active = deps.getActiveTurnCount();
38725
38725
  const idle = deps.getIdleMs();
38726
- if (active === 0 && idle >= idleThresholdMs) {
38726
+ const resumable = deps.getResumableTurnCount ? deps.getResumableTurnCount() : 0;
38727
+ if (active === 0 && resumable === 0 && idle >= idleThresholdMs) {
38727
38728
  shutdownCalled = true;
38728
38729
  log("info", "bridge.self_update.self_exit_for_reload", {});
38729
38730
  try {
@@ -38733,6 +38734,8 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
38733
38734
  err: String(e?.message ?? e)
38734
38735
  });
38735
38736
  }
38737
+ } else if (active === 0 && idle >= idleThresholdMs && resumable > 0) {
38738
+ log("info", "bridge.self_update.reload_deferred_resumable_turn", { resumable });
38736
38739
  }
38737
38740
  }
38738
38741
  } catch (e) {
@@ -38778,7 +38781,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
38778
38781
  }
38779
38782
 
38780
38783
  // src/_generated/version.ts
38781
- var PKG_VERSION = "0.3.23";
38784
+ var PKG_VERSION = "0.3.25";
38782
38785
 
38783
38786
  // src/api-base-url.ts
38784
38787
  var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
@@ -38844,7 +38847,6 @@ async function resolveApiBaseUrlDynamic(opts = {}) {
38844
38847
 
38845
38848
  // src/scheduler-tick.ts
38846
38849
  var SCHEDULER_TICK_MIN_MS = 6e4;
38847
- var SCHEDULER_TICK_MAX_MS = 9e5;
38848
38850
  var SCHEDULER_TICK_FALLBACK_MS = 3e5;
38849
38851
  function schedulerTickDisabled(env = process.env) {
38850
38852
  return (env.MRRLIN_BRIDGE_SCHEDULER_TICK_DISABLE ?? "").trim() === "1";
@@ -38859,7 +38861,7 @@ function computeNextTickDelayMs(nextWakeAt, nowMs, opts = {}) {
38859
38861
  if (typeof nextWakeAt === "string" && nextWakeAt.trim().length > 0) {
38860
38862
  const wakeMs = Date.parse(nextWakeAt);
38861
38863
  if (!Number.isNaN(wakeMs)) {
38862
- base = Math.min(Math.max(wakeMs - nowMs, SCHEDULER_TICK_MIN_MS), SCHEDULER_TICK_MAX_MS);
38864
+ base = Math.max(wakeMs - nowMs, SCHEDULER_TICK_MIN_MS);
38863
38865
  }
38864
38866
  }
38865
38867
  const jitter = base * 0.25 * (random() * 2 - 1);
@@ -38868,15 +38870,25 @@ function computeNextTickDelayMs(nextWakeAt, nowMs, opts = {}) {
38868
38870
  function count(value) {
38869
38871
  return Array.isArray(value) ? value.length : 0;
38870
38872
  }
38873
+ function dispatchTickWork(deps, results) {
38874
+ if (!deps.dispatchEnqueued) return;
38875
+ for (const result of results) {
38876
+ if (typeof result.projectSlug !== "string") continue;
38877
+ for (const run3 of result.createdRuns ?? []) {
38878
+ if (typeof run3.runId === "string") deps.dispatchEnqueued(result.projectSlug, { kind: "execution_run", runId: run3.runId });
38879
+ }
38880
+ for (const job of [...result.enqueuedSpecDrafts ?? [], ...result.enqueuedConsensus ?? []]) {
38881
+ if (typeof job.jobId === "string") deps.dispatchEnqueued(result.projectSlug, { kind: "async_job", jobId: job.jobId });
38882
+ }
38883
+ }
38884
+ }
38871
38885
  async function fireSchedulerTick(deps) {
38872
38886
  const fetchImpl = deps.fetchImpl ?? fetch;
38873
38887
  try {
38874
- const response = await fetchImpl(`${deps.apiBaseUrl}/cron/scheduler/run`, {
38875
- headers: { authorization: `Bearer ${deps.token}` }
38876
- });
38888
+ const response = await fetchImpl(`${deps.apiBaseUrl}/internal/scheduler/run`, { method: "POST" });
38877
38889
  if (!response.ok) {
38878
38890
  process.stderr.write(
38879
- `[mrrlin-mcp director-bridge] scheduler tick failed: HTTP ${response.status} from /cron/scheduler/run
38891
+ `[mrrlin-mcp director-bridge] scheduler tick failed: HTTP ${response.status} from /internal/scheduler/run
38880
38892
  `
38881
38893
  );
38882
38894
  return { nextWakeAt: null };
@@ -38914,6 +38926,7 @@ async function fireSchedulerTick(deps) {
38914
38926
  nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null
38915
38927
  }
38916
38928
  });
38929
+ dispatchTickWork(deps, results);
38917
38930
  return { nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null };
38918
38931
  } catch (error51) {
38919
38932
  process.stderr.write(
@@ -38949,6 +38962,7 @@ function startSchedulerTickLoop(deps) {
38949
38962
  // src/execution-consumer.ts
38950
38963
  var import_node_child_process6 = require("node:child_process");
38951
38964
  var import_node_crypto4 = __toESM(require("node:crypto"), 1);
38965
+ var import_node_path6 = __toESM(require("node:path"), 1);
38952
38966
  var import_node_util = require("node:util");
38953
38967
 
38954
38968
  // src/consensus/heads.ts
@@ -39832,7 +39846,7 @@ function enforceSpecOutputContract(markdown, taskId, title) {
39832
39846
  ${body}`;
39833
39847
  }
39834
39848
  let tldrChars = 0;
39835
- const tldrMatch = body.match(/(^## Коротко\s*\n)([\s\S]*?)(?=\n## |$)/m);
39849
+ const tldrMatch = body.match(/(^## Summary\s*\n)([\s\S]*?)(?=\n## |$)/im);
39836
39850
  if (tldrMatch && tldrMatch.index !== void 0) {
39837
39851
  const heading = tldrMatch[1] ?? "";
39838
39852
  const section = (tldrMatch[2] ?? "").trim();
@@ -39880,7 +39894,7 @@ function buildDraftSpecPrompt(task, constitution) {
39880
39894
  `Return ONLY the full spec markdown, no commentary. Required structure:`,
39881
39895
  `- First line heading: \`# ${task.id} \u2014 ${task.title}\``,
39882
39896
  `- Sections: Problem, Scope, Non-goals, Acceptance criteria, Verification.`,
39883
- `- Final section \`## \u041A\u043E\u0440\u043E\u0442\u043A\u043E\`: a plain-Ukrainian TL;DR of what will be done and how it`,
39897
+ `- Final section \`## Summary\`: a plain-English TL;DR of what will be done and how it`,
39884
39898
  ` will be verified, at most ${DRAFT_SPEC_TLDR_MAX_CHARS} characters.`
39885
39899
  );
39886
39900
  return lines2.join("\n");
@@ -40087,7 +40101,7 @@ function onComplete(outcome, input) {
40087
40101
  }
40088
40102
  return {
40089
40103
  kind: "info",
40090
- body: `\u0421\u043F\u0435\u043A\u0443 \u0434\u043B\u044F ${input.taskId} \u0437\u0440\u043E\u0431\u043B\u0435\u043D\u043E \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u043D\u043E \u2014 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0430 ${parsed.pageId ?? "?"} \u0443 Specs/. \u041D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439 \u0442\u0456\u043A \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C consensus-\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0443.`
40104
+ body: `Spec for ${input.taskId} was drafted automatically \u2014 page ${parsed.pageId ?? "?"} in Specs/. The next scheduler tick will run the consensus review.`
40091
40105
  };
40092
40106
  }
40093
40107
  const summary = outcome.error;
@@ -40096,7 +40110,7 @@ function onComplete(outcome, input) {
40096
40110
  kind: "info",
40097
40111
  id: `II-sched-draft-failed-${input.taskId}-${hash3}`,
40098
40112
  taskId: input.taskId,
40099
- body: `\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u043D\u0430\u043F\u0438\u0441\u0430\u0442\u0438 \u0441\u043F\u0435\u043A\u0443 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u043D\u043E \u0434\u043B\u044F ${input.taskId} \u2014 \u0433\u043B\u044F\u043D\u044C \u0437\u0430\u0434\u0430\u0447\u0443, \u0431\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430. \u041F\u0440\u0438\u0447\u0438\u043D\u0430: ${summary}`
40113
+ body: `Failed to draft a spec automatically for ${input.taskId} \u2014 please review the task. Reason: ${summary}`
40100
40114
  };
40101
40115
  }
40102
40116
  function createDraftSpecDescriptor(deps = {}) {
@@ -40117,48 +40131,48 @@ function errMessage2(error51) {
40117
40131
  function renderMilestone(m, ctx) {
40118
40132
  switch (m) {
40119
40133
  case "spec_drafted": {
40120
- let s = "\u041D\u0430\u043F\u0438\u0441\u0430\u0432 \u0441\u043F\u0435\u043A\u0443, \u0432\u0456\u0434\u0434\u0430\u0432 \u043D\u0430 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0443";
40134
+ let s = "Drafted the spec and sent it for review";
40121
40135
  if (ctx.specUrl) s += ` \u2014 ${ctx.specUrl}`;
40122
- if (ctx.tldr) s += `. \u041A\u043E\u0440\u043E\u0442\u043A\u043E: ${ctx.tldr}`;
40136
+ if (ctx.tldr) s += `. Summary: ${ctx.tldr}`;
40123
40137
  return s;
40124
40138
  }
40125
40139
  case "consensus_converged":
40126
- return "\u0412\u0441\u0435 \u043E\u043A \u2014 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0432 \u0441\u043F\u0435\u043A\u0443, \u043F\u0440\u043E\u0431\u043B\u0435\u043C \u043D\u0435 \u0431\u0430\u0447\u0443";
40140
+ return "Spec review passed \u2014 no issues found";
40127
40141
  case "consensus_converged_needs_approval": {
40128
- let s = "\u0412\u0441\u0435 \u043E\u043A \u2014 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0432 \u0441\u043F\u0435\u043A\u0443. \u041C\u043E\u0436\u0435\u0448 \u0433\u043B\u044F\u043D\u0443\u0442\u0438 \u0439 \u0430\u043F\u0440\u0443\u0432\u043D\u0443\u0442\u0438";
40142
+ let s = "Spec review passed. Please review and approve";
40129
40143
  if (ctx.specUrl) s += ` \u2014 ${ctx.specUrl}`;
40130
- if (ctx.tldr) s += `. \u041A\u043E\u0440\u043E\u0442\u043A\u043E: ${ctx.tldr}`;
40144
+ if (ctx.tldr) s += `. Summary: ${ctx.tldr}`;
40131
40145
  return s;
40132
40146
  }
40133
40147
  case "gate_question":
40134
- return "\u0404 \u043F\u0438\u0442\u0430\u043D\u043D\u044F \u043F\u043E \u0437\u0430\u0434\u0430\u0447\u0456 \u2014 \u0433\u043B\u044F\u043D\u044C, \u0431\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430";
40148
+ return "I have a question about this task \u2014 please take a look";
40135
40149
  case "run_started":
40136
- return "\u041F\u043E\u0447\u0430\u0432 \u0440\u043E\u0431\u0438\u0442\u0438";
40150
+ return "Started working";
40137
40151
  case "pr_opened":
40138
- return "\u0417\u0440\u043E\u0431\u0438\u0432, \u0432\u0456\u0434\u043A\u0440\u0438\u0432 PR";
40152
+ return "Done and opened a PR";
40139
40153
  case "dev_deployed_verified":
40140
- return "\u0412\u0438\u043A\u043B\u0430\u0432 \u043D\u0430 dev \u0456 \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0432 \u2014 \u043F\u0440\u0430\u0446\u044E\u0454";
40154
+ return "Deployed to dev and verified \u2014 it works";
40141
40155
  case "grace_started": {
40142
- let s = "\u0412\u0438\u043A\u043B\u0430\u0432 \u043D\u0430 dev, \u0432\u0441\u0435 \u043E\u043A. \u0412\u0438\u043A\u043E\u0447\u0443 \u043D\u0430 prod";
40143
- if (ctx.graceUntilHHMM) s += ` \u043E ${ctx.graceUntilHHMM}`;
40144
- s += " \u2014 \u0437\u0443\u043F\u0438\u043D\u0438, \u044F\u043A\u0449\u043E \u043D\u0435 \u0442\u0440\u0435\u0431\u0430";
40156
+ let s = "Deployed to dev and verified. I will promote to prod";
40157
+ if (ctx.graceUntilHHMM) s += ` at ${ctx.graceUntilHHMM}`;
40158
+ s += " \u2014 stop me if this is not needed";
40145
40159
  return s;
40146
40160
  }
40147
40161
  case "prod_deployed_verified":
40148
- return "\u0412\u0438\u043A\u043B\u0430\u0432 \u043D\u0430 prod, \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0432 \u2014 \u0432\u0441\u0435 \u043F\u0440\u0430\u0446\u044E\u0454 \u2705";
40162
+ return "Deployed to prod and verified \u2014 everything works";
40149
40163
  case "demoted_blast_radius": {
40150
- let s = "\u0417\u043C\u0456\u043D\u0430 \u0432\u0438\u0433\u043B\u044F\u0434\u0430\u0454 \u0441\u0435\u0440\u0439\u043E\u0437\u043D\u043E\u044E \u2014 \u043F\u043E\u0447\u0435\u043A\u0430\u044E \u043D\u0430 \u0442\u0432\u0456\u0439 \u0430\u043F\u0440\u0443\u0432 \u043F\u0435\u0440\u0435\u0434 \u0432\u0438\u043A\u0430\u0442\u043E\u043C";
40151
- if (ctx.reason) s += `. \u041F\u0440\u0438\u0447\u0438\u043D\u0430: ${ctx.reason}`;
40164
+ let s = "This change looks significant \u2014 waiting for your approval before deploy";
40165
+ if (ctx.reason) s += `. Reason: ${ctx.reason}`;
40152
40166
  return s;
40153
40167
  }
40154
40168
  case "reverted":
40155
- return "\u041F\u0440\u043E\u0434-\u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0430 \u0432\u043F\u0430\u043B\u0430 \u2014 \u0432\u0456\u0434\u043A\u043E\u0442\u0438\u0432 \u043D\u0430\u0437\u0430\u0434, \u0433\u043B\u044F\u043D\u044C \u043A\u043E\u043B\u0438 \u0437\u043C\u043E\u0436\u0435\u0448";
40169
+ return "Production verification failed \u2014 rolled back, please review when you can";
40156
40170
  case "revert_pr_failed":
40157
- return "\u041F\u0440\u043E\u0434 \u0432\u0456\u0434\u043A\u043E\u0442\u0438\u0432, \u0430\u043B\u0435 revert-PR \u043D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u2014 \u0437\u0440\u043E\u0431\u0438 \u0432\u0440\u0443\u0447\u043D\u0443";
40171
+ return "Production rollback completed, but creating a revert PR failed \u2014 please handle manually";
40158
40172
  case "autodeploy_inert_non_code":
40159
- return "\u0410\u0432\u0442\u043E\u0434\u0435\u043F\u043B\u043E\u0439 \u0443\u0432\u0456\u043C\u043A\u043D\u0435\u043D\u043E, \u0430\u043B\u0435 \u0432 \u0446\u0456\u0439 \u0437\u0430\u0434\u0430\u0447\u0456 \u043D\u0435\u043C\u0430 \u0449\u043E \u0434\u0435\u043F\u043B\u043E\u0457\u0442\u0438 \u2014 \u043F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u044E";
40173
+ return "Autodeploy is enabled, but this task has nothing deployable \u2014 skipping";
40160
40174
  case "daily_limit_reached":
40161
- return "\u0414\u0435\u043D\u043D\u0438\u0439 \u043B\u0456\u043C\u0456\u0442 \u0430\u0432\u0442\u043E\u043D\u043E\u043C\u043D\u0438\u0445 \u043E\u043F\u0435\u0440\u0430\u0446\u0456\u0439 \u0432\u0438\u0447\u0435\u0440\u043F\u0430\u043D\u043E \u2014 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443 \u0437\u0430\u0432\u0442\u0440\u0430";
40175
+ return "Daily autonomous operations limit reached \u2014 I will continue tomorrow";
40162
40176
  }
40163
40177
  }
40164
40178
 
@@ -40222,9 +40236,9 @@ function deployApprovalItemId(runId, env) {
40222
40236
  function graceCancelItemId(runId) {
40223
40237
  return `II-grace-cancel-${runId}`;
40224
40238
  }
40225
- var APPROVE_ANSWER = "\u0422\u0430\u043A";
40226
- var REJECT_ANSWER = "\u041D\u0456";
40227
- var GRACE_CANCEL_ANSWER = "\u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438";
40239
+ var APPROVE_ANSWER = "Approve";
40240
+ var REJECT_ANSWER = "Reject";
40241
+ var GRACE_CANCEL_ANSWER = "stop";
40228
40242
  async function findInboxQuestion(client, projectSlug, itemId) {
40229
40243
  const items = await client.listInboxItems(projectSlug, { kind: "question" });
40230
40244
  return items.find((item) => item.id === itemId) ?? null;
@@ -40260,11 +40274,11 @@ async function resolveDeployApproval(deps, projectSlug, run3, task, env) {
40260
40274
  id: itemId,
40261
40275
  kind: "question",
40262
40276
  taskId: task.id,
40263
- body: `\u0412\u0441\u0435 \u0433\u043E\u0442\u043E\u0432\u043E \u2014 \u0432\u0438\u043B\u0438\u0432\u0430\u044E \u043D\u0430 ${env}? (\u0437\u0430\u0434\u0430\u0447\u0430 ${task.id} \u2014 ${task.title}, run ${run3.id})`,
40277
+ body: `Ready to deploy to ${env}? (task ${task.id} \u2014 ${task.title}, run ${run3.id})`,
40264
40278
  origin: "deploy-gate",
40265
40279
  questionOptions: [
40266
- { label: APPROVE_ANSWER, answer: APPROVE_ANSWER, description: `\u0412\u0438\u043A\u043E\u0442\u0438\u0442\u0438 \u043D\u0430 ${env}`, recommended: true },
40267
- { label: REJECT_ANSWER, answer: REJECT_ANSWER, description: "\u041D\u0435 \u0432\u0438\u043A\u043E\u0447\u0443\u0432\u0430\u0442\u0438 \u2014 \u043F\u0435\u0440\u0435\u0434\u0430\u0442\u0438 \u043C\u0435\u043D\u0456" }
40280
+ { label: APPROVE_ANSWER, answer: APPROVE_ANSWER, description: `Deploy to ${env}`, recommended: true },
40281
+ { label: REJECT_ANSWER, answer: REJECT_ANSWER, description: "Do not deploy \u2014 hand it off to me" }
40268
40282
  ]
40269
40283
  }).catch(() => {
40270
40284
  });
@@ -40297,11 +40311,11 @@ async function resolveProdGrace(deps, projectSlug, run3, task, artifacts) {
40297
40311
  id: cancelId,
40298
40312
  kind: "question",
40299
40313
  taskId: task.id,
40300
- body: `\u0412\u0438\u043A\u043E\u0447\u0443 \u043D\u0430 prod \u043E ${formatGraceHHMM(graceUntil)} (\u0437\u0430\u0434\u0430\u0447\u0430 ${task.id} \u2014 ${task.title}). \u0417\u0443\u043F\u0438\u043D\u0438\u0442\u0438?`,
40314
+ body: `I will promote to prod at ${formatGraceHHMM(graceUntil)} (task ${task.id} \u2014 ${task.title}). Stop it?`,
40301
40315
  origin: "deploy-gate",
40302
40316
  questionOptions: [
40303
- { label: "\u0417\u0443\u043F\u0438\u043D\u0438\u0442\u0438", answer: GRACE_CANCEL_ANSWER, description: "\u041D\u0435 \u0432\u0438\u043A\u043E\u0447\u0443\u0432\u0430\u0442\u0438 \u043D\u0430 prod \u2014 \u043F\u0435\u0440\u0435\u0434\u0430\u0442\u0438 \u043C\u0435\u043D\u0456" },
40304
- { label: "\u0412\u0438\u043A\u043E\u0447\u0443\u0439", answer: "\u0432\u0438\u043A\u043E\u0447\u0443\u0439", description: "\u0412\u0441\u0435 \u043E\u043A, \u0432\u0438\u043A\u043E\u0447\u0443\u0439 \u0437\u0430 \u0440\u043E\u0437\u043A\u043B\u0430\u0434\u043E\u043C", recommended: true }
40317
+ { label: "Stop", answer: GRACE_CANCEL_ANSWER, description: "Do not deploy to prod \u2014 hand it off to me" },
40318
+ { label: "Deploy", answer: "deploy", description: "Looks good, deploy on schedule", recommended: true }
40305
40319
  ]
40306
40320
  }).catch(() => {
40307
40321
  });
@@ -40496,7 +40510,7 @@ async function runDeployGateTick(deps, projectSlug, run3, task) {
40496
40510
  projectSlug,
40497
40511
  task,
40498
40512
  run3,
40499
- `verification_failed:prod (\u0430\u0432\u0442\u043E-\u0432\u0456\u0434\u043A\u0430\u0442: prod \u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u043E \u043D\u0430 ${reverted.branch})`
40513
+ `verification_failed:prod (auto-rollback: prod restored to ${reverted.branch})`
40500
40514
  );
40501
40515
  return { kind: "handoff", reason: "verification_failed:prod:reverted" };
40502
40516
  }
@@ -40903,8 +40917,8 @@ function newArtifactId() {
40903
40917
  return `EA-${import_node_crypto4.default.randomUUID()}`;
40904
40918
  }
40905
40919
  var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
40906
- function isBlastRadiusFloorPath(path15) {
40907
- return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path15));
40920
+ function isBlastRadiusFloorPath(path16) {
40921
+ return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path16));
40908
40922
  }
40909
40923
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process6.execFile);
40910
40924
  async function defaultListRunDiffPaths(opts) {
@@ -40925,11 +40939,11 @@ async function defaultListRunDiffPaths(opts) {
40925
40939
  return parse5(stdout);
40926
40940
  }
40927
40941
  }
40928
- var BLAST_RADIUS_FLOOR_REASON = "\u043C\u0456\u0433\u0440\u0430\u0446\u0456\u0457/\u0441\u0445\u0435\u043C\u0430 \u0411\u0414 \u0443 \u0434\u0456\u0444\u0456";
40929
- var BLAST_RADIUS_UNKNOWN_REASON = "\u043D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u043F\u043E\u0440\u0430\u0445\u0443\u0432\u0430\u0442\u0438 diff \u0434\u043B\u044F \u043E\u0446\u0456\u043D\u043A\u0438 \u0440\u0438\u0437\u0438\u043A\u0443";
40942
+ var BLAST_RADIUS_FLOOR_REASON = "migration or database schema files changed";
40943
+ var BLAST_RADIUS_UNKNOWN_REASON = "could not inspect the diff for risk scoring";
40930
40944
  async function resolveEffectiveRisk(deps, worktreePath, projectSlug, review) {
40931
40945
  let risk = review?.risk ?? "trivial";
40932
- let reason = review?.riskReason ?? "\u043D\u0435\u0442\u0440\u0438\u0432\u0456\u0430\u043B\u044C\u043D\u0430 \u0437\u043C\u0456\u043D\u0430 \u0437\u0430 \u043E\u0446\u0456\u043D\u043A\u043E\u044E self-review";
40946
+ let reason = review?.riskReason ?? "self-review marked the change as nontrivial";
40933
40947
  try {
40934
40948
  const getDefaultBranch = deps.getDefaultBranch ?? (async () => "main");
40935
40949
  const listPaths = deps.listRunDiffPaths ?? defaultListRunDiffPaths;
@@ -41723,6 +41737,13 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
41723
41737
  running = [];
41724
41738
  }
41725
41739
  for (const run3 of running) {
41740
+ if (!isRunRecoverableByThisBridge(run3, deps.worktreeRoot)) {
41741
+ process.stderr.write(
41742
+ `[mrrlin] skipping foreign stale run ${slug}/${run3.id}; worktree is owned by another bridge
41743
+ `
41744
+ );
41745
+ continue;
41746
+ }
41726
41747
  await deps.client.requeueExecutionRun(slug, run3.id, deps.staleSeconds).catch(() => null);
41727
41748
  }
41728
41749
  let pending = [];
@@ -41764,6 +41785,12 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
41764
41785
  }
41765
41786
  }
41766
41787
  }
41788
+ function isRunRecoverableByThisBridge(run3, worktreeRoot) {
41789
+ if (!worktreeRoot) return true;
41790
+ if (!run3.worktreeId) return false;
41791
+ const relative = import_node_path6.default.relative(import_node_path6.default.resolve(worktreeRoot), import_node_path6.default.resolve(run3.worktreeId));
41792
+ return relative === "" || relative.length > 0 && !relative.startsWith("..") && !import_node_path6.default.isAbsolute(relative);
41793
+ }
41767
41794
  async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId) {
41768
41795
  await deps.client.updateExecutionRun(projectSlug, runId, { status: "failed", finishedAt: (/* @__PURE__ */ new Date()).toISOString(), leaseId: leaseId ?? void 0 }).catch(() => {
41769
41796
  });
@@ -42212,13 +42239,13 @@ function codexIdleMs() {
42212
42239
  // src/operator-token.ts
42213
42240
  var import_node_fs5 = require("node:fs");
42214
42241
  var import_node_os4 = __toESM(require("node:os"), 1);
42215
- var import_node_path6 = __toESM(require("node:path"), 1);
42242
+ var import_node_path7 = __toESM(require("node:path"), 1);
42216
42243
  function operatorDir() {
42217
- const base = process.env.CODEX_HOME ? import_node_path6.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path6.default.join(import_node_os4.default.homedir(), ".mrrlin");
42244
+ const base = process.env.CODEX_HOME ? import_node_path7.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path7.default.join(import_node_os4.default.homedir(), ".mrrlin");
42218
42245
  return base;
42219
42246
  }
42220
42247
  function operatorTokenPath() {
42221
- return import_node_path6.default.join(operatorDir(), "operator-token");
42248
+ return import_node_path7.default.join(operatorDir(), "operator-token");
42222
42249
  }
42223
42250
  function readOperatorToken() {
42224
42251
  try {
@@ -42235,7 +42262,7 @@ function persistOperatorToken(token) {
42235
42262
  `, { encoding: "utf8", mode: 384 });
42236
42263
  }
42237
42264
  function agentCredentialPath() {
42238
- return import_node_path6.default.join(operatorDir(), "agent-credential");
42265
+ return import_node_path7.default.join(operatorDir(), "agent-credential");
42239
42266
  }
42240
42267
  function persistAgentSecret(secret) {
42241
42268
  const dir = operatorDir();
@@ -42256,9 +42283,9 @@ function readAgentSecret() {
42256
42283
 
42257
42284
  // src/thread-index.ts
42258
42285
  var import_node_fs6 = require("node:fs");
42259
- var import_node_path7 = __toESM(require("node:path"), 1);
42286
+ var import_node_path8 = __toESM(require("node:path"), 1);
42260
42287
  function threadIndexPath(stateDir) {
42261
- return import_node_path7.default.join(stateDir, "threads.json");
42288
+ return import_node_path8.default.join(stateDir, "threads.json");
42262
42289
  }
42263
42290
  function loadThreadIndex(stateDir, ttlMs, now) {
42264
42291
  const result = /* @__PURE__ */ new Map();
@@ -42375,7 +42402,7 @@ function chatTurnMaxMs() {
42375
42402
  var import_node_crypto6 = require("node:crypto");
42376
42403
  var import_node_fs7 = require("node:fs");
42377
42404
  var import_node_os5 = __toESM(require("node:os"), 1);
42378
- var import_node_path8 = __toESM(require("node:path"), 1);
42405
+ var import_node_path9 = __toESM(require("node:path"), 1);
42379
42406
  var DEFAULT_WORKER_PORT = 8792;
42380
42407
  function workerPort() {
42381
42408
  const raw = process.env.MRRLIN_WORKER_PORT;
@@ -42384,11 +42411,11 @@ function workerPort() {
42384
42411
  return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
42385
42412
  }
42386
42413
  function workerDir() {
42387
- const base = process.env.CODEX_HOME ? import_node_path8.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path8.default.join(import_node_os5.default.homedir(), ".mrrlin");
42388
- return import_node_path8.default.join(base, "worker");
42414
+ const base = process.env.CODEX_HOME ? import_node_path9.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path9.default.join(import_node_os5.default.homedir(), ".mrrlin");
42415
+ return import_node_path9.default.join(base, "worker");
42389
42416
  }
42390
42417
  function workerTokenPath() {
42391
- return import_node_path8.default.join(workerDir(), "token");
42418
+ return import_node_path9.default.join(workerDir(), "token");
42392
42419
  }
42393
42420
  function readWorkerToken() {
42394
42421
  try {
@@ -42413,7 +42440,7 @@ function readOrCreateWorkerToken() {
42413
42440
  var import_node_events2 = require("node:events");
42414
42441
  var import_node_fs8 = require("node:fs");
42415
42442
  var import_node_os6 = require("node:os");
42416
- var import_node_path9 = require("node:path");
42443
+ var import_node_path10 = require("node:path");
42417
42444
 
42418
42445
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
42419
42446
  var nc = __toESM(require("node:crypto"), 1);
@@ -45984,9 +46011,9 @@ var DirectorRelay = class {
45984
46011
 
45985
46012
  // src/remote-phone-relay.ts
45986
46013
  function loadOrCreateAgentDeviceKey() {
45987
- const path15 = (0, import_node_path9.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-device-key");
46014
+ const path16 = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-device-key");
45988
46015
  try {
45989
- const raw = JSON.parse((0, import_node_fs8.readFileSync)(path15, "utf8"));
46016
+ const raw = JSON.parse((0, import_node_fs8.readFileSync)(path16, "utf8"));
45990
46017
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
45991
46018
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
45992
46019
  }
@@ -45994,9 +46021,9 @@ function loadOrCreateAgentDeviceKey() {
45994
46021
  }
45995
46022
  const kp = generateIdentityKeyPair();
45996
46023
  try {
45997
- (0, import_node_fs8.mkdirSync)((0, import_node_path9.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
46024
+ (0, import_node_fs8.mkdirSync)((0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
45998
46025
  (0, import_node_fs8.writeFileSync)(
45999
- path15,
46026
+ path16,
46000
46027
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
46001
46028
  { mode: 384 }
46002
46029
  );
@@ -46004,7 +46031,7 @@ function loadOrCreateAgentDeviceKey() {
46004
46031
  }
46005
46032
  return kp;
46006
46033
  }
46007
- var AGENT_PAIRING_PATH = (0, import_node_path9.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-pairing.json");
46034
+ var AGENT_PAIRING_PATH = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-pairing.json");
46008
46035
  function loadAgentPairing() {
46009
46036
  try {
46010
46037
  const raw = JSON.parse((0, import_node_fs8.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
@@ -46022,7 +46049,7 @@ function loadAgentPairing() {
46022
46049
  }
46023
46050
  function saveAgentPairing(record2) {
46024
46051
  try {
46025
- (0, import_node_fs8.mkdirSync)((0, import_node_path9.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
46052
+ (0, import_node_fs8.mkdirSync)((0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
46026
46053
  (0, import_node_fs8.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
46027
46054
  } catch {
46028
46055
  }
@@ -46201,11 +46228,11 @@ async function renderPairingQrSvg(payload) {
46201
46228
 
46202
46229
  // src/checkout-registry.ts
46203
46230
  var import_node_fs9 = require("node:fs");
46204
- var import_node_path10 = require("node:path");
46231
+ var import_node_path11 = require("node:path");
46205
46232
  var CheckoutRegistry = class {
46206
46233
  file;
46207
46234
  constructor(stateDir) {
46208
- this.file = (0, import_node_path10.join)(stateDir, "checkouts.json");
46235
+ this.file = (0, import_node_path11.join)(stateDir, "checkouts.json");
46209
46236
  (0, import_node_fs9.mkdirSync)(stateDir, { recursive: true });
46210
46237
  }
46211
46238
  read() {
@@ -46219,9 +46246,9 @@ var CheckoutRegistry = class {
46219
46246
  get(slug) {
46220
46247
  return this.read()[slug] ?? null;
46221
46248
  }
46222
- confirm(slug, path15, now) {
46249
+ confirm(slug, path16, now) {
46223
46250
  const all = this.read();
46224
- all[slug] = { path: path15, confirmedAt: now };
46251
+ all[slug] = { path: path16, confirmedAt: now };
46225
46252
  (0, import_node_fs9.writeFileSync)(this.file, JSON.stringify(all, null, 2));
46226
46253
  }
46227
46254
  };
@@ -46434,7 +46461,7 @@ function extractVerificationSection(markdown) {
46434
46461
 
46435
46462
  // src/bridge-log.ts
46436
46463
  var import_node_fs10 = require("node:fs");
46437
- var import_node_path11 = require("node:path");
46464
+ var import_node_path12 = require("node:path");
46438
46465
 
46439
46466
  // src/redact.ts
46440
46467
  var REDACTED = "[REDACTED]";
@@ -46519,14 +46546,14 @@ function resolvePromptsEnabled(env) {
46519
46546
  }
46520
46547
  function createBridgeLogger(stateDir, env = process.env) {
46521
46548
  if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
46522
- const logsDir = (0, import_node_path11.join)(stateDir, "logs");
46549
+ const logsDir = (0, import_node_path12.join)(stateDir, "logs");
46523
46550
  try {
46524
46551
  (0, import_node_fs10.mkdirSync)(logsDir, { recursive: true });
46525
46552
  } catch {
46526
46553
  return NOOP_LOGGER;
46527
46554
  }
46528
46555
  const includePrompts = resolvePromptsEnabled(env);
46529
- const fileFor = () => (0, import_node_path11.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
46556
+ const fileFor = () => (0, import_node_path12.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
46530
46557
  const write = (dir, rec) => {
46531
46558
  try {
46532
46559
  const line = JSON.stringify({
@@ -46616,9 +46643,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
46616
46643
  return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
46617
46644
  }
46618
46645
  function readCodexFallbackModels() {
46619
- const codexHome = process.env.CODEX_HOME?.trim() || import_node_path12.default.join(import_node_os7.default.homedir(), ".codex");
46646
+ const codexHome = process.env.CODEX_HOME?.trim() || import_node_path13.default.join(import_node_os7.default.homedir(), ".codex");
46620
46647
  const models = /* @__PURE__ */ new Map();
46621
- const cachePath = import_node_path12.default.join(codexHome, "models_cache.json");
46648
+ const cachePath = import_node_path13.default.join(codexHome, "models_cache.json");
46622
46649
  const cacheRaw = readTextIfExists(cachePath);
46623
46650
  if (cacheRaw) {
46624
46651
  try {
@@ -46668,7 +46695,7 @@ function readCodexFallbackModels() {
46668
46695
  );
46669
46696
  }
46670
46697
  }
46671
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path12.default.join(codexHome, "config.toml"))) {
46698
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path13.default.join(codexHome, "config.toml"))) {
46672
46699
  addBridgeModel(
46673
46700
  models,
46674
46701
  mapBridgeModel({
@@ -46682,11 +46709,11 @@ function readCodexFallbackModels() {
46682
46709
  })
46683
46710
  );
46684
46711
  }
46685
- const automationsDir = import_node_path12.default.join(codexHome, "automations");
46712
+ const automationsDir = import_node_path13.default.join(codexHome, "automations");
46686
46713
  try {
46687
46714
  for (const entry of import_node_fs11.default.readdirSync(automationsDir, { withFileTypes: true })) {
46688
46715
  if (!entry.isDirectory()) continue;
46689
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path12.default.join(automationsDir, entry.name, "automation.toml"))) {
46716
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path13.default.join(automationsDir, entry.name, "automation.toml"))) {
46690
46717
  addBridgeModel(
46691
46718
  models,
46692
46719
  mapBridgeModel({
@@ -46706,7 +46733,7 @@ function readCodexFallbackModels() {
46706
46733
  return [...models.values()];
46707
46734
  }
46708
46735
  function neutralCheckoutCwd(stateDir) {
46709
- const dir = import_node_path12.default.join(stateDir, "no-checkout");
46736
+ const dir = import_node_path13.default.join(stateDir, "no-checkout");
46710
46737
  try {
46711
46738
  import_node_fs11.default.mkdirSync(dir, { recursive: true });
46712
46739
  } catch {
@@ -46722,7 +46749,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
46722
46749
  "required before the result LANDS (merge/deploy); it does not authorize building on unvalidated",
46723
46750
  "assumptions. Judge clarification on requirement clarity, independently of autonomy_level.",
46724
46751
  "Never announce or pre-narrate that you are about to use tools, and never name the toolset in",
46725
- `prose. Do NOT write openers like "I'll use the Mrrlin tools to\u2026", "\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u044E Mrrlin tools\u2026",`,
46752
+ `prose. Do NOT write openers like "I'll use the Mrrlin tools to\u2026",`,
46726
46753
  'or "let me call the \u2026 tool" in ANY language. The operator already sees tool calls in the',
46727
46754
  "transcript. Just call the tools and reply with the outcome \u2014 start your reply with the result.",
46728
46755
  "When creating or updating tasks, always provide `autonomyLevel` and `autonomyReason`.",
@@ -47044,8 +47071,8 @@ async function runOrphanWorktreeSweep(client, opts) {
47044
47071
  }
47045
47072
  }
47046
47073
  function readStateDir() {
47047
- if (process.env.CODEX_HOME) return import_node_path12.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
47048
- return import_node_path12.default.join(import_node_os7.default.homedir(), ".mrrlin", "director-bridge");
47074
+ if (process.env.CODEX_HOME) return import_node_path13.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
47075
+ return import_node_path13.default.join(import_node_os7.default.homedir(), ".mrrlin", "director-bridge");
47049
47076
  }
47050
47077
  function readAllowedOrigins() {
47051
47078
  const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
@@ -47914,9 +47941,11 @@ async function startDirectorBridge() {
47914
47941
  activeCount: turnLock.activeCount
47915
47942
  };
47916
47943
  const shutdownHolder = { fn: null };
47944
+ const resumableCountHolder = { fn: null };
47917
47945
  const selfUpdateHandle = startSelfUpdate({
47918
47946
  binPath: process.argv[1] ?? "",
47919
47947
  getActiveTurnCount: () => wrappedTurnLock.activeCount(),
47948
+ getResumableTurnCount: () => resumableCountHolder.fn?.() ?? 0,
47920
47949
  getIdleMs: () => Date.now() - lastTurnEndedAt,
47921
47950
  pkgVersion: PKG_VERSION,
47922
47951
  shutdown: () => {
@@ -48020,8 +48049,8 @@ async function startDirectorBridge() {
48020
48049
  codexCwd: config2.codexCwd,
48021
48050
  codexExecutable: config2.codexExecutable,
48022
48051
  checkoutRegistry,
48023
- worktreeRoot: import_node_path12.default.join(config2.stateDir, "worktrees"),
48024
- locksDir: import_node_path12.default.join(config2.stateDir, "locks"),
48052
+ worktreeRoot: import_node_path13.default.join(config2.stateDir, "worktrees"),
48053
+ locksDir: import_node_path13.default.join(config2.stateDir, "locks"),
48025
48054
  // Wire the executor server for code-execution runs. Each run gets its own app-server
48026
48055
  // process at the run worktree, running UNRESTRICTED from the real ~/.codex (owner
48027
48056
  // no-sandbox decision — auth + mrrlin MCP come from the operator config).
@@ -48057,7 +48086,7 @@ async function startDirectorBridge() {
48057
48086
  // egressDomains is retained in the seam signature (verification-turn.ts still computes the
48058
48087
  // env host) but no longer constrains anything — the executor is unrestricted.
48059
48088
  startSandbox: async (_egressDomains) => {
48060
- const cwd = import_node_fs11.default.mkdtempSync(import_node_path12.default.join(import_node_os7.default.tmpdir(), "mrrlin-verify-"));
48089
+ const cwd = import_node_fs11.default.mkdtempSync(import_node_path13.default.join(import_node_os7.default.tmpdir(), "mrrlin-verify-"));
48061
48090
  let handle;
48062
48091
  try {
48063
48092
  handle = await startExecutorServer({ worktree: cwd });
@@ -48137,6 +48166,16 @@ async function startDirectorBridge() {
48137
48166
  consumerState.inFlightRunId = null;
48138
48167
  }
48139
48168
  });
48169
+ const driveRunNow = (slug, runId) => {
48170
+ consumerState.inFlightRunId = runId;
48171
+ consumerState.lastClaimAt = (/* @__PURE__ */ new Date()).toISOString();
48172
+ void driveRun(consumerDeps, slug, runId).catch((error51) => {
48173
+ process.stderr.write(`[mrrlin-mcp director-bridge] drive failed for ${slug}/${runId}: ${error51 instanceof Error ? error51.message : String(error51)}
48174
+ `);
48175
+ }).finally(() => {
48176
+ consumerState.inFlightRunId = null;
48177
+ });
48178
+ };
48140
48179
  const driveAsyncTracked = (slug, jobId) => enqueueRun(async () => {
48141
48180
  try {
48142
48181
  await driveAsyncJob(asyncConsumerDeps, slug, jobId);
@@ -48145,6 +48184,12 @@ async function startDirectorBridge() {
48145
48184
  `);
48146
48185
  }
48147
48186
  });
48187
+ const driveAsyncNow = (slug, jobId) => {
48188
+ void driveAsyncJob(asyncConsumerDeps, slug, jobId).catch((error51) => {
48189
+ process.stderr.write(`[mrrlin-mcp director-bridge] async drive failed for ${slug}/${jobId}: ${error51 instanceof Error ? error51.message : String(error51)}
48190
+ `);
48191
+ });
48192
+ };
48148
48193
  const server = import_node_http.default.createServer(
48149
48194
  createBridgeRequestListener({
48150
48195
  host: config2.host,
@@ -48156,6 +48201,15 @@ async function startDirectorBridge() {
48156
48201
  );
48157
48202
  const threads = /* @__PURE__ */ new Map();
48158
48203
  const suspensionDetector = createSuspensionDetector();
48204
+ resumableCountHolder.fn = () => {
48205
+ const now = Date.now();
48206
+ const suspended = suspensionDetector.suspendedMs();
48207
+ let n = 0;
48208
+ for (const thread of threads.values()) {
48209
+ if (thread.replay && !shouldGc(thread.replay, now, suspended)) n += 1;
48210
+ }
48211
+ return n;
48212
+ };
48159
48213
  for (const [directorSessionId, entry] of loadThreadIndex(config2.stateDir, config2.idleThreadTtlMs, Date.now())) {
48160
48214
  threads.set(directorSessionId, {
48161
48215
  threadId: entry.threadId,
@@ -48330,8 +48384,8 @@ async function startDirectorBridge() {
48330
48384
  }
48331
48385
  res.writeHead(202, { "content-type": "application/json" });
48332
48386
  res.end(JSON.stringify({ ok: true }));
48333
- if (jobId) driveAsyncTracked(slug, jobId);
48334
- else driveTracked(slug, runId);
48387
+ if (jobId) driveAsyncNow(slug, jobId);
48388
+ else driveRunNow(slug, runId);
48335
48389
  }).catch(() => {
48336
48390
  res.writeHead(400).end();
48337
48391
  });
@@ -48366,8 +48420,8 @@ async function startDirectorBridge() {
48366
48420
  enqueueRun(
48367
48421
  () => runOrphanWorktreeSweep(client, {
48368
48422
  checkoutRegistry,
48369
- worktreeRoot: import_node_path12.default.join(config2.stateDir, "worktrees"),
48370
- locksDir: import_node_path12.default.join(config2.stateDir, "locks")
48423
+ worktreeRoot: import_node_path13.default.join(config2.stateDir, "worktrees"),
48424
+ locksDir: import_node_path13.default.join(config2.stateDir, "locks")
48371
48425
  })
48372
48426
  );
48373
48427
  enqueueRun(async () => {
@@ -48423,12 +48477,19 @@ async function startDirectorBridge() {
48423
48477
  );
48424
48478
  }
48425
48479
  let schedulerTickHandle = null;
48426
- const schedulerToken = process.env.MRRLIN_SCHEDULER_TOKEN?.trim();
48427
- if (schedulerToken && !schedulerTickDisabled(process.env)) {
48428
- schedulerTickHandle = startSchedulerTickLoop({ apiBaseUrl, token: schedulerToken, logger: bridgeLogger });
48429
- } else if (!schedulerToken) {
48480
+ if (tokenProvider && !schedulerTickDisabled(process.env)) {
48481
+ schedulerTickHandle = startSchedulerTickLoop({
48482
+ apiBaseUrl,
48483
+ fetchImpl: authedFetch,
48484
+ logger: bridgeLogger,
48485
+ dispatchEnqueued: (projectSlug, work) => {
48486
+ if (work.kind === "execution_run") driveRunNow(projectSlug, work.runId);
48487
+ else driveAsyncNow(projectSlug, work.jobId);
48488
+ }
48489
+ });
48490
+ } else if (!tokenProvider) {
48430
48491
  process.stderr.write(
48431
- "[mrrlin-mcp director-bridge] no scheduler token (MRRLIN_SCHEDULER_TOKEN unset); skipping scheduler tick loop. Tasks advance only when an external cron hits /cron/scheduler/run.\n"
48492
+ "[mrrlin-mcp director-bridge] no durable agent credential; skipping bridge scheduler tick loop.\n"
48432
48493
  );
48433
48494
  } else {
48434
48495
  process.stderr.write(
@@ -48609,7 +48670,7 @@ function readDispatchBody(req) {
48609
48670
  function readOrCreateBridgeToken(stateDir) {
48610
48671
  const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
48611
48672
  if (explicit) return explicit;
48612
- const tokenPath = import_node_path12.default.join(stateDir, "token.txt");
48673
+ const tokenPath = import_node_path13.default.join(stateDir, "token.txt");
48613
48674
  try {
48614
48675
  const existing = import_node_fs11.default.readFileSync(tokenPath, "utf8").trim();
48615
48676
  if (existing) return existing;
@@ -52002,16 +52063,16 @@ var StdioServerTransport = class {
52002
52063
  var import_node_crypto10 = require("node:crypto");
52003
52064
  var import_promises3 = require("node:fs/promises");
52004
52065
  var import_node_fs12 = require("node:fs");
52005
- var import_node_path14 = __toESM(require("node:path"), 1);
52066
+ var import_node_path15 = __toESM(require("node:path"), 1);
52006
52067
  var import_node_os8 = __toESM(require("node:os"), 1);
52007
52068
  var import_node_child_process8 = require("node:child_process");
52008
52069
 
52009
52070
  // ../../packages/wiki/dist/index.js
52010
52071
  var import_promises2 = __toESM(require("node:fs/promises"), 1);
52011
- var import_node_path13 = __toESM(require("node:path"), 1);
52072
+ var import_node_path14 = __toESM(require("node:path"), 1);
52012
52073
  var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
52013
52074
  function toPosixPath(input) {
52014
- return input.split(import_node_path13.default.sep).join("/");
52075
+ return input.split(import_node_path14.default.sep).join("/");
52015
52076
  }
52016
52077
  function slugifyWikiSegment(input) {
52017
52078
  return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -52025,12 +52086,12 @@ async function pathExists2(input) {
52025
52086
  }
52026
52087
  }
52027
52088
  async function findWorkspaceRoot(start = process.cwd()) {
52028
- let current = import_node_path13.default.resolve(start);
52089
+ let current = import_node_path14.default.resolve(start);
52029
52090
  while (true) {
52030
- if (await pathExists2(import_node_path13.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path13.default.join(current, "docs"))) {
52091
+ if (await pathExists2(import_node_path14.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path14.default.join(current, "docs"))) {
52031
52092
  return current;
52032
52093
  }
52033
- const parent = import_node_path13.default.dirname(current);
52094
+ const parent = import_node_path14.default.dirname(current);
52034
52095
  if (parent === current) {
52035
52096
  throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
52036
52097
  }
@@ -52039,28 +52100,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
52039
52100
  }
52040
52101
  async function resolveDocsRoot(input) {
52041
52102
  if (input) {
52042
- return import_node_path13.default.resolve(input);
52103
+ return import_node_path14.default.resolve(input);
52043
52104
  }
52044
52105
  if (process.env.MRRLIN_DOCS_ROOT) {
52045
- return import_node_path13.default.resolve(process.env.MRRLIN_DOCS_ROOT);
52106
+ return import_node_path14.default.resolve(process.env.MRRLIN_DOCS_ROOT);
52046
52107
  }
52047
- return import_node_path13.default.join(await findWorkspaceRoot(), "docs");
52108
+ return import_node_path14.default.join(await findWorkspaceRoot(), "docs");
52048
52109
  }
52049
52110
  async function resolveIndexPath(input) {
52050
52111
  if (input) {
52051
- return import_node_path13.default.resolve(input);
52112
+ return import_node_path14.default.resolve(input);
52052
52113
  }
52053
52114
  if (process.env.MRRLIN_WIKI_INDEX_PATH) {
52054
- return import_node_path13.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
52115
+ return import_node_path14.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
52055
52116
  }
52056
52117
  const workspaceRoot = await findWorkspaceRoot();
52057
- return import_node_path13.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
52118
+ return import_node_path14.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
52058
52119
  }
52059
52120
  async function walkMarkdownFiles(root, dir = root) {
52060
52121
  const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
52061
52122
  const files = [];
52062
52123
  for (const entry of entries) {
52063
- const absolute = import_node_path13.default.join(dir, entry.name);
52124
+ const absolute = import_node_path14.default.join(dir, entry.name);
52064
52125
  if (entry.isDirectory()) {
52065
52126
  files.push(...await walkMarkdownFiles(root, absolute));
52066
52127
  continue;
@@ -52079,7 +52140,7 @@ function parseTitle(markdown, sourcePath) {
52079
52140
  return title;
52080
52141
  }
52081
52142
  function documentFromFile(docsRoot, absolutePath, markdown) {
52082
- const relativePath = toPosixPath(import_node_path13.default.relative(docsRoot, absolutePath));
52143
+ const relativePath = toPosixPath(import_node_path14.default.relative(docsRoot, absolutePath));
52083
52144
  const [section, fileName] = relativePath.split("/");
52084
52145
  if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
52085
52146
  return null;
@@ -54216,7 +54277,7 @@ function createMrrlinTools(options) {
54216
54277
  "ARTIFACT_FILE_UPLOAD_FAILED",
54217
54278
  "Unable to upload artifact file.",
54218
54279
  async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
54219
- const extension2 = import_node_path14.default.extname(filePath).toLowerCase();
54280
+ const extension2 = import_node_path15.default.extname(filePath).toLowerCase();
54220
54281
  const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
54221
54282
  if (!contentType) {
54222
54283
  throw new McpToolCodedError(
@@ -54244,7 +54305,7 @@ function createMrrlinTools(options) {
54244
54305
  "Artifact exceeds 5MB; split or summarize instead."
54245
54306
  );
54246
54307
  }
54247
- const filename = import_node_path14.default.basename(filePath);
54308
+ const filename = import_node_path15.default.basename(filePath);
54248
54309
  const created = await c.createArtifactFile(projectSlug, {
54249
54310
  class: artifactClass,
54250
54311
  contentType,
@@ -54327,7 +54388,7 @@ function createMrrlinTools(options) {
54327
54388
  "Unable to register local checkout.",
54328
54389
  async (_c, { projectSlug, path: checkoutPath, repo }) => {
54329
54390
  const trimmedPath = checkoutPath.trim();
54330
- if (!import_node_path14.default.isAbsolute(trimmedPath)) {
54391
+ if (!import_node_path15.default.isAbsolute(trimmedPath)) {
54331
54392
  throw new McpToolCodedError(
54332
54393
  "LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
54333
54394
  `Path must be absolute, got: ${trimmedPath}`
@@ -54362,7 +54423,7 @@ function createMrrlinTools(options) {
54362
54423
  `Origin remote ${remoteUrl} does not match repo ${repo}.`
54363
54424
  );
54364
54425
  }
54365
- const stateDir = process.env.CODEX_HOME ? import_node_path14.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path14.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
54426
+ const stateDir = process.env.CODEX_HOME ? import_node_path15.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path15.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
54366
54427
  const registry3 = new CheckoutRegistry(stateDir);
54367
54428
  const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
54368
54429
  registry3.confirm(projectSlug, resolvedPath, confirmedAt);
@@ -54570,12 +54631,12 @@ function runSetCredential(args) {
54570
54631
 
54571
54632
  // src/install-service.ts
54572
54633
  var import_node_os9 = __toESM(require("node:os"), 1);
54573
- var import_node_path16 = __toESM(require("node:path"), 1);
54634
+ var import_node_path17 = __toESM(require("node:path"), 1);
54574
54635
 
54575
54636
  // src/service-paths.ts
54576
- var import_node_path15 = __toESM(require("node:path"), 1);
54637
+ var import_node_path16 = __toESM(require("node:path"), 1);
54577
54638
  function isWorktreePath(p) {
54578
- const norm = import_node_path15.default.normalize(p).split(import_node_path15.default.sep).join("/");
54639
+ const norm = import_node_path16.default.normalize(p).split(import_node_path16.default.sep).join("/");
54579
54640
  return norm.includes("/.claude/worktrees/");
54580
54641
  }
54581
54642
  function resolveServiceCwd(opts) {
@@ -54598,7 +54659,6 @@ function renderEcosystemConfig(opts) {
54598
54659
  if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
54599
54660
  if (opts.staging) env.MRRLIN_STAGING = "1";
54600
54661
  else if (opts.apiBaseUrl) env.MRRLIN_API_BASE_URL = opts.apiBaseUrl;
54601
- if (opts.schedulerToken) env.MRRLIN_SCHEDULER_TOKEN = opts.schedulerToken;
54602
54662
  const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
54603
54663
  return `module.exports = {
54604
54664
  apps: [{
@@ -54641,17 +54701,16 @@ function installService(deps) {
54641
54701
  return { ok: false };
54642
54702
  }
54643
54703
  const resolvedBins = bins.filter((b) => b !== null);
54644
- const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path16.default.dirname(b)))).join(":");
54704
+ const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path17.default.dirname(b)))).join(":");
54645
54705
  const text = renderEcosystemConfig({
54646
54706
  cwd: resolved.cwd,
54647
54707
  home,
54648
54708
  codexHome: deps.env.CODEX_HOME?.trim() || void 0,
54649
54709
  pathEnv,
54650
54710
  staging: deps.env.MRRLIN_STAGING === "1",
54651
- apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0,
54652
- schedulerToken: deps.env.MRRLIN_SCHEDULER_TOKEN?.trim() || void 0
54711
+ apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
54653
54712
  });
54654
- const ecoPath = import_node_path16.default.join(home, ".mrrlin", "ecosystem.config.cjs");
54713
+ const ecoPath = import_node_path17.default.join(home, ".mrrlin", "ecosystem.config.cjs");
54655
54714
  deps.writeFile(ecoPath, text);
54656
54715
  const start = deps.runPm2(["startOrReload", ecoPath]);
54657
54716
  if (start.code !== 0) {
@@ -54683,12 +54742,12 @@ function uninstallService(deps) {
54683
54742
  // src/uninstall-codex.ts
54684
54743
  var import_promises4 = __toESM(require("node:fs/promises"), 1);
54685
54744
  var import_node_os10 = __toESM(require("node:os"), 1);
54686
- var import_node_path17 = __toESM(require("node:path"), 1);
54745
+ var import_node_path18 = __toESM(require("node:path"), 1);
54687
54746
  var toml2 = __toESM(require_toml(), 1);
54688
54747
  function resolveCodexHome2(options) {
54689
54748
  if (options.codexHome) return options.codexHome;
54690
54749
  if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
54691
- return import_node_path17.default.join(options.homeDir ?? import_node_os10.default.homedir(), ".codex");
54750
+ return import_node_path18.default.join(options.homeDir ?? import_node_os10.default.homedir(), ".codex");
54692
54751
  }
54693
54752
  async function pathExists3(target) {
54694
54753
  try {
@@ -54701,7 +54760,7 @@ async function pathExists3(target) {
54701
54760
  var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.mrrlin(?:-browser)?(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
54702
54761
  async function uninstallCodex(options = {}) {
54703
54762
  const codexHome = resolveCodexHome2(options);
54704
- const configPath = import_node_path17.default.join(codexHome, "config.toml");
54763
+ const configPath = import_node_path18.default.join(codexHome, "config.toml");
54705
54764
  const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
54706
54765
  if (!await pathExists3(configPath)) {
54707
54766
  return { action: "missing", configPath, prompts: await removePrompts() };
@@ -54729,10 +54788,10 @@ async function uninstallCodex(options = {}) {
54729
54788
  }
54730
54789
  async function uninstallPrompts(codexHome, names) {
54731
54790
  if (names.length === 0) return [];
54732
- const promptsDir2 = import_node_path17.default.join(codexHome, "prompts");
54791
+ const promptsDir2 = import_node_path18.default.join(codexHome, "prompts");
54733
54792
  const out = [];
54734
54793
  for (const name of names) {
54735
- const promptPath = import_node_path17.default.join(promptsDir2, `${name}.md`);
54794
+ const promptPath = import_node_path18.default.join(promptsDir2, `${name}.md`);
54736
54795
  try {
54737
54796
  await import_promises4.default.unlink(promptPath);
54738
54797
  out.push({ name, action: "removed", promptPath });
@@ -54750,15 +54809,15 @@ async function uninstallPrompts(codexHome, names) {
54750
54809
 
54751
54810
  // src/report-issue-prompt.ts
54752
54811
  var import_node_fs13 = __toESM(require("node:fs"), 1);
54753
- var import_node_path18 = __toESM(require("node:path"), 1);
54812
+ var import_node_path19 = __toESM(require("node:path"), 1);
54754
54813
  var import_node_url3 = require("node:url");
54755
54814
  var import_meta3 = {};
54756
54815
  function promptsDir() {
54757
- if (typeof __dirname !== "undefined") return import_node_path18.default.join(__dirname, "prompts");
54758
- return import_node_path18.default.join(import_node_path18.default.dirname((0, import_node_url3.fileURLToPath)(import_meta3.url)), "prompts");
54816
+ if (typeof __dirname !== "undefined") return import_node_path19.default.join(__dirname, "prompts");
54817
+ return import_node_path19.default.join(import_node_path19.default.dirname((0, import_node_url3.fileURLToPath)(import_meta3.url)), "prompts");
54759
54818
  }
54760
54819
  function readReportIssuePrompt() {
54761
- return import_node_fs13.default.readFileSync(import_node_path18.default.join(promptsDir(), "report-issue.md"), "utf8");
54820
+ return import_node_fs13.default.readFileSync(import_node_path19.default.join(promptsDir(), "report-issue.md"), "utf8");
54762
54821
  }
54763
54822
 
54764
54823
  // src/bin.ts
@@ -55039,7 +55098,7 @@ async function main() {
55039
55098
  env: process.env,
55040
55099
  cwd: process.cwd(),
55041
55100
  writeFile: (p, c) => {
55042
- (0, import_node_fs14.mkdirSync)(import_node_path20.default.dirname(p), { recursive: true, mode: 448 });
55101
+ (0, import_node_fs14.mkdirSync)(import_node_path21.default.dirname(p), { recursive: true, mode: 448 });
55043
55102
  (0, import_node_fs14.writeFileSync)(p, c, { mode: 384 });
55044
55103
  },
55045
55104
  runPm2: pm2Runner,
@@ -55064,7 +55123,7 @@ async function main() {
55064
55123
  purgeSecret: purge,
55065
55124
  secretPath: agentCredentialPath(),
55066
55125
  tokenPath: operatorTokenPath(),
55067
- ecoPath: import_node_path20.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
55126
+ ecoPath: import_node_path21.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
55068
55127
  log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
55069
55128
  `)
55070
55129
  });
@@ -55085,7 +55144,7 @@ async function main() {
55085
55144
  purgeSecret: true,
55086
55145
  secretPath: agentCredentialPath(),
55087
55146
  tokenPath: operatorTokenPath(),
55088
- ecoPath: import_node_path20.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
55147
+ ecoPath: import_node_path21.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
55089
55148
  log
55090
55149
  });
55091
55150
  let codexOk = true;
@@ -55105,7 +55164,7 @@ async function main() {
55105
55164
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
55106
55165
  }
55107
55166
  try {
55108
- (0, import_node_fs14.rmSync)(import_node_path20.default.join(home, ".mrrlin"), { recursive: true, force: true });
55167
+ (0, import_node_fs14.rmSync)(import_node_path21.default.join(home, ".mrrlin"), { recursive: true, force: true });
55109
55168
  } catch {
55110
55169
  }
55111
55170
  log("removed ~/.mrrlin");
@@ -55146,7 +55205,7 @@ ${HELP_TEXT}`);
55146
55205
  }
55147
55206
  }
55148
55207
  function resolveSelfBinPath() {
55149
- return import_node_path19.default.resolve(process.argv[1] ?? process.execPath);
55208
+ return import_node_path20.default.resolve(process.argv[1] ?? process.execPath);
55150
55209
  }
55151
55210
  main().catch((error51) => {
55152
55211
  process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}