@mrrlin-dev/mcp 0.4.43 → 0.4.44

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 +295 -239
  2. package/package.json +2 -2
package/dist/bin.cjs CHANGED
@@ -7729,14 +7729,14 @@ var require_polyfills = __commonJS({
7729
7729
  fs10.fstatSync = statFixSync(fs10.fstatSync);
7730
7730
  fs10.lstatSync = statFixSync(fs10.lstatSync);
7731
7731
  if (fs10.chmod && !fs10.lchmod) {
7732
- fs10.lchmod = function(path22, mode, cb) {
7732
+ fs10.lchmod = function(path23, mode, cb) {
7733
7733
  if (cb) process.nextTick(cb);
7734
7734
  };
7735
7735
  fs10.lchmodSync = function() {
7736
7736
  };
7737
7737
  }
7738
7738
  if (fs10.chown && !fs10.lchown) {
7739
- fs10.lchown = function(path22, uid, gid, cb) {
7739
+ fs10.lchown = function(path23, uid, gid, cb) {
7740
7740
  if (cb) process.nextTick(cb);
7741
7741
  };
7742
7742
  fs10.lchownSync = function() {
@@ -7803,9 +7803,9 @@ var require_polyfills = __commonJS({
7803
7803
  };
7804
7804
  }(fs10.readSync);
7805
7805
  function patchLchmod(fs11) {
7806
- fs11.lchmod = function(path22, mode, callback) {
7806
+ fs11.lchmod = function(path23, mode, callback) {
7807
7807
  fs11.open(
7808
- path22,
7808
+ path23,
7809
7809
  constants2.O_WRONLY | constants2.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
- fs11.lchmodSync = function(path22, mode) {
7825
- var fd = fs11.openSync(path22, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
7824
+ fs11.lchmodSync = function(path23, mode) {
7825
+ var fd = fs11.openSync(path23, constants2.O_WRONLY | constants2.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(fs11) {
7845
7845
  if (constants2.hasOwnProperty("O_SYMLINK") && fs11.futimes) {
7846
- fs11.lutimes = function(path22, at, mt, cb) {
7847
- fs11.open(path22, constants2.O_SYMLINK, function(er, fd) {
7846
+ fs11.lutimes = function(path23, at, mt, cb) {
7847
+ fs11.open(path23, constants2.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
- fs11.lutimesSync = function(path22, at, mt) {
7860
- var fd = fs11.openSync(path22, constants2.O_SYMLINK);
7859
+ fs11.lutimesSync = function(path23, at, mt) {
7860
+ var fd = fs11.openSync(path23, constants2.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(path22, options) {
7979
- if (!(this instanceof ReadStream)) return new ReadStream(path22, options);
7978
+ function ReadStream(path23, options) {
7979
+ if (!(this instanceof ReadStream)) return new ReadStream(path23, options);
7980
7980
  Stream.call(this);
7981
7981
  var self = this;
7982
- this.path = path22;
7982
+ this.path = path23;
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(path22, options) {
8028
- if (!(this instanceof WriteStream)) return new WriteStream(path22, options);
8027
+ function WriteStream(path23, options) {
8028
+ if (!(this instanceof WriteStream)) return new WriteStream(path23, options);
8029
8029
  Stream.call(this);
8030
- this.path = path22;
8030
+ this.path = path23;
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
  fs11.createWriteStream = createWriteStream;
8171
8171
  var fs$readFile = fs11.readFile;
8172
8172
  fs11.readFile = readFile9;
8173
- function readFile9(path22, options, cb) {
8173
+ function readFile9(path23, options, cb) {
8174
8174
  if (typeof options === "function")
8175
8175
  cb = options, options = null;
8176
- return go$readFile(path22, options, cb);
8177
- function go$readFile(path23, options2, cb2, startTime) {
8178
- return fs$readFile(path23, options2, function(err) {
8176
+ return go$readFile(path23, options, cb);
8177
+ function go$readFile(path24, options2, cb2, startTime) {
8178
+ return fs$readFile(path24, options2, function(err) {
8179
8179
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8180
- enqueue([go$readFile, [path23, options2, cb2], err, startTime || Date.now(), Date.now()]);
8180
+ enqueue([go$readFile, [path24, 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 = fs11.writeFile;
8189
8189
  fs11.writeFile = writeFile5;
8190
- function writeFile5(path22, data, options, cb) {
8190
+ function writeFile5(path23, data, options, cb) {
8191
8191
  if (typeof options === "function")
8192
8192
  cb = options, options = null;
8193
- return go$writeFile(path22, data, options, cb);
8194
- function go$writeFile(path23, data2, options2, cb2, startTime) {
8195
- return fs$writeFile(path23, data2, options2, function(err) {
8193
+ return go$writeFile(path23, data, options, cb);
8194
+ function go$writeFile(path24, data2, options2, cb2, startTime) {
8195
+ return fs$writeFile(path24, data2, options2, function(err) {
8196
8196
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8197
- enqueue([go$writeFile, [path23, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8197
+ enqueue([go$writeFile, [path24, 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 = fs11.appendFile;
8206
8206
  if (fs$appendFile)
8207
8207
  fs11.appendFile = appendFile2;
8208
- function appendFile2(path22, data, options, cb) {
8208
+ function appendFile2(path23, data, options, cb) {
8209
8209
  if (typeof options === "function")
8210
8210
  cb = options, options = null;
8211
- return go$appendFile(path22, data, options, cb);
8212
- function go$appendFile(path23, data2, options2, cb2, startTime) {
8213
- return fs$appendFile(path23, data2, options2, function(err) {
8211
+ return go$appendFile(path23, data, options, cb);
8212
+ function go$appendFile(path24, data2, options2, cb2, startTime) {
8213
+ return fs$appendFile(path24, data2, options2, function(err) {
8214
8214
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8215
- enqueue([go$appendFile, [path23, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8215
+ enqueue([go$appendFile, [path24, 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 = fs11.readdir;
8244
8244
  fs11.readdir = readdir5;
8245
8245
  var noReaddirOptionVersions = /^v[0-5]\./;
8246
- function readdir5(path22, options, cb) {
8246
+ function readdir5(path23, 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(path23, options2, cb2, startTime) {
8250
- return fs$readdir(path23, fs$readdirCallback(
8251
- path23,
8249
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path24, options2, cb2, startTime) {
8250
+ return fs$readdir(path24, fs$readdirCallback(
8251
+ path24,
8252
8252
  options2,
8253
8253
  cb2,
8254
8254
  startTime
8255
8255
  ));
8256
- } : function go$readdir2(path23, options2, cb2, startTime) {
8257
- return fs$readdir(path23, options2, fs$readdirCallback(
8258
- path23,
8256
+ } : function go$readdir2(path24, options2, cb2, startTime) {
8257
+ return fs$readdir(path24, options2, fs$readdirCallback(
8258
+ path24,
8259
8259
  options2,
8260
8260
  cb2,
8261
8261
  startTime
8262
8262
  ));
8263
8263
  };
8264
- return go$readdir(path22, options, cb);
8265
- function fs$readdirCallback(path23, options2, cb2, startTime) {
8264
+ return go$readdir(path23, options, cb);
8265
+ function fs$readdirCallback(path24, 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
- [path23, options2, cb2],
8270
+ [path24, 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(path22, options) {
8341
+ function ReadStream(path23, 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(path22, options) {
8361
+ function WriteStream(path23, 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 createReadStream2(path22, options) {
8380
- return new fs11.ReadStream(path22, options);
8379
+ function createReadStream2(path23, options) {
8380
+ return new fs11.ReadStream(path23, options);
8381
8381
  }
8382
- function createWriteStream(path22, options) {
8383
- return new fs11.WriteStream(path22, options);
8382
+ function createWriteStream(path23, options) {
8383
+ return new fs11.WriteStream(path23, options);
8384
8384
  }
8385
8385
  var fs$open = fs11.open;
8386
8386
  fs11.open = open;
8387
- function open(path22, flags, mode, cb) {
8387
+ function open(path23, flags, mode, cb) {
8388
8388
  if (typeof mode === "function")
8389
8389
  cb = mode, mode = null;
8390
- return go$open(path22, flags, mode, cb);
8391
- function go$open(path23, flags2, mode2, cb2, startTime) {
8392
- return fs$open(path23, flags2, mode2, function(err, fd) {
8390
+ return go$open(path23, flags, mode, cb);
8391
+ function go$open(path24, flags2, mode2, cb2, startTime) {
8392
+ return fs$open(path24, flags2, mode2, function(err, fd) {
8393
8393
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
8394
- enqueue([go$open, [path23, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
8394
+ enqueue([go$open, [path24, 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 path22 = require("path");
8923
+ var path23 = require("path");
8924
8924
  var fs10 = 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, path22.resolve(file2));
8934
+ return callback(null, path23.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 path22 = dijkstra.find_path(graph.map, "start", "end");
10798
+ const path23 = dijkstra.find_path(graph.map, "start", "end");
10799
10799
  const optimizedSegs = [];
10800
- for (let i = 1; i < path22.length - 1; i++) {
10801
- optimizedSegs.push(graph.table[path22[i]].node);
10800
+ for (let i = 1; i < path23.length - 1; i++) {
10801
+ optimizedSegs.push(graph.table[path23[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(path22, qrData, options, cb) {
13278
+ exports2.renderToFile = function renderToFile(path23, 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 = fs10.createWriteStream(path22);
13289
+ const stream = fs10.createWriteStream(path23);
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(path22, qrData, options, cb) {
13351
+ exports2.renderToFile = function renderToFile(path23, qrData, options, cb) {
13352
13352
  if (typeof cb === "undefined") {
13353
13353
  cb = options;
13354
13354
  options = void 0;
13355
13355
  }
13356
13356
  const fs10 = require("fs");
13357
13357
  const utf8 = exports2.render(qrData, options);
13358
- fs10.writeFile(path22, utf8, cb);
13358
+ fs10.writeFile(path23, 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 path22 = "";
13479
+ let path23 = "";
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
- path22 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
13490
+ path23 += 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
- path22 += svgCmd("h", lineLength);
13495
+ path23 += svgCmd("h", lineLength);
13496
13496
  lineLength = 0;
13497
13497
  }
13498
13498
  } else {
13499
13499
  moveBy++;
13500
13500
  }
13501
13501
  }
13502
- return path22;
13502
+ return path23;
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 path22 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
13510
+ const path23 = "<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 + path22 + "</svg>\n";
13513
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path23 + "</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(path22, qrData, options, cb) {
13527
+ exports2.renderToFile = function renderToFile(path23, 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 fs10 = 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
- fs10.writeFile(path22, xmlStr, cb);
13535
+ fs10.writeFile(path23, 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(path22) {
13694
- return path22.slice((path22.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
13693
+ function getTypeFromFilename(path23) {
13694
+ return path23.slice((path23.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(path22, text, opts, cb) {
13759
- if (typeof path22 !== "string" || !(typeof text === "string" || typeof text === "object")) {
13758
+ exports2.toFile = function toFile(path23, text, opts, cb) {
13759
+ if (typeof path23 !== "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(path22);
13766
+ const type = params.opts.type || getTypeFromFilename(path23);
13767
13767
  const renderer = getRendererFromType(type);
13768
- const renderToFile = renderer.renderToFile.bind(null, path22);
13768
+ const renderToFile = renderer.renderToFile.bind(null, path23);
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(path22) {
16987
- let input = path22;
16986
+ function removeDotSegments(path23) {
16987
+ let input = path23;
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 [path22, query] = wsComponent.resourceName.split("?");
17240
- wsComponent.path = path22 && path22 !== "/" ? path22 : void 0;
17239
+ const [path23, query] = wsComponent.resourceName.split("?");
17240
+ wsComponent.path = path23 && path23 !== "/" ? path23 : 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_path34 = __toESM(require("node:path"), 1);
20647
+ var import_node_path35 = __toESM(require("node:path"), 1);
20648
20648
  var import_node_child_process18 = require("node:child_process");
20649
20649
  var import_node_fs22 = require("node:fs");
20650
- var import_node_os16 = require("node:os");
20651
- var import_node_path35 = __toESM(require("node:path"), 1);
20650
+ var import_node_os17 = require("node:os");
20651
+ var import_node_path36 = __toESM(require("node:path"), 1);
20652
20652
 
20653
20653
  // src/install-codex.ts
20654
20654
  var import_promises = __toESM(require("node:fs/promises"), 1);
@@ -21556,8 +21556,8 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
21556
21556
  // src/director-bridge.ts
21557
21557
  var import_node_fs20 = __toESM(require("node:fs"), 1);
21558
21558
  var import_node_http = __toESM(require("node:http"), 1);
21559
- var import_node_os12 = __toESM(require("node:os"), 1);
21560
- var import_node_path27 = __toESM(require("node:path"), 1);
21559
+ var import_node_os13 = __toESM(require("node:os"), 1);
21560
+ var import_node_path28 = __toESM(require("node:path"), 1);
21561
21561
  var import_node_child_process15 = require("node:child_process");
21562
21562
  var import_node_crypto11 = __toESM(require("node:crypto"), 1);
21563
21563
 
@@ -23051,10 +23051,10 @@ function mergeDefs(...defs) {
23051
23051
  function cloneDef(schema) {
23052
23052
  return mergeDefs(schema._zod.def);
23053
23053
  }
23054
- function getElementAtPath(obj, path22) {
23055
- if (!path22)
23054
+ function getElementAtPath(obj, path23) {
23055
+ if (!path23)
23056
23056
  return obj;
23057
- return path22.reduce((acc, key) => acc?.[key], obj);
23057
+ return path23.reduce((acc, key) => acc?.[key], obj);
23058
23058
  }
23059
23059
  function promiseAllObject(promisesObj) {
23060
23060
  const keys = Object.keys(promisesObj);
@@ -23463,11 +23463,11 @@ function explicitlyAborted(x, startIndex = 0) {
23463
23463
  }
23464
23464
  return false;
23465
23465
  }
23466
- function prefixIssues(path22, issues) {
23466
+ function prefixIssues(path23, issues) {
23467
23467
  return issues.map((iss) => {
23468
23468
  var _a3;
23469
23469
  (_a3 = iss).path ?? (_a3.path = []);
23470
- iss.path.unshift(path22);
23470
+ iss.path.unshift(path23);
23471
23471
  return iss;
23472
23472
  });
23473
23473
  }
@@ -23614,16 +23614,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
23614
23614
  }
23615
23615
  function formatError(error51, mapper = (issue2) => issue2.message) {
23616
23616
  const fieldErrors = { _errors: [] };
23617
- const processError = (error52, path22 = []) => {
23617
+ const processError = (error52, path23 = []) => {
23618
23618
  for (const issue2 of error52.issues) {
23619
23619
  if (issue2.code === "invalid_union" && issue2.errors.length) {
23620
- issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
23620
+ issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
23621
23621
  } else if (issue2.code === "invalid_key") {
23622
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
23622
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
23623
23623
  } else if (issue2.code === "invalid_element") {
23624
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
23624
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
23625
23625
  } else {
23626
- const fullpath = [...path22, ...issue2.path];
23626
+ const fullpath = [...path23, ...issue2.path];
23627
23627
  if (fullpath.length === 0) {
23628
23628
  fieldErrors._errors.push(mapper(issue2));
23629
23629
  } else {
@@ -23650,17 +23650,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
23650
23650
  }
23651
23651
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
23652
23652
  const result = { errors: [] };
23653
- const processError = (error52, path22 = []) => {
23653
+ const processError = (error52, path23 = []) => {
23654
23654
  var _a3, _b;
23655
23655
  for (const issue2 of error52.issues) {
23656
23656
  if (issue2.code === "invalid_union" && issue2.errors.length) {
23657
- issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
23657
+ issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
23658
23658
  } else if (issue2.code === "invalid_key") {
23659
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
23659
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
23660
23660
  } else if (issue2.code === "invalid_element") {
23661
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
23661
+ processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
23662
23662
  } else {
23663
- const fullpath = [...path22, ...issue2.path];
23663
+ const fullpath = [...path23, ...issue2.path];
23664
23664
  if (fullpath.length === 0) {
23665
23665
  result.errors.push(mapper(issue2));
23666
23666
  continue;
@@ -23692,8 +23692,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
23692
23692
  }
23693
23693
  function toDotPath(_path) {
23694
23694
  const segs = [];
23695
- const path22 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23696
- for (const seg of path22) {
23695
+ const path23 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
23696
+ for (const seg of path23) {
23697
23697
  if (typeof seg === "number")
23698
23698
  segs.push(`[${seg}]`);
23699
23699
  else if (typeof seg === "symbol")
@@ -36385,13 +36385,13 @@ function resolveRef(ref, ctx) {
36385
36385
  if (!ref.startsWith("#")) {
36386
36386
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
36387
36387
  }
36388
- const path22 = ref.slice(1).split("/").filter(Boolean);
36389
- if (path22.length === 0) {
36388
+ const path23 = ref.slice(1).split("/").filter(Boolean);
36389
+ if (path23.length === 0) {
36390
36390
  return ctx.rootSchema;
36391
36391
  }
36392
36392
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
36393
- if (path22[0] === defsKey) {
36394
- const key = path22[1];
36393
+ if (path23[0] === defsKey) {
36394
+ const key = path23[1];
36395
36395
  if (!key || !ctx.defs[key]) {
36396
36396
  throw new Error(`Reference not found: ${ref}`);
36397
36397
  }
@@ -40662,18 +40662,18 @@ function createMrrlinClient(config2) {
40662
40662
  const customFetch = config2.fetch ?? globalThis.fetch;
40663
40663
  const baseUrl = config2.baseUrl.replace(/\/$/, "");
40664
40664
  const token = config2.token;
40665
- async function request(path22, init) {
40665
+ async function request(path23, init) {
40666
40666
  const method = init?.method ?? "GET";
40667
40667
  const headers = new Headers(init?.headers ?? {});
40668
40668
  if (token && !headers.has("authorization")) {
40669
40669
  headers.set("authorization", `Bearer ${token}`);
40670
40670
  }
40671
- const response = await customFetch(`${baseUrl}${path22}`, { ...init, headers });
40671
+ const response = await customFetch(`${baseUrl}${path23}`, { ...init, headers });
40672
40672
  if (!response.ok) {
40673
40673
  const body = await response.text();
40674
40674
  let code = `HTTP_${response.status}`;
40675
40675
  let violations = null;
40676
- let message = `Mrrlin API ${method} ${path22} failed: ${response.status}`;
40676
+ let message = `Mrrlin API ${method} ${path23} failed: ${response.status}`;
40677
40677
  try {
40678
40678
  const parsed = JSON.parse(body);
40679
40679
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -40693,7 +40693,7 @@ function createMrrlinClient(config2) {
40693
40693
  throw new MrrlinApiError({
40694
40694
  code,
40695
40695
  method,
40696
- path: path22,
40696
+ path: path23,
40697
40697
  responseBody: body,
40698
40698
  status: response.status,
40699
40699
  violations,
@@ -40702,18 +40702,18 @@ function createMrrlinClient(config2) {
40702
40702
  }
40703
40703
  return response.json();
40704
40704
  }
40705
- async function requestText(path22, init) {
40705
+ async function requestText(path23, init) {
40706
40706
  const method = init?.method ?? "GET";
40707
40707
  const headers = new Headers(init?.headers ?? {});
40708
40708
  if (token && !headers.has("authorization")) {
40709
40709
  headers.set("authorization", `Bearer ${token}`);
40710
40710
  }
40711
- const response = await customFetch(`${baseUrl}${path22}`, { ...init, headers });
40711
+ const response = await customFetch(`${baseUrl}${path23}`, { ...init, headers });
40712
40712
  if (!response.ok) {
40713
40713
  const body = await response.text();
40714
40714
  let code = `HTTP_${response.status}`;
40715
40715
  let violations = null;
40716
- let message = `Mrrlin API ${method} ${path22} failed: ${response.status}`;
40716
+ let message = `Mrrlin API ${method} ${path23} failed: ${response.status}`;
40717
40717
  try {
40718
40718
  const parsed = JSON.parse(body);
40719
40719
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -40733,7 +40733,7 @@ function createMrrlinClient(config2) {
40733
40733
  throw new MrrlinApiError({
40734
40734
  code,
40735
40735
  method,
40736
- path: path22,
40736
+ path: path23,
40737
40737
  responseBody: body,
40738
40738
  status: response.status,
40739
40739
  violations,
@@ -40998,16 +40998,16 @@ function createMrrlinClient(config2) {
40998
40998
  // rejected against the first, MrrlinTask[]-only overload) -- the `any` here is contained to
40999
40999
  // this one implementation signature; MrrlinClient's declared overloads keep callers precise.
41000
41000
  async listTasks(projectSlug, filters = {}, options) {
41001
- const path22 = buildTaskListPath(projectSlug, filters, options?.view);
41002
- const body = await request(path22);
41001
+ const path23 = buildTaskListPath(projectSlug, filters, options?.view);
41002
+ const body = await request(path23);
41003
41003
  if (options?.view === "summary") {
41004
41004
  return taskSummaryListResponseSchema.parse(body).data;
41005
41005
  }
41006
41006
  return taskListResponseSchema.parse(body).data;
41007
41007
  },
41008
41008
  async listTaskSummaries(projectSlug, filters = {}) {
41009
- const path22 = buildTaskListPath(projectSlug, filters, "summary");
41010
- const body = await request(path22);
41009
+ const path23 = buildTaskListPath(projectSlug, filters, "summary");
41010
+ const body = await request(path23);
41011
41011
  return taskSummaryListResponseSchema.parse(body).data;
41012
41012
  },
41013
41013
  async listTaxonomy(projectSlug) {
@@ -41015,22 +41015,22 @@ function createMrrlinClient(config2) {
41015
41015
  return taxonomyListResponseSchema.parse(body).data;
41016
41016
  },
41017
41017
  async listWikiPages(projectSlug, filters = {}) {
41018
- const path22 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
41018
+ const path23 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
41019
41019
  folder: filters.folder,
41020
41020
  q: filters.q,
41021
41021
  taskId: filters.taskId
41022
41022
  });
41023
- const body = await request(path22);
41023
+ const body = await request(path23);
41024
41024
  return wikiPageListResponseSchema.parse(body).data;
41025
41025
  },
41026
41026
  async searchWikiPages(projectSlug, query) {
41027
- const path22 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
41027
+ const path23 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
41028
41028
  folder: query.folder,
41029
41029
  limit: query.limit === void 0 ? void 0 : String(query.limit),
41030
41030
  pathPrefix: query.pathPrefix,
41031
41031
  q: query.q
41032
41032
  });
41033
- const body = await request(path22);
41033
+ const body = await request(path23);
41034
41034
  return wikiPageSearchResponseSchema.parse(body).data;
41035
41035
  },
41036
41036
  async updatePlan(projectSlug, planId, patch) {
@@ -42295,7 +42295,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
42295
42295
  }
42296
42296
 
42297
42297
  // src/_generated/version.ts
42298
- var PKG_VERSION = "0.4.43";
42298
+ var PKG_VERSION = "0.4.44";
42299
42299
 
42300
42300
  // src/api-base-url-migrate.ts
42301
42301
  var import_node_fs3 = __toESM(require("node:fs"), 1);
@@ -44369,7 +44369,7 @@ function reviserIdentityInstructions(taskId, title) {
44369
44369
  function gateCallRecorder(args) {
44370
44370
  let round = 0;
44371
44371
  let headSinceArbiter = false;
44372
- return function record2(role, persona, agentId, startedAt, result) {
44372
+ return function record2(role, persona, agentId, startedAt, result, attribution) {
44373
44373
  if (role === "head" && !headSinceArbiter) {
44374
44374
  round += 1;
44375
44375
  headSinceArbiter = true;
@@ -44384,7 +44384,15 @@ function gateCallRecorder(args) {
44384
44384
  role,
44385
44385
  persona,
44386
44386
  agentId,
44387
- provider: args.provider,
44387
+ // `?? null` on the override's own value, not on the whole expression: an absent override must
44388
+ // still fall through to the factory's provider, and only a PRESENT one means "this call did
44389
+ // not run on the seat". The coalesce is future-proofing for a JavaScript consumer of the same
44390
+ // module, NOT a hole in the type — `{ provider: string | null }` makes `{}` a compile error
44391
+ // today, and both call sites are hard-coded `{ provider: null }` lambdas in this file. It is
44392
+ // worth the character because `provider: undefined` is not a missing provider, it is a key
44393
+ // `JSON.stringify` DROPS, so such a line would fail `gateCallRecordSchema` on ingest with
44394
+ // nothing at the write site to show why.
44395
+ provider: attribution ? attribution.provider ?? null : args.provider,
44388
44396
  inputTokens: usage?.inputTokens ?? null,
44389
44397
  cachedInputTokens: usage?.cachedInputTokens ?? null,
44390
44398
  cacheWriteInputTokens: usage?.cacheWriteInputTokens ?? null,
@@ -44451,6 +44459,10 @@ function buildSpecGateDeps(args) {
44451
44459
  return {
44452
44460
  rounds,
44453
44461
  maxHeadCalls,
44462
+ // The recorder a multi-LLM panel dispatches through when it replaces `runHead` below — see
44463
+ // GateHeadCallRecorder. `{ provider: null }` because a panel head runs on a pool agent, not on
44464
+ // this factory's seat.
44465
+ recordHeadCall: (persona, agentId, startedAt, result) => recordCost("head", persona, agentId, startedAt, result, { provider: null }),
44454
44466
  async consensusEnabled() {
44455
44467
  const config2 = await client.getConsensusConfig(projectSlug);
44456
44468
  return config2.consensusEnabled;
@@ -44624,6 +44636,10 @@ function buildCodeGateDeps(args) {
44624
44636
  rounds,
44625
44637
  maxHeadCalls,
44626
44638
  heads,
44639
+ // This is the gate that actually gets a panel today: tools.ts resolves one and calls
44640
+ // `applyActivePanel`, which replaces `runHead` below. Without this hook the panel's head calls
44641
+ // were recorded nowhere at all — see GateHeadCallRecorder.
44642
+ recordHeadCall: (persona, agentId, startedAt, result) => recordCost("head", persona, agentId, startedAt, result, { provider: null }),
44627
44643
  async consensusEnabled() {
44628
44644
  const config2 = await client.getConsensusConfig(projectSlug);
44629
44645
  return config2.consensusEnabled;
@@ -44901,8 +44917,8 @@ You revise a deliverable to address the accepted issues so it satisfies the acce
44901
44917
  function isRecord(v) {
44902
44918
  return v !== null && typeof v === "object";
44903
44919
  }
44904
- function resolvePath(root, path22) {
44905
- const parts = path22.split(".");
44920
+ function resolvePath(root, path23) {
44921
+ const parts = path23.split(".");
44906
44922
  let cur = root;
44907
44923
  for (let i = 0; i < parts.length - 1; i += 1) {
44908
44924
  const part = parts[i];
@@ -44970,9 +44986,9 @@ async function gate(artifact, prose, ctx) {
44970
44986
  return { ok: true, gated: true, artifact: withheldExcerptClone(artifact) };
44971
44987
  }
44972
44988
  const maskedClone = typeof structuredClone === "function" ? structuredClone(artifact) : JSON.parse(JSON.stringify(artifact));
44973
- for (const { path: path22, masked } of fields) {
44974
- const target = resolvePath(maskedClone, path22);
44975
- if (!target) throw new Error(`pii-gate: path "${path22}" failed to resolve on the clone after validating on the original`);
44989
+ for (const { path: path23, masked } of fields) {
44990
+ const target = resolvePath(maskedClone, path23);
44991
+ if (!target) throw new Error(`pii-gate: path "${path23}" failed to resolve on the clone after validating on the original`);
44976
44992
  target.parent[target.key] = masked;
44977
44993
  }
44978
44994
  return { ok: true, gated: false, artifact: maskedClone };
@@ -44988,15 +45004,15 @@ var cache = /* @__PURE__ */ new Map();
44988
45004
  function resolveInstallationId(stateDir) {
44989
45005
  const cached2 = cache.get(stateDir);
44990
45006
  if (cached2 !== void 0) return cached2;
44991
- const path22 = (0, import_node_path14.join)(stateDir, FILE_NAME);
45007
+ const path23 = (0, import_node_path14.join)(stateDir, FILE_NAME);
44992
45008
  let id;
44993
45009
  try {
44994
- id = (0, import_node_fs8.readFileSync)(path22, "utf8").trim();
45010
+ id = (0, import_node_fs8.readFileSync)(path23, "utf8").trim();
44995
45011
  if (!UUID.test(id)) throw new Error("unusable");
44996
45012
  } catch {
44997
45013
  id = (0, import_node_crypto5.randomUUID)();
44998
- (0, import_node_fs8.mkdirSync)((0, import_node_path14.dirname)(path22), { recursive: true });
44999
- (0, import_node_fs8.writeFileSync)(path22, `${id}
45014
+ (0, import_node_fs8.mkdirSync)((0, import_node_path14.dirname)(path23), { recursive: true });
45015
+ (0, import_node_fs8.writeFileSync)(path23, `${id}
45000
45016
  `, "utf8");
45001
45017
  }
45002
45018
  cache.set(stateDir, id);
@@ -47449,8 +47465,8 @@ function newArtifactId() {
47449
47465
  return `EA-${import_node_crypto7.default.randomUUID()}`;
47450
47466
  }
47451
47467
  var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
47452
- function isBlastRadiusFloorPath(path22) {
47453
- return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path22));
47468
+ function isBlastRadiusFloorPath(path23) {
47469
+ return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path23));
47454
47470
  }
47455
47471
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process12.execFile);
47456
47472
  async function defaultListRunDiffPaths(opts) {
@@ -49744,6 +49760,15 @@ async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJo
49744
49760
  }
49745
49761
  }
49746
49762
 
49763
+ // src/state-dir.ts
49764
+ var import_node_os8 = __toESM(require("node:os"), 1);
49765
+ var import_node_path20 = __toESM(require("node:path"), 1);
49766
+ function resolveStateDir(env = process.env) {
49767
+ const codexHome = env.CODEX_HOME;
49768
+ if (codexHome) return import_node_path20.default.join(codexHome, "mrrlin", "director-bridge");
49769
+ return import_node_path20.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
49770
+ }
49771
+
49747
49772
  // src/consensus/deliverable-gate.ts
49748
49773
  async function runDeliverableGate(target, deps) {
49749
49774
  if (!await deps.consensusEnabled()) return { outcome: "SKIPPED" };
@@ -49998,14 +50023,14 @@ function agentIdleMs(provider) {
49998
50023
 
49999
50024
  // src/operator-token.ts
50000
50025
  var import_node_fs12 = require("node:fs");
50001
- var import_node_os8 = __toESM(require("node:os"), 1);
50002
- var import_node_path20 = __toESM(require("node:path"), 1);
50026
+ var import_node_os9 = __toESM(require("node:os"), 1);
50027
+ var import_node_path21 = __toESM(require("node:path"), 1);
50003
50028
  function operatorDir() {
50004
- const base = process.env.CODEX_HOME ? import_node_path20.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path20.default.join(import_node_os8.default.homedir(), ".mrrlin");
50029
+ const base = process.env.CODEX_HOME ? import_node_path21.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path21.default.join(import_node_os9.default.homedir(), ".mrrlin");
50005
50030
  return base;
50006
50031
  }
50007
50032
  function operatorTokenPath() {
50008
- return import_node_path20.default.join(operatorDir(), "operator-token");
50033
+ return import_node_path21.default.join(operatorDir(), "operator-token");
50009
50034
  }
50010
50035
  function readOperatorToken() {
50011
50036
  try {
@@ -50022,7 +50047,7 @@ function persistOperatorToken(token) {
50022
50047
  `, { encoding: "utf8", mode: 384 });
50023
50048
  }
50024
50049
  function agentCredentialPath() {
50025
- return import_node_path20.default.join(operatorDir(), "agent-credential");
50050
+ return import_node_path21.default.join(operatorDir(), "agent-credential");
50026
50051
  }
50027
50052
  function persistAgentSecret(secret) {
50028
50053
  const dir = operatorDir();
@@ -50043,9 +50068,9 @@ function readAgentSecret() {
50043
50068
 
50044
50069
  // src/thread-index.ts
50045
50070
  var import_node_fs13 = require("node:fs");
50046
- var import_node_path21 = __toESM(require("node:path"), 1);
50071
+ var import_node_path22 = __toESM(require("node:path"), 1);
50047
50072
  function threadIndexPath(stateDir) {
50048
- return import_node_path21.default.join(stateDir, "threads.json");
50073
+ return import_node_path22.default.join(stateDir, "threads.json");
50049
50074
  }
50050
50075
  function loadThreadIndex(stateDir, ttlMs, now) {
50051
50076
  const result = /* @__PURE__ */ new Map();
@@ -50212,8 +50237,8 @@ function createToolBusyClock(opts) {
50212
50237
  // src/worker-token.ts
50213
50238
  var import_node_crypto10 = require("node:crypto");
50214
50239
  var import_node_fs14 = require("node:fs");
50215
- var import_node_os9 = __toESM(require("node:os"), 1);
50216
- var import_node_path22 = __toESM(require("node:path"), 1);
50240
+ var import_node_os10 = __toESM(require("node:os"), 1);
50241
+ var import_node_path23 = __toESM(require("node:path"), 1);
50217
50242
  var DEFAULT_WORKER_PORT = 8792;
50218
50243
  function workerPort() {
50219
50244
  const raw = process.env.MRRLIN_WORKER_PORT;
@@ -50222,11 +50247,11 @@ function workerPort() {
50222
50247
  return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
50223
50248
  }
50224
50249
  function workerDir() {
50225
- const base = process.env.CODEX_HOME ? import_node_path22.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path22.default.join(import_node_os9.default.homedir(), ".mrrlin");
50226
- return import_node_path22.default.join(base, "worker");
50250
+ const base = process.env.CODEX_HOME ? import_node_path23.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path23.default.join(import_node_os10.default.homedir(), ".mrrlin");
50251
+ return import_node_path23.default.join(base, "worker");
50227
50252
  }
50228
50253
  function workerTokenPath() {
50229
- return import_node_path22.default.join(workerDir(), "token");
50254
+ return import_node_path23.default.join(workerDir(), "token");
50230
50255
  }
50231
50256
  function readWorkerToken() {
50232
50257
  try {
@@ -50250,8 +50275,8 @@ function readOrCreateWorkerToken() {
50250
50275
  // src/remote-phone-relay.ts
50251
50276
  var import_node_events2 = require("node:events");
50252
50277
  var import_node_fs15 = require("node:fs");
50253
- var import_node_os10 = require("node:os");
50254
- var import_node_path23 = require("node:path");
50278
+ var import_node_os11 = require("node:os");
50279
+ var import_node_path24 = require("node:path");
50255
50280
 
50256
50281
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
50257
50282
  var nc = __toESM(require("node:crypto"), 1);
@@ -53822,9 +53847,9 @@ var DirectorRelay = class {
53822
53847
 
53823
53848
  // src/remote-phone-relay.ts
53824
53849
  function loadOrCreateAgentDeviceKey() {
53825
- const path22 = (0, import_node_path23.join)((0, import_node_os10.homedir)(), ".mrrlin", "agent-device-key");
53850
+ const path23 = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin", "agent-device-key");
53826
53851
  try {
53827
- const raw = JSON.parse((0, import_node_fs15.readFileSync)(path22, "utf8"));
53852
+ const raw = JSON.parse((0, import_node_fs15.readFileSync)(path23, "utf8"));
53828
53853
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
53829
53854
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
53830
53855
  }
@@ -53832,9 +53857,9 @@ function loadOrCreateAgentDeviceKey() {
53832
53857
  }
53833
53858
  const kp = generateIdentityKeyPair();
53834
53859
  try {
53835
- (0, import_node_fs15.mkdirSync)((0, import_node_path23.join)((0, import_node_os10.homedir)(), ".mrrlin"), { recursive: true });
53860
+ (0, import_node_fs15.mkdirSync)((0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin"), { recursive: true });
53836
53861
  (0, import_node_fs15.writeFileSync)(
53837
- path22,
53862
+ path23,
53838
53863
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
53839
53864
  { mode: 384 }
53840
53865
  );
@@ -53842,7 +53867,7 @@ function loadOrCreateAgentDeviceKey() {
53842
53867
  }
53843
53868
  return kp;
53844
53869
  }
53845
- var AGENT_PAIRING_PATH = (0, import_node_path23.join)((0, import_node_os10.homedir)(), ".mrrlin", "agent-pairing.json");
53870
+ var AGENT_PAIRING_PATH = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin", "agent-pairing.json");
53846
53871
  function loadAgentPairing() {
53847
53872
  try {
53848
53873
  const raw = JSON.parse((0, import_node_fs15.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
@@ -53860,7 +53885,7 @@ function loadAgentPairing() {
53860
53885
  }
53861
53886
  function saveAgentPairing(record2) {
53862
53887
  try {
53863
- (0, import_node_fs15.mkdirSync)((0, import_node_path23.join)((0, import_node_os10.homedir)(), ".mrrlin"), { recursive: true });
53888
+ (0, import_node_fs15.mkdirSync)((0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin"), { recursive: true });
53864
53889
  (0, import_node_fs15.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
53865
53890
  } catch {
53866
53891
  }
@@ -54040,11 +54065,11 @@ async function renderPairingQrSvg(payload) {
54040
54065
 
54041
54066
  // src/checkout-registry.ts
54042
54067
  var import_node_fs16 = require("node:fs");
54043
- var import_node_path24 = require("node:path");
54068
+ var import_node_path25 = require("node:path");
54044
54069
  var CheckoutRegistry = class {
54045
54070
  file;
54046
54071
  constructor(stateDir) {
54047
- this.file = (0, import_node_path24.join)(stateDir, "checkouts.json");
54072
+ this.file = (0, import_node_path25.join)(stateDir, "checkouts.json");
54048
54073
  (0, import_node_fs16.mkdirSync)(stateDir, { recursive: true });
54049
54074
  }
54050
54075
  read() {
@@ -54058,9 +54083,9 @@ var CheckoutRegistry = class {
54058
54083
  get(slug) {
54059
54084
  return this.read()[slug] ?? null;
54060
54085
  }
54061
- confirm(slug, path22, now) {
54086
+ confirm(slug, path23, now) {
54062
54087
  const all = this.read();
54063
- all[slug] = { path: path22, confirmedAt: now };
54088
+ all[slug] = { path: path23, confirmedAt: now };
54064
54089
  (0, import_node_fs16.writeFileSync)(this.file, JSON.stringify(all, null, 2));
54065
54090
  }
54066
54091
  };
@@ -54410,7 +54435,7 @@ function extractVerificationSection(markdown) {
54410
54435
  // src/director-reseed.ts
54411
54436
  var import_node_fs18 = require("node:fs");
54412
54437
  var import_node_readline = require("node:readline");
54413
- var import_node_path25 = require("node:path");
54438
+ var import_node_path26 = require("node:path");
54414
54439
  function estimateTokens(s) {
54415
54440
  return Buffer.byteLength(s, "utf8");
54416
54441
  }
@@ -54542,7 +54567,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
54542
54567
  const lines2 = [];
54543
54568
  let missingFiles = 0;
54544
54569
  for (const f of files) {
54545
- const filePath = (0, import_node_path25.join)(logsDir, f);
54570
+ const filePath = (0, import_node_path26.join)(logsDir, f);
54546
54571
  try {
54547
54572
  const stream = (0, import_node_fs18.createReadStream)(filePath, { encoding: "utf8" });
54548
54573
  const rl = (0, import_node_readline.createInterface)({ input: stream, crlfDelay: Infinity });
@@ -54569,11 +54594,11 @@ async function readSessionRows(logsDir, files, sessionIds) {
54569
54594
 
54570
54595
  // src/external-agents-scrub.ts
54571
54596
  var import_node_fs19 = __toESM(require("node:fs"), 1);
54572
- var import_node_os11 = __toESM(require("node:os"), 1);
54573
- var import_node_path26 = __toESM(require("node:path"), 1);
54597
+ var import_node_os12 = __toESM(require("node:os"), 1);
54598
+ var import_node_path27 = __toESM(require("node:path"), 1);
54574
54599
  var REDACTION = "[REDACTED]";
54575
54600
  var SHORT_VALUE_THRESHOLD = 8;
54576
- var KEYS_ENV_PATH = () => import_node_path26.default.join(import_node_os11.default.homedir(), ".local", "state", "external-agents", "keys.env");
54601
+ var KEYS_ENV_PATH = () => import_node_path27.default.join(import_node_os12.default.homedir(), ".local", "state", "external-agents", "keys.env");
54577
54602
  var keysEnvCache = null;
54578
54603
  function readKeysEnv() {
54579
54604
  const filePath = KEYS_ENV_PATH();
@@ -55017,9 +55042,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
55017
55042
  return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
55018
55043
  }
55019
55044
  function readCodexFallbackModels() {
55020
- const codexHome = process.env.CODEX_HOME?.trim() || import_node_path27.default.join(import_node_os12.default.homedir(), ".codex");
55045
+ const codexHome = process.env.CODEX_HOME?.trim() || import_node_path28.default.join(import_node_os13.default.homedir(), ".codex");
55021
55046
  const models = /* @__PURE__ */ new Map();
55022
- const cachePath = import_node_path27.default.join(codexHome, "models_cache.json");
55047
+ const cachePath = import_node_path28.default.join(codexHome, "models_cache.json");
55023
55048
  const cacheRaw = readTextIfExists(cachePath);
55024
55049
  if (cacheRaw) {
55025
55050
  try {
@@ -55069,7 +55094,7 @@ function readCodexFallbackModels() {
55069
55094
  );
55070
55095
  }
55071
55096
  }
55072
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path27.default.join(codexHome, "config.toml"))) {
55097
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path28.default.join(codexHome, "config.toml"))) {
55073
55098
  addBridgeModel(
55074
55099
  models,
55075
55100
  mapBridgeModel({
@@ -55083,11 +55108,11 @@ function readCodexFallbackModels() {
55083
55108
  })
55084
55109
  );
55085
55110
  }
55086
- const automationsDir = import_node_path27.default.join(codexHome, "automations");
55111
+ const automationsDir = import_node_path28.default.join(codexHome, "automations");
55087
55112
  try {
55088
55113
  for (const entry of import_node_fs20.default.readdirSync(automationsDir, { withFileTypes: true })) {
55089
55114
  if (!entry.isDirectory()) continue;
55090
- for (const slug of readKnownGptSlugsFromTomlFile(import_node_path27.default.join(automationsDir, entry.name, "automation.toml"))) {
55115
+ for (const slug of readKnownGptSlugsFromTomlFile(import_node_path28.default.join(automationsDir, entry.name, "automation.toml"))) {
55091
55116
  addBridgeModel(
55092
55117
  models,
55093
55118
  mapBridgeModel({
@@ -55113,7 +55138,7 @@ function selfUpdateInboxItemId(offeredVersion) {
55113
55138
  return `II-MCPUPD-${offeredVersion.replace(/[^A-Za-z0-9._-]/g, "-")}-${hash3}`;
55114
55139
  }
55115
55140
  function neutralCheckoutCwd(stateDir) {
55116
- const dir = import_node_path27.default.join(stateDir, "no-checkout");
55141
+ const dir = import_node_path28.default.join(stateDir, "no-checkout");
55117
55142
  try {
55118
55143
  import_node_fs20.default.mkdirSync(dir, { recursive: true });
55119
55144
  } catch {
@@ -55663,8 +55688,7 @@ async function runOrphanWorktreeSweep(client, opts) {
55663
55688
  }
55664
55689
  }
55665
55690
  function readStateDir() {
55666
- if (process.env.CODEX_HOME) return import_node_path27.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
55667
- return import_node_path27.default.join(import_node_os12.default.homedir(), ".mrrlin", "director-bridge");
55691
+ return resolveStateDir(process.env);
55668
55692
  }
55669
55693
  function readAllowedOrigins() {
55670
55694
  const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
@@ -56100,7 +56124,7 @@ function createBridgeMessageHandler(deps) {
56100
56124
  sendForSpan({ type: "checkout-state", ok: false, error: { code: "invalid_input", fields: { projectSlug: "required" } } });
56101
56125
  return;
56102
56126
  }
56103
- const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os12.default.hostname());
56127
+ const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os13.default.hostname());
56104
56128
  if (!state) {
56105
56129
  sendForSpan({ type: "checkout-state", ok: false, error: { code: "checkout_missing" } });
56106
56130
  return;
@@ -56132,7 +56156,7 @@ function createBridgeMessageHandler(deps) {
56132
56156
  const result = registerCheckout(
56133
56157
  deps.checkoutRegistry,
56134
56158
  { projectSlug, path: typeof msg.path === "string" ? msg.path : "", repo },
56135
- import_node_os12.default.hostname()
56159
+ import_node_os13.default.hostname()
56136
56160
  );
56137
56161
  if (!result.ok) {
56138
56162
  sendForSpan({ type: "checkout-register", ok: false, error: { code: result.code, detail: result.detail } });
@@ -57199,8 +57223,8 @@ async function startDirectorBridge() {
57199
57223
  codexCwd: config2.codexCwd,
57200
57224
  codexExecutable: config2.codexExecutable,
57201
57225
  checkoutRegistry,
57202
- worktreeRoot: import_node_path27.default.join(config2.stateDir, "worktrees"),
57203
- locksDir: import_node_path27.default.join(config2.stateDir, "locks"),
57226
+ worktreeRoot: import_node_path28.default.join(config2.stateDir, "worktrees"),
57227
+ locksDir: import_node_path28.default.join(config2.stateDir, "locks"),
57204
57228
  // Wire the executor server for code-execution runs. Each run gets its own provider process
57205
57229
  // (app-server for codex, a resident CLI child for claude) at the run worktree, running
57206
57230
  // UNRESTRICTED from the real operator config (owner no-sandbox decision — auth + mrrlin MCP
@@ -57244,7 +57268,7 @@ async function startDirectorBridge() {
57244
57268
  // egressDomains is retained in the seam signature (verification-turn.ts still computes the
57245
57269
  // env host) but no longer constrains anything — the executor is unrestricted.
57246
57270
  startSandbox: async (_egressDomains, providerId) => {
57247
- const cwd = import_node_fs20.default.mkdtempSync(import_node_path27.default.join(import_node_os12.default.tmpdir(), "mrrlin-verify-"));
57271
+ const cwd = import_node_fs20.default.mkdtempSync(import_node_path28.default.join(import_node_os13.default.tmpdir(), "mrrlin-verify-"));
57248
57272
  let executor;
57249
57273
  try {
57250
57274
  executor = await startExecutorServer({ worktree: cwd, provider: providerId });
@@ -57283,7 +57307,11 @@ async function startDirectorBridge() {
57283
57307
  attemptOutcome,
57284
57308
  cwd: config2.codexCwd ?? process.cwd(),
57285
57309
  codexExecutable: config2.codexExecutable,
57286
- runId
57310
+ runId,
57311
+ // Where this gate records what each of its provider calls cost. The same directory the
57312
+ // uploader reads from (`uploadPendingDays(config.stateDir, ...)` further down this file),
57313
+ // so a record written here is picked up by the very next telemetry tick.
57314
+ stateDir: config2.stateDir
57287
57315
  });
57288
57316
  return runDeliverableGate({ projectSlug, deliverablePageId, attemptOutcome }, gateDeps);
57289
57317
  }
@@ -57468,7 +57496,7 @@ async function startDirectorBridge() {
57468
57496
  }
57469
57497
  const files = dayFilesInWindow(/* @__PURE__ */ new Date(), reseedWindowMs);
57470
57498
  const sessionIds = [args.directorSessionId, ...args.priorSessionIds];
57471
- const { lines: lines2, missingFiles } = await readSessionRows(import_node_path27.default.join(config2.stateDir, "logs"), files, sessionIds);
57499
+ const { lines: lines2, missingFiles } = await readSessionRows(import_node_path28.default.join(config2.stateDir, "logs"), files, sessionIds);
57472
57500
  const { items, skipped: skipped2 } = extractItems(lines2, sessionIds);
57473
57501
  if (items.length === 0) return refuse2("no-rows");
57474
57502
  const budget = Math.max(0, Math.min(config2.reseedMaxTokens, config2.turnMaxTokens - args.otherBytes));
@@ -57701,8 +57729,8 @@ async function startDirectorBridge() {
57701
57729
  );
57702
57730
  void runOrphanWorktreeSweep(client, {
57703
57731
  checkoutRegistry,
57704
- worktreeRoot: import_node_path27.default.join(config2.stateDir, "worktrees"),
57705
- locksDir: import_node_path27.default.join(config2.stateDir, "locks")
57732
+ worktreeRoot: import_node_path28.default.join(config2.stateDir, "worktrees"),
57733
+ locksDir: import_node_path28.default.join(config2.stateDir, "locks")
57706
57734
  });
57707
57735
  {
57708
57736
  const { retainedBuffers, retainedBytes, tombstonesRemoved } = sweepReplayBuffers(threads, tombstones, {
@@ -58032,7 +58060,7 @@ function readDispatchBody(req) {
58032
58060
  function readOrCreateBridgeToken(stateDir) {
58033
58061
  const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
58034
58062
  if (explicit) return explicit;
58035
- const tokenPath = import_node_path27.default.join(stateDir, "token.txt");
58063
+ const tokenPath = import_node_path28.default.join(stateDir, "token.txt");
58036
58064
  try {
58037
58065
  const existing = import_node_fs20.default.readFileSync(tokenPath, "utf8").trim();
58038
58066
  if (existing) return existing;
@@ -61430,15 +61458,15 @@ var StdioServerTransport = class {
61430
61458
  // src/tools.ts
61431
61459
  var import_node_crypto14 = require("node:crypto");
61432
61460
  var import_promises10 = require("node:fs/promises");
61433
- var import_node_path30 = __toESM(require("node:path"), 1);
61434
- var import_node_os13 = __toESM(require("node:os"), 1);
61461
+ var import_node_path31 = __toESM(require("node:path"), 1);
61462
+ var import_node_os14 = __toESM(require("node:os"), 1);
61435
61463
 
61436
61464
  // ../../packages/wiki/dist/index.js
61437
61465
  var import_promises8 = __toESM(require("node:fs/promises"), 1);
61438
- var import_node_path28 = __toESM(require("node:path"), 1);
61466
+ var import_node_path29 = __toESM(require("node:path"), 1);
61439
61467
  var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
61440
61468
  function toPosixPath(input) {
61441
- return input.split(import_node_path28.default.sep).join("/");
61469
+ return input.split(import_node_path29.default.sep).join("/");
61442
61470
  }
61443
61471
  function slugifyWikiSegment(input) {
61444
61472
  return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -61452,12 +61480,12 @@ async function pathExists3(input) {
61452
61480
  }
61453
61481
  }
61454
61482
  async function findWorkspaceRoot(start = process.cwd()) {
61455
- let current2 = import_node_path28.default.resolve(start);
61483
+ let current2 = import_node_path29.default.resolve(start);
61456
61484
  while (true) {
61457
- if (await pathExists3(import_node_path28.default.join(current2, "pnpm-workspace.yaml")) && await pathExists3(import_node_path28.default.join(current2, "docs"))) {
61485
+ if (await pathExists3(import_node_path29.default.join(current2, "pnpm-workspace.yaml")) && await pathExists3(import_node_path29.default.join(current2, "docs"))) {
61458
61486
  return current2;
61459
61487
  }
61460
- const parent = import_node_path28.default.dirname(current2);
61488
+ const parent = import_node_path29.default.dirname(current2);
61461
61489
  if (parent === current2) {
61462
61490
  throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
61463
61491
  }
@@ -61466,28 +61494,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
61466
61494
  }
61467
61495
  async function resolveDocsRoot(input) {
61468
61496
  if (input) {
61469
- return import_node_path28.default.resolve(input);
61497
+ return import_node_path29.default.resolve(input);
61470
61498
  }
61471
61499
  if (process.env.MRRLIN_DOCS_ROOT) {
61472
- return import_node_path28.default.resolve(process.env.MRRLIN_DOCS_ROOT);
61500
+ return import_node_path29.default.resolve(process.env.MRRLIN_DOCS_ROOT);
61473
61501
  }
61474
- return import_node_path28.default.join(await findWorkspaceRoot(), "docs");
61502
+ return import_node_path29.default.join(await findWorkspaceRoot(), "docs");
61475
61503
  }
61476
61504
  async function resolveIndexPath(input) {
61477
61505
  if (input) {
61478
- return import_node_path28.default.resolve(input);
61506
+ return import_node_path29.default.resolve(input);
61479
61507
  }
61480
61508
  if (process.env.MRRLIN_WIKI_INDEX_PATH) {
61481
- return import_node_path28.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
61509
+ return import_node_path29.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
61482
61510
  }
61483
61511
  const workspaceRoot = await findWorkspaceRoot();
61484
- return import_node_path28.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
61512
+ return import_node_path29.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
61485
61513
  }
61486
61514
  async function walkMarkdownFiles(root, dir = root) {
61487
61515
  const entries = await import_promises8.default.readdir(dir, { withFileTypes: true });
61488
61516
  const files = [];
61489
61517
  for (const entry of entries) {
61490
- const absolute = import_node_path28.default.join(dir, entry.name);
61518
+ const absolute = import_node_path29.default.join(dir, entry.name);
61491
61519
  if (entry.isDirectory()) {
61492
61520
  files.push(...await walkMarkdownFiles(root, absolute));
61493
61521
  continue;
@@ -61506,7 +61534,7 @@ function parseTitle(markdown, sourcePath) {
61506
61534
  return title;
61507
61535
  }
61508
61536
  function documentFromFile(docsRoot, absolutePath, markdown) {
61509
- const relativePath = toPosixPath(import_node_path28.default.relative(docsRoot, absolutePath));
61537
+ const relativePath = toPosixPath(import_node_path29.default.relative(docsRoot, absolutePath));
61510
61538
  const [section, fileName] = relativePath.split("/");
61511
61539
  if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
61512
61540
  return null;
@@ -61949,7 +61977,12 @@ ${artifact}${dismissedBlock}` : `${artifact}${dismissedBlock}`;
61949
61977
  const rePicked = await pickOnce();
61950
61978
  if (!rePicked.ok || rePicked.agents.length <= built.agents.length) return { ok: false };
61951
61979
  const rebuilt = buildFromAgents(rePicked.agents);
61952
- return { ok: true, composition: rebuilt.composition, runHead: rebuilt.runHead };
61980
+ return {
61981
+ ok: true,
61982
+ composition: rebuilt.composition,
61983
+ runHead: rebuilt.runHead,
61984
+ assignment: rebuilt.assignment
61985
+ };
61953
61986
  };
61954
61987
  return { ok: true, runner: { ...built, repick } };
61955
61988
  }
@@ -62092,7 +62125,19 @@ function multiLlmActive(_env = process.env) {
62092
62125
  }
62093
62126
  function applyActivePanel(deps, panel) {
62094
62127
  if (!panel) return;
62095
- deps.runHead = panel.runHead;
62128
+ const record2 = deps.recordHeadCall;
62129
+ deps.runHead = record2 === void 0 ? panel.runHead : async (persona, artifact, dismissed) => {
62130
+ const agentId = panel.assignment[persona] ?? null;
62131
+ const startedAt = Date.now();
62132
+ try {
62133
+ const result = await panel.runHead(persona, artifact, dismissed);
62134
+ record2(persona, agentId, startedAt, result);
62135
+ return result;
62136
+ } catch (error51) {
62137
+ record2(persona, agentId, startedAt, { ok: false, error: error51 instanceof Error ? error51.message : String(error51) });
62138
+ throw error51;
62139
+ }
62140
+ };
62096
62141
  deps.panelComposition = panel.composition;
62097
62142
  }
62098
62143
  async function resolveActivePanel(input, deps) {
@@ -62127,7 +62172,11 @@ async function resolveActivePanel(input, deps) {
62127
62172
  deps
62128
62173
  );
62129
62174
  if (!built.ok) return null;
62130
- return { runHead: built.runner.runHead, composition: built.runner.composition };
62175
+ return {
62176
+ runHead: built.runner.runHead,
62177
+ composition: built.runner.composition,
62178
+ assignment: built.runner.assignment
62179
+ };
62131
62180
  } catch {
62132
62181
  return null;
62133
62182
  }
@@ -62709,9 +62758,9 @@ async function runNativeSpecGate(ctx, input, builders = defaultNativeSpecGateBui
62709
62758
  specPageId: input.pageId,
62710
62759
  cwd: ctx.cwd,
62711
62760
  codexExecutable: ctx.codexExecutable,
62712
- // Where the gate records what each of its provider calls cost. This is the only one of the
62713
- // four gate-deps call sites that holds a stateDir today; without it the recorder is a no-op,
62714
- // so the spec gate is the one whose cost is actually observable.
62761
+ // Where the gate records what each of its provider calls cost. Without it the recorder is a
62762
+ // no-op, which is how three of the four gate-deps call sites once ran silent; all four pass one
62763
+ // now, and `consensus/gate-cost-call-sites.test.ts` fails if a fifth appears without it.
62715
62764
  stateDir: ctx.stateDir,
62716
62765
  extraHeadCount: input.extraHeads?.length ?? 0,
62717
62766
  // model-tier-planning-and-arbiter task 1.21: the seat minted at the async-job claim.
@@ -63157,6 +63206,9 @@ async function run2(ctx, input) {
63157
63206
  deliverablePageId: input.pageId,
63158
63207
  cwd: ctx.cwd,
63159
63208
  codexExecutable: ctx.codexExecutable,
63209
+ // Where the gate records what each of its provider calls cost — the same `ctx.stateDir` the
63210
+ // spec gate next door already passes.
63211
+ stateDir: ctx.stateDir,
63160
63212
  // model-tier-planning-and-arbiter task 1.21: the seat minted at the async-job claim.
63161
63213
  seat: ctx.seat
63162
63214
  });
@@ -63411,7 +63463,7 @@ var intentCheckDescriptor = createIntentCheckDescriptor();
63411
63463
 
63412
63464
  // src/evidence/assembler.ts
63413
63465
  var import_promises9 = require("node:fs/promises");
63414
- var import_node_path29 = require("node:path");
63466
+ var import_node_path30 = require("node:path");
63415
63467
  function evidenceDedupKey(sessionId, reportId) {
63416
63468
  return `${sessionId}:${reportId}`;
63417
63469
  }
@@ -63421,7 +63473,7 @@ function isRecord5(v) {
63421
63473
  async function readDayLines(stateDir, day, sessionId) {
63422
63474
  let raw;
63423
63475
  try {
63424
- raw = await (0, import_promises9.readFile)((0, import_node_path29.join)(stateDir, "logs", `bridge-${day}.jsonl`), "utf8");
63476
+ raw = await (0, import_promises9.readFile)((0, import_node_path30.join)(stateDir, "logs", `bridge-${day}.jsonl`), "utf8");
63425
63477
  } catch {
63426
63478
  return [];
63427
63479
  }
@@ -63495,7 +63547,7 @@ async function assembleEvidence(stateDir, sessionId, reportId, gateCtx) {
63495
63547
  }
63496
63548
  let windowPruned = false;
63497
63549
  try {
63498
- const raw = await (0, import_promises9.readFile)((0, import_node_path29.join)(stateDir, "logs", ".pruned.jsonl"), "utf8");
63550
+ const raw = await (0, import_promises9.readFile)((0, import_node_path30.join)(stateDir, "logs", ".pruned.jsonl"), "utf8");
63499
63551
  outer: for (const line of raw.split("\n")) {
63500
63552
  if (!line.trim()) continue;
63501
63553
  let rec;
@@ -65167,7 +65219,12 @@ function createMrrlinTools(options) {
65167
65219
  baseRef,
65168
65220
  cwd: process.cwd(),
65169
65221
  codexExecutable: process.env.MRRLIN_DIRECTOR_BRIDGE_CODEX_BIN?.trim() || void 0,
65170
- extraHeads
65222
+ extraHeads,
65223
+ // Where this gate records what each of its provider calls cost. Unlike the two async
65224
+ // gates, this handler runs in the `serve` process, which holds no config object — so the
65225
+ // directory is resolved from the same env fact the bridge resolves it from, which is why
65226
+ // that fact now lives in one module instead of three copies.
65227
+ stateDir: resolveStateDir()
65171
65228
  });
65172
65229
  const persistedProvider = await getAgentProviderForPanel(c);
65173
65230
  let activeCodePanel = null;
@@ -65329,7 +65386,7 @@ function createMrrlinTools(options) {
65329
65386
  "ARTIFACT_FILE_UPLOAD_FAILED",
65330
65387
  "Unable to upload artifact file.",
65331
65388
  async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
65332
- const extension2 = import_node_path30.default.extname(filePath).toLowerCase();
65389
+ const extension2 = import_node_path31.default.extname(filePath).toLowerCase();
65333
65390
  const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
65334
65391
  if (!contentType) {
65335
65392
  throw new McpToolCodedError(
@@ -65357,7 +65414,7 @@ function createMrrlinTools(options) {
65357
65414
  "Artifact exceeds 5MB; split or summarize instead."
65358
65415
  );
65359
65416
  }
65360
- const filename = import_node_path30.default.basename(filePath);
65417
+ const filename = import_node_path31.default.basename(filePath);
65361
65418
  return uploadArtifactBytes(c, {
65362
65419
  bytes: bytes3,
65363
65420
  class: artifactClass,
@@ -65382,7 +65439,7 @@ function createMrrlinTools(options) {
65382
65439
  `Invalid filename '${filename}'; provide a bare filename with no path separators or '..'.`
65383
65440
  );
65384
65441
  }
65385
- const extension2 = import_node_path30.default.extname(filename).toLowerCase();
65442
+ const extension2 = import_node_path31.default.extname(filename).toLowerCase();
65386
65443
  const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
65387
65444
  if (!contentType) {
65388
65445
  throw new McpToolCodedError(
@@ -65456,9 +65513,8 @@ function createMrrlinTools(options) {
65456
65513
  "LOCAL_CHECKOUT_REGISTER_FAILED",
65457
65514
  "Unable to register local checkout.",
65458
65515
  async (_c, { projectSlug, path: checkoutPath, repo }) => {
65459
- const stateDir = process.env.CODEX_HOME ? import_node_path30.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path30.default.join(import_node_os13.default.homedir(), ".mrrlin", "director-bridge");
65460
- const registry3 = new CheckoutRegistry(stateDir);
65461
- const result = registerCheckout(registry3, { projectSlug, path: checkoutPath, repo }, import_node_os13.default.hostname());
65516
+ const registry3 = new CheckoutRegistry(resolveStateDir());
65517
+ const result = registerCheckout(registry3, { projectSlug, path: checkoutPath, repo }, import_node_os14.default.hostname());
65462
65518
  if (!result.ok) {
65463
65519
  const codeMap = {
65464
65520
  not_absolute: "LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
@@ -65695,9 +65751,9 @@ function runSetCredential(args) {
65695
65751
  }
65696
65752
 
65697
65753
  // src/install-service.ts
65698
- var import_node_os14 = __toESM(require("node:os"), 1);
65754
+ var import_node_os15 = __toESM(require("node:os"), 1);
65699
65755
  var import_node_fs21 = require("node:fs");
65700
- var import_node_path31 = __toESM(require("node:path"), 1);
65756
+ var import_node_path32 = __toESM(require("node:path"), 1);
65701
65757
  var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
65702
65758
  function defaultHomeOwnerUid(home) {
65703
65759
  try {
@@ -65742,11 +65798,11 @@ function installService(deps) {
65742
65798
  deps.log(resolved.reason);
65743
65799
  return { ok: false };
65744
65800
  }
65745
- const home = deps.env.HOME ?? import_node_os14.default.homedir();
65801
+ const home = deps.env.HOME ?? import_node_os15.default.homedir();
65746
65802
  const user = resolveBridgeUser({
65747
65803
  env: deps.env,
65748
65804
  home,
65749
- userInfo: deps.userInfo ?? (() => import_node_os14.default.userInfo()),
65805
+ userInfo: deps.userInfo ?? (() => import_node_os15.default.userInfo()),
65750
65806
  homeOwnerUid: deps.homeOwnerUid ?? defaultHomeOwnerUid,
65751
65807
  log: deps.log
65752
65808
  });
@@ -65762,7 +65818,7 @@ function installService(deps) {
65762
65818
  const claudeBin = deps.which("claude");
65763
65819
  const resolvedBins = [...bins, claudeBin].filter((b) => b !== null);
65764
65820
  const pathEnv = Array.from(
65765
- /* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path31.default.dirname(b)), ...SYSTEM_PATH_DIRS])
65821
+ /* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path32.default.dirname(b)), ...SYSTEM_PATH_DIRS])
65766
65822
  ).join(":");
65767
65823
  const apiBaseUrl = deps.env.MRRLIN_API_BASE_URL?.trim() || void 0;
65768
65824
  const staging = deps.env.MRRLIN_STAGING === "1" || !apiBaseUrl && bridgeUrlImpliesStaging(deps.env.MRRLIN_BRIDGE_URL);
@@ -65775,7 +65831,7 @@ function installService(deps) {
65775
65831
  staging,
65776
65832
  apiBaseUrl
65777
65833
  });
65778
- const ecoPath = import_node_path31.default.join(home, ".mrrlin", "ecosystem.config.cjs");
65834
+ const ecoPath = import_node_path32.default.join(home, ".mrrlin", "ecosystem.config.cjs");
65779
65835
  deps.writeFile(ecoPath, text);
65780
65836
  const start = deps.runPm2(["startOrReload", ecoPath]);
65781
65837
  if (start.code !== 0) {
@@ -65827,13 +65883,13 @@ function uninstallService(deps) {
65827
65883
 
65828
65884
  // src/uninstall-codex.ts
65829
65885
  var import_promises11 = __toESM(require("node:fs/promises"), 1);
65830
- var import_node_os15 = __toESM(require("node:os"), 1);
65831
- var import_node_path32 = __toESM(require("node:path"), 1);
65886
+ var import_node_os16 = __toESM(require("node:os"), 1);
65887
+ var import_node_path33 = __toESM(require("node:path"), 1);
65832
65888
  var toml3 = __toESM(require_toml(), 1);
65833
65889
  function resolveCodexHome3(options) {
65834
65890
  if (options.codexHome) return options.codexHome;
65835
65891
  if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
65836
- return import_node_path32.default.join(options.homeDir ?? import_node_os15.default.homedir(), ".codex");
65892
+ return import_node_path33.default.join(options.homeDir ?? import_node_os16.default.homedir(), ".codex");
65837
65893
  }
65838
65894
  async function pathExists4(target) {
65839
65895
  try {
@@ -65846,7 +65902,7 @@ async function pathExists4(target) {
65846
65902
  var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
65847
65903
  async function uninstallCodex(options = {}) {
65848
65904
  const codexHome = resolveCodexHome3(options);
65849
- const configPath = import_node_path32.default.join(codexHome, "config.toml");
65905
+ const configPath = import_node_path33.default.join(codexHome, "config.toml");
65850
65906
  const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
65851
65907
  if (!await pathExists4(configPath)) {
65852
65908
  return { action: "missing", configPath, prompts: await removePrompts() };
@@ -65874,10 +65930,10 @@ async function uninstallCodex(options = {}) {
65874
65930
  }
65875
65931
  async function uninstallPrompts(codexHome, names) {
65876
65932
  if (names.length === 0) return [];
65877
- const promptsDir = import_node_path32.default.join(codexHome, "prompts");
65933
+ const promptsDir = import_node_path33.default.join(codexHome, "prompts");
65878
65934
  const out = [];
65879
65935
  for (const name of names) {
65880
- const promptPath = import_node_path32.default.join(promptsDir, `${name}.md`);
65936
+ const promptPath = import_node_path33.default.join(promptsDir, `${name}.md`);
65881
65937
  try {
65882
65938
  await import_promises11.default.unlink(promptPath);
65883
65939
  out.push({ name, action: "removed", promptPath });
@@ -65895,7 +65951,7 @@ async function uninstallPrompts(codexHome, names) {
65895
65951
 
65896
65952
  // src/extract/command.ts
65897
65953
  var import_promises12 = require("node:fs/promises");
65898
- var import_node_path33 = require("node:path");
65954
+ var import_node_path34 = require("node:path");
65899
65955
  function parseArgs(args) {
65900
65956
  const map2 = /* @__PURE__ */ new Map();
65901
65957
  for (let i = 0; i < args.length; i++) {
@@ -65932,7 +65988,7 @@ Missing required flag(s): ${missing.join(
65932
65988
  const days = await findSessionDays(deps.stateDir, sessionId);
65933
65989
  const matchingLines = [];
65934
65990
  for (const day of days) {
65935
- const logPath = (0, import_node_path33.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
65991
+ const logPath = (0, import_node_path34.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
65936
65992
  let raw;
65937
65993
  try {
65938
65994
  raw = await (0, import_promises12.readFile)(logPath, "utf8");
@@ -66032,11 +66088,11 @@ function bootHookStatus() {
66032
66088
  if (process.platform !== "darwin") return { status: "unknown" };
66033
66089
  const uid = process.getuid?.();
66034
66090
  if (uid === void 0 || uid === 0) return { status: "unknown" };
66035
- const home = process.env.HOME ?? (0, import_node_os16.homedir)();
66036
- const agents = import_node_path35.default.join(home, "Library", "LaunchAgents");
66091
+ const home = process.env.HOME ?? (0, import_node_os17.homedir)();
66092
+ const agents = import_node_path36.default.join(home, "Library", "LaunchAgents");
66037
66093
  const candidates = [
66038
- { label: "com.mrrlin.director-bridge", plist: import_node_path35.default.join(agents, "com.mrrlin.director-bridge.plist") },
66039
- { label: "com.PM2", plist: import_node_path35.default.join(agents, `pm2.${(0, import_node_os16.userInfo)().username}.plist`) }
66094
+ { label: "com.mrrlin.director-bridge", plist: import_node_path36.default.join(agents, "com.mrrlin.director-bridge.plist") },
66095
+ { label: "com.PM2", plist: import_node_path36.default.join(agents, `pm2.${(0, import_node_os17.userInfo)().username}.plist`) }
66040
66096
  ];
66041
66097
  for (const candidate of candidates) {
66042
66098
  const printed = (0, import_node_child_process18.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
@@ -66324,8 +66380,8 @@ async function main() {
66324
66380
  }
66325
66381
  }
66326
66382
  try {
66327
- const codexHome = process.env.CODEX_HOME ?? import_node_path35.default.join(process.env.HOME ?? (0, import_node_os16.homedir)(), ".codex");
66328
- (0, import_node_fs22.rmSync)(import_node_path35.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
66383
+ const codexHome = process.env.CODEX_HOME ?? import_node_path36.default.join(process.env.HOME ?? (0, import_node_os17.homedir)(), ".codex");
66384
+ (0, import_node_fs22.rmSync)(import_node_path36.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
66329
66385
  } catch {
66330
66386
  }
66331
66387
  const claudeResult = await installClaude({ binPath, force, serveEnv });
@@ -66386,7 +66442,7 @@ async function main() {
66386
66442
  env: process.env,
66387
66443
  cwd: process.cwd(),
66388
66444
  writeFile: (p, c) => {
66389
- (0, import_node_fs22.mkdirSync)(import_node_path35.default.dirname(p), { recursive: true, mode: 448 });
66445
+ (0, import_node_fs22.mkdirSync)(import_node_path36.default.dirname(p), { recursive: true, mode: 448 });
66390
66446
  (0, import_node_fs22.writeFileSync)(p, c, { mode: 384 });
66391
66447
  },
66392
66448
  runPm2: pm2Runner,
@@ -66412,14 +66468,14 @@ async function main() {
66412
66468
  purgeSecret: purge,
66413
66469
  secretPath: agentCredentialPath(),
66414
66470
  tokenPath: operatorTokenPath(),
66415
- ecoPath: import_node_path35.default.join(process.env.HOME ?? (0, import_node_os16.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
66471
+ ecoPath: import_node_path36.default.join(process.env.HOME ?? (0, import_node_os17.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
66416
66472
  log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
66417
66473
  `)
66418
66474
  });
66419
66475
  return;
66420
66476
  }
66421
66477
  case "uninstall": {
66422
- const home = process.env.HOME ?? (0, import_node_os16.homedir)();
66478
+ const home = process.env.HOME ?? (0, import_node_os17.homedir)();
66423
66479
  const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
66424
66480
  `);
66425
66481
  uninstallService({
@@ -66433,7 +66489,7 @@ async function main() {
66433
66489
  purgeSecret: true,
66434
66490
  secretPath: agentCredentialPath(),
66435
66491
  tokenPath: operatorTokenPath(),
66436
- ecoPath: import_node_path35.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
66492
+ ecoPath: import_node_path36.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
66437
66493
  log
66438
66494
  });
66439
66495
  let codexOk = true;
@@ -66453,7 +66509,7 @@ async function main() {
66453
66509
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
66454
66510
  }
66455
66511
  try {
66456
- (0, import_node_fs22.rmSync)(import_node_path35.default.join(home, ".mrrlin"), { recursive: true, force: true });
66512
+ (0, import_node_fs22.rmSync)(import_node_path36.default.join(home, ".mrrlin"), { recursive: true, force: true });
66457
66513
  } catch {
66458
66514
  }
66459
66515
  log("removed ~/.mrrlin");
@@ -66494,7 +66550,7 @@ ${HELP_TEXT}`);
66494
66550
  }
66495
66551
  }
66496
66552
  function resolveSelfBinPath() {
66497
- return import_node_path34.default.resolve(process.argv[1] ?? process.execPath);
66553
+ return import_node_path35.default.resolve(process.argv[1] ?? process.execPath);
66498
66554
  }
66499
66555
  main().catch((error51) => {
66500
66556
  process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}