@mrrlin-dev/mcp 0.4.87 → 0.4.90

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 +1585 -409
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -5832,7 +5832,7 @@ var require_fast_uri = __commonJS({
5832
5832
  normalizeString(uri, options);
5833
5833
  } else if (typeof uri === "object") {
5834
5834
  uri = /** @type {T} */
5835
- parse7(serialize(uri, options), options);
5835
+ parse8(serialize(uri, options), options);
5836
5836
  }
5837
5837
  return uri;
5838
5838
  }
@@ -5872,8 +5872,8 @@ var require_fast_uri = __commonJS({
5872
5872
  function resolveComponent(base, relative, options, skipNormalization) {
5873
5873
  const target = {};
5874
5874
  if (!skipNormalization) {
5875
- base = parse7(serialize(base, options), options);
5876
- relative = parse7(serialize(relative, options), options);
5875
+ base = parse8(serialize(base, options), options);
5876
+ relative = parse8(serialize(relative, options), options);
5877
5877
  }
5878
5878
  options = options || {};
5879
5879
  if (!options.tolerant && relative.scheme) {
@@ -6172,7 +6172,7 @@ var require_fast_uri = __commonJS({
6172
6172
  }
6173
6173
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
6174
6174
  }
6175
- function parse7(uri, opts) {
6175
+ function parse8(uri, opts) {
6176
6176
  return parseWithStatus(uri, opts).parsed;
6177
6177
  }
6178
6178
  function normalizeString(uri, opts) {
@@ -6209,7 +6209,7 @@ var require_fast_uri = __commonJS({
6209
6209
  resolveComponent,
6210
6210
  equal,
6211
6211
  serialize,
6212
- parse: parse7
6212
+ parse: parse8
6213
6213
  };
6214
6214
  module2.exports = fastUri;
6215
6215
  module2.exports.default = fastUri;
@@ -9205,7 +9205,7 @@ var require_content_type = __commonJS({
9205
9205
  var QUOTE_REGEXP = /([\\"])/g;
9206
9206
  var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
9207
9207
  exports2.format = format;
9208
- exports2.parse = parse7;
9208
+ exports2.parse = parse8;
9209
9209
  function format(obj) {
9210
9210
  if (!obj || typeof obj !== "object") {
9211
9211
  throw new TypeError("argument obj is required");
@@ -9229,7 +9229,7 @@ var require_content_type = __commonJS({
9229
9229
  }
9230
9230
  return string4;
9231
9231
  }
9232
- function parse7(string4) {
9232
+ function parse8(string4) {
9233
9233
  if (!string4) {
9234
9234
  throw new TypeError("argument string is required");
9235
9235
  }
@@ -9298,6 +9298,503 @@ var require_content_type = __commonJS({
9298
9298
  }
9299
9299
  });
9300
9300
 
9301
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
9302
+ var require_windows = __commonJS({
9303
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
9304
+ module2.exports = isexe;
9305
+ isexe.sync = sync;
9306
+ var fs14 = require("fs");
9307
+ function checkPathExt(path28, options) {
9308
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
9309
+ if (!pathext) {
9310
+ return true;
9311
+ }
9312
+ pathext = pathext.split(";");
9313
+ if (pathext.indexOf("") !== -1) {
9314
+ return true;
9315
+ }
9316
+ for (var i = 0; i < pathext.length; i++) {
9317
+ var p = pathext[i].toLowerCase();
9318
+ if (p && path28.substr(-p.length).toLowerCase() === p) {
9319
+ return true;
9320
+ }
9321
+ }
9322
+ return false;
9323
+ }
9324
+ function checkStat(stat3, path28, options) {
9325
+ if (!stat3.isSymbolicLink() && !stat3.isFile()) {
9326
+ return false;
9327
+ }
9328
+ return checkPathExt(path28, options);
9329
+ }
9330
+ function isexe(path28, options, cb) {
9331
+ fs14.stat(path28, function(er, stat3) {
9332
+ cb(er, er ? false : checkStat(stat3, path28, options));
9333
+ });
9334
+ }
9335
+ function sync(path28, options) {
9336
+ return checkStat(fs14.statSync(path28), path28, options);
9337
+ }
9338
+ }
9339
+ });
9340
+
9341
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
9342
+ var require_mode = __commonJS({
9343
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
9344
+ module2.exports = isexe;
9345
+ isexe.sync = sync;
9346
+ var fs14 = require("fs");
9347
+ function isexe(path28, options, cb) {
9348
+ fs14.stat(path28, function(er, stat3) {
9349
+ cb(er, er ? false : checkStat(stat3, options));
9350
+ });
9351
+ }
9352
+ function sync(path28, options) {
9353
+ return checkStat(fs14.statSync(path28), options);
9354
+ }
9355
+ function checkStat(stat3, options) {
9356
+ return stat3.isFile() && checkMode(stat3, options);
9357
+ }
9358
+ function checkMode(stat3, options) {
9359
+ var mod2 = stat3.mode;
9360
+ var uid = stat3.uid;
9361
+ var gid = stat3.gid;
9362
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
9363
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
9364
+ var u = parseInt("100", 8);
9365
+ var g = parseInt("010", 8);
9366
+ var o = parseInt("001", 8);
9367
+ var ug = u | g;
9368
+ var ret = mod2 & o || mod2 & g && gid === myGid || mod2 & u && uid === myUid || mod2 & ug && myUid === 0;
9369
+ return ret;
9370
+ }
9371
+ }
9372
+ });
9373
+
9374
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
9375
+ var require_isexe = __commonJS({
9376
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
9377
+ var fs14 = require("fs");
9378
+ var core;
9379
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
9380
+ core = require_windows();
9381
+ } else {
9382
+ core = require_mode();
9383
+ }
9384
+ module2.exports = isexe;
9385
+ isexe.sync = sync;
9386
+ function isexe(path28, options, cb) {
9387
+ if (typeof options === "function") {
9388
+ cb = options;
9389
+ options = {};
9390
+ }
9391
+ if (!cb) {
9392
+ if (typeof Promise !== "function") {
9393
+ throw new TypeError("callback not provided");
9394
+ }
9395
+ return new Promise(function(resolve, reject) {
9396
+ isexe(path28, options || {}, function(er, is) {
9397
+ if (er) {
9398
+ reject(er);
9399
+ } else {
9400
+ resolve(is);
9401
+ }
9402
+ });
9403
+ });
9404
+ }
9405
+ core(path28, options || {}, function(er, is) {
9406
+ if (er) {
9407
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
9408
+ er = null;
9409
+ is = false;
9410
+ }
9411
+ }
9412
+ cb(er, is);
9413
+ });
9414
+ }
9415
+ function sync(path28, options) {
9416
+ try {
9417
+ return core.sync(path28, options || {});
9418
+ } catch (er) {
9419
+ if (options && options.ignoreErrors || er.code === "EACCES") {
9420
+ return false;
9421
+ } else {
9422
+ throw er;
9423
+ }
9424
+ }
9425
+ }
9426
+ }
9427
+ });
9428
+
9429
+ // ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
9430
+ var require_which = __commonJS({
9431
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
9432
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
9433
+ var path28 = require("path");
9434
+ var COLON = isWindows ? ";" : ":";
9435
+ var isexe = require_isexe();
9436
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
9437
+ var getPathInfo = (cmd, opt) => {
9438
+ const colon = opt.colon || COLON;
9439
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
9440
+ // windows always checks the cwd first
9441
+ ...isWindows ? [process.cwd()] : [],
9442
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
9443
+ "").split(colon)
9444
+ ];
9445
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
9446
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
9447
+ if (isWindows) {
9448
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
9449
+ pathExt.unshift("");
9450
+ }
9451
+ return {
9452
+ pathEnv,
9453
+ pathExt,
9454
+ pathExtExe
9455
+ };
9456
+ };
9457
+ var which = (cmd, opt, cb) => {
9458
+ if (typeof opt === "function") {
9459
+ cb = opt;
9460
+ opt = {};
9461
+ }
9462
+ if (!opt)
9463
+ opt = {};
9464
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
9465
+ const found = [];
9466
+ const step = (i) => new Promise((resolve, reject) => {
9467
+ if (i === pathEnv.length)
9468
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
9469
+ const ppRaw = pathEnv[i];
9470
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
9471
+ const pCmd = path28.join(pathPart, cmd);
9472
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
9473
+ resolve(subStep(p, i, 0));
9474
+ });
9475
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
9476
+ if (ii === pathExt.length)
9477
+ return resolve(step(i + 1));
9478
+ const ext = pathExt[ii];
9479
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
9480
+ if (!er && is) {
9481
+ if (opt.all)
9482
+ found.push(p + ext);
9483
+ else
9484
+ return resolve(p + ext);
9485
+ }
9486
+ return resolve(subStep(p, i, ii + 1));
9487
+ });
9488
+ });
9489
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
9490
+ };
9491
+ var whichSync = (cmd, opt) => {
9492
+ opt = opt || {};
9493
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
9494
+ const found = [];
9495
+ for (let i = 0; i < pathEnv.length; i++) {
9496
+ const ppRaw = pathEnv[i];
9497
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
9498
+ const pCmd = path28.join(pathPart, cmd);
9499
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
9500
+ for (let j = 0; j < pathExt.length; j++) {
9501
+ const cur = p + pathExt[j];
9502
+ try {
9503
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
9504
+ if (is) {
9505
+ if (opt.all)
9506
+ found.push(cur);
9507
+ else
9508
+ return cur;
9509
+ }
9510
+ } catch (ex) {
9511
+ }
9512
+ }
9513
+ }
9514
+ if (opt.all && found.length)
9515
+ return found;
9516
+ if (opt.nothrow)
9517
+ return null;
9518
+ throw getNotFoundError(cmd);
9519
+ };
9520
+ module2.exports = which;
9521
+ which.sync = whichSync;
9522
+ }
9523
+ });
9524
+
9525
+ // ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
9526
+ var require_path_key = __commonJS({
9527
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports2, module2) {
9528
+ "use strict";
9529
+ var pathKey = (options = {}) => {
9530
+ const environment = options.env || process.env;
9531
+ const platform = options.platform || process.platform;
9532
+ if (platform !== "win32") {
9533
+ return "PATH";
9534
+ }
9535
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
9536
+ };
9537
+ module2.exports = pathKey;
9538
+ module2.exports.default = pathKey;
9539
+ }
9540
+ });
9541
+
9542
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
9543
+ var require_resolveCommand = __commonJS({
9544
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
9545
+ "use strict";
9546
+ var path28 = require("path");
9547
+ var which = require_which();
9548
+ var getPathKey = require_path_key();
9549
+ function resolveCommandAttempt(parsed, withoutPathExt) {
9550
+ const env = parsed.options.env || process.env;
9551
+ const cwd = process.cwd();
9552
+ const hasCustomCwd = parsed.options.cwd != null;
9553
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
9554
+ if (shouldSwitchCwd) {
9555
+ try {
9556
+ process.chdir(parsed.options.cwd);
9557
+ } catch (err) {
9558
+ }
9559
+ }
9560
+ let resolved;
9561
+ try {
9562
+ resolved = which.sync(parsed.command, {
9563
+ path: env[getPathKey({ env })],
9564
+ pathExt: withoutPathExt ? path28.delimiter : void 0
9565
+ });
9566
+ } catch (e) {
9567
+ } finally {
9568
+ if (shouldSwitchCwd) {
9569
+ process.chdir(cwd);
9570
+ }
9571
+ }
9572
+ if (resolved) {
9573
+ resolved = path28.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
9574
+ }
9575
+ return resolved;
9576
+ }
9577
+ function resolveCommand(parsed) {
9578
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
9579
+ }
9580
+ module2.exports = resolveCommand;
9581
+ }
9582
+ });
9583
+
9584
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
9585
+ var require_escape = __commonJS({
9586
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
9587
+ "use strict";
9588
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
9589
+ function escapeCommand(arg) {
9590
+ arg = arg.replace(metaCharsRegExp, "^$1");
9591
+ return arg;
9592
+ }
9593
+ function escapeArgument(arg, doubleEscapeMetaChars) {
9594
+ arg = `${arg}`;
9595
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
9596
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
9597
+ arg = `"${arg}"`;
9598
+ arg = arg.replace(metaCharsRegExp, "^$1");
9599
+ if (doubleEscapeMetaChars) {
9600
+ arg = arg.replace(metaCharsRegExp, "^$1");
9601
+ }
9602
+ return arg;
9603
+ }
9604
+ module2.exports.command = escapeCommand;
9605
+ module2.exports.argument = escapeArgument;
9606
+ }
9607
+ });
9608
+
9609
+ // ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
9610
+ var require_shebang_regex = __commonJS({
9611
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports2, module2) {
9612
+ "use strict";
9613
+ module2.exports = /^#!(.*)/;
9614
+ }
9615
+ });
9616
+
9617
+ // ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
9618
+ var require_shebang_command = __commonJS({
9619
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports2, module2) {
9620
+ "use strict";
9621
+ var shebangRegex = require_shebang_regex();
9622
+ module2.exports = (string4 = "") => {
9623
+ const match = string4.match(shebangRegex);
9624
+ if (!match) {
9625
+ return null;
9626
+ }
9627
+ const [path28, argument] = match[0].replace(/#! ?/, "").split(" ");
9628
+ const binary = path28.split("/").pop();
9629
+ if (binary === "env") {
9630
+ return argument;
9631
+ }
9632
+ return argument ? `${binary} ${argument}` : binary;
9633
+ };
9634
+ }
9635
+ });
9636
+
9637
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
9638
+ var require_readShebang = __commonJS({
9639
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
9640
+ "use strict";
9641
+ var fs14 = require("fs");
9642
+ var shebangCommand = require_shebang_command();
9643
+ function readShebang(command) {
9644
+ const size = 150;
9645
+ const buffer = Buffer.alloc(size);
9646
+ let fd;
9647
+ try {
9648
+ fd = fs14.openSync(command, "r");
9649
+ fs14.readSync(fd, buffer, 0, size, 0);
9650
+ fs14.closeSync(fd);
9651
+ } catch (e) {
9652
+ }
9653
+ return shebangCommand(buffer.toString());
9654
+ }
9655
+ module2.exports = readShebang;
9656
+ }
9657
+ });
9658
+
9659
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
9660
+ var require_parse2 = __commonJS({
9661
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
9662
+ "use strict";
9663
+ var path28 = require("path");
9664
+ var resolveCommand = require_resolveCommand();
9665
+ var escape2 = require_escape();
9666
+ var readShebang = require_readShebang();
9667
+ var isWin = process.platform === "win32";
9668
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
9669
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
9670
+ function detectShebang(parsed) {
9671
+ parsed.file = resolveCommand(parsed);
9672
+ const shebang = parsed.file && readShebang(parsed.file);
9673
+ if (shebang) {
9674
+ parsed.args.unshift(parsed.file);
9675
+ parsed.command = shebang;
9676
+ return resolveCommand(parsed);
9677
+ }
9678
+ return parsed.file;
9679
+ }
9680
+ function parseNonShell(parsed) {
9681
+ if (!isWin) {
9682
+ return parsed;
9683
+ }
9684
+ const commandFile = detectShebang(parsed);
9685
+ const needsShell = !isExecutableRegExp.test(commandFile);
9686
+ if (parsed.options.forceShell || needsShell) {
9687
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
9688
+ parsed.command = path28.normalize(parsed.command);
9689
+ parsed.command = escape2.command(parsed.command);
9690
+ parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
9691
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
9692
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
9693
+ parsed.command = process.env.comspec || "cmd.exe";
9694
+ parsed.options.windowsVerbatimArguments = true;
9695
+ }
9696
+ return parsed;
9697
+ }
9698
+ function parse8(command, args, options) {
9699
+ if (args && !Array.isArray(args)) {
9700
+ options = args;
9701
+ args = null;
9702
+ }
9703
+ args = args ? args.slice(0) : [];
9704
+ options = Object.assign({}, options);
9705
+ const parsed = {
9706
+ command,
9707
+ args,
9708
+ options,
9709
+ file: void 0,
9710
+ original: {
9711
+ command,
9712
+ args
9713
+ }
9714
+ };
9715
+ return options.shell ? parsed : parseNonShell(parsed);
9716
+ }
9717
+ module2.exports = parse8;
9718
+ }
9719
+ });
9720
+
9721
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
9722
+ var require_enoent = __commonJS({
9723
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
9724
+ "use strict";
9725
+ var isWin = process.platform === "win32";
9726
+ function notFoundError(original, syscall) {
9727
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
9728
+ code: "ENOENT",
9729
+ errno: "ENOENT",
9730
+ syscall: `${syscall} ${original.command}`,
9731
+ path: original.command,
9732
+ spawnargs: original.args
9733
+ });
9734
+ }
9735
+ function hookChildProcess(cp, parsed) {
9736
+ if (!isWin) {
9737
+ return;
9738
+ }
9739
+ const originalEmit = cp.emit;
9740
+ cp.emit = function(name, arg1) {
9741
+ if (name === "exit") {
9742
+ const err = verifyENOENT(arg1, parsed);
9743
+ if (err) {
9744
+ return originalEmit.call(cp, "error", err);
9745
+ }
9746
+ }
9747
+ return originalEmit.apply(cp, arguments);
9748
+ };
9749
+ }
9750
+ function verifyENOENT(status, parsed) {
9751
+ if (isWin && status === 1 && !parsed.file) {
9752
+ return notFoundError(parsed.original, "spawn");
9753
+ }
9754
+ return null;
9755
+ }
9756
+ function verifyENOENTSync(status, parsed) {
9757
+ if (isWin && status === 1 && !parsed.file) {
9758
+ return notFoundError(parsed.original, "spawnSync");
9759
+ }
9760
+ return null;
9761
+ }
9762
+ module2.exports = {
9763
+ hookChildProcess,
9764
+ verifyENOENT,
9765
+ verifyENOENTSync,
9766
+ notFoundError
9767
+ };
9768
+ }
9769
+ });
9770
+
9771
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
9772
+ var require_cross_spawn = __commonJS({
9773
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
9774
+ "use strict";
9775
+ var cp = require("child_process");
9776
+ var parse8 = require_parse2();
9777
+ var enoent = require_enoent();
9778
+ function spawn6(command, args, options) {
9779
+ const parsed = parse8(command, args, options);
9780
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
9781
+ enoent.hookChildProcess(spawned, parsed);
9782
+ return spawned;
9783
+ }
9784
+ function spawnSync7(command, args, options) {
9785
+ const parsed = parse8(command, args, options);
9786
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
9787
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
9788
+ return result;
9789
+ }
9790
+ module2.exports = spawn6;
9791
+ module2.exports.spawn = spawn6;
9792
+ module2.exports.sync = spawnSync7;
9793
+ module2.exports._parse = parse8;
9794
+ module2.exports._enoent = enoent;
9795
+ }
9796
+ });
9797
+
9301
9798
  // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js
9302
9799
  var require_constants = __commonJS({
9303
9800
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js"(exports2, module2) {
@@ -9752,11 +10249,11 @@ var require_semver = __commonJS({
9752
10249
  });
9753
10250
 
9754
10251
  // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/parse.js
9755
- var require_parse2 = __commonJS({
10252
+ var require_parse3 = __commonJS({
9756
10253
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/parse.js"(exports2, module2) {
9757
10254
  "use strict";
9758
10255
  var SemVer = require_semver();
9759
- var parse7 = (version2, options, throwErrors = false) => {
10256
+ var parse8 = (version2, options, throwErrors = false) => {
9760
10257
  if (version2 instanceof SemVer) {
9761
10258
  return version2;
9762
10259
  }
@@ -9769,7 +10266,7 @@ var require_parse2 = __commonJS({
9769
10266
  throw er;
9770
10267
  }
9771
10268
  };
9772
- module2.exports = parse7;
10269
+ module2.exports = parse8;
9773
10270
  }
9774
10271
  });
9775
10272
 
@@ -9777,9 +10274,9 @@ var require_parse2 = __commonJS({
9777
10274
  var require_valid = __commonJS({
9778
10275
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/valid.js"(exports2, module2) {
9779
10276
  "use strict";
9780
- var parse7 = require_parse2();
10277
+ var parse8 = require_parse3();
9781
10278
  var valid = (version2, options) => {
9782
- const v = parse7(version2, options);
10279
+ const v = parse8(version2, options);
9783
10280
  return v ? v.version : null;
9784
10281
  };
9785
10282
  module2.exports = valid;
@@ -9790,9 +10287,9 @@ var require_valid = __commonJS({
9790
10287
  var require_clean = __commonJS({
9791
10288
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/clean.js"(exports2, module2) {
9792
10289
  "use strict";
9793
- var parse7 = require_parse2();
10290
+ var parse8 = require_parse3();
9794
10291
  var clean = (version2, options) => {
9795
- const s = parse7(version2.trim().replace(/^[=v]+/, ""), options);
10292
+ const s = parse8(version2.trim().replace(/^[=v]+/, ""), options);
9796
10293
  return s ? s.version : null;
9797
10294
  };
9798
10295
  module2.exports = clean;
@@ -9827,10 +10324,10 @@ var require_inc = __commonJS({
9827
10324
  var require_diff = __commonJS({
9828
10325
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/diff.js"(exports2, module2) {
9829
10326
  "use strict";
9830
- var parse7 = require_parse2();
10327
+ var parse8 = require_parse3();
9831
10328
  var diff = (version1, version2) => {
9832
- const v1 = parse7(version1, null, true);
9833
- const v2 = parse7(version2, null, true);
10329
+ const v1 = parse8(version1, null, true);
10330
+ const v2 = parse8(version2, null, true);
9834
10331
  const comparison = v1.compare(v2);
9835
10332
  if (comparison === 0) {
9836
10333
  return null;
@@ -9901,9 +10398,9 @@ var require_patch = __commonJS({
9901
10398
  var require_prerelease = __commonJS({
9902
10399
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/prerelease.js"(exports2, module2) {
9903
10400
  "use strict";
9904
- var parse7 = require_parse2();
10401
+ var parse8 = require_parse3();
9905
10402
  var prerelease = (version2, options) => {
9906
- const parsed = parse7(version2, options);
10403
+ const parsed = parse8(version2, options);
9907
10404
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
9908
10405
  };
9909
10406
  module2.exports = prerelease;
@@ -10089,7 +10586,7 @@ var require_coerce = __commonJS({
10089
10586
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/coerce.js"(exports2, module2) {
10090
10587
  "use strict";
10091
10588
  var SemVer = require_semver();
10092
- var parse7 = require_parse2();
10589
+ var parse8 = require_parse3();
10093
10590
  var { safeRe: re, t } = require_re();
10094
10591
  var coerce = (version2, options) => {
10095
10592
  if (version2 instanceof SemVer) {
@@ -10124,7 +10621,7 @@ var require_coerce = __commonJS({
10124
10621
  const patch = match[4] || "0";
10125
10622
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
10126
10623
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
10127
- return parse7(`${major}.${minor}.${patch}${prerelease}${build}`, options);
10624
+ return parse8(`${major}.${minor}.${patch}${prerelease}${build}`, options);
10128
10625
  };
10129
10626
  module2.exports = coerce;
10130
10627
  }
@@ -10134,7 +10631,7 @@ var require_coerce = __commonJS({
10134
10631
  var require_truncate = __commonJS({
10135
10632
  "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/truncate.js"(exports2, module2) {
10136
10633
  "use strict";
10137
- var parse7 = require_parse2();
10634
+ var parse8 = require_parse3();
10138
10635
  var constants2 = require_constants();
10139
10636
  var SemVer = require_semver();
10140
10637
  var truncate3 = (version2, truncation, options) => {
@@ -10146,7 +10643,7 @@ var require_truncate = __commonJS({
10146
10643
  };
10147
10644
  var cloneInputVersion = (version2, options) => {
10148
10645
  const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
10149
- return parse7(versionStringToParse, options);
10646
+ return parse8(versionStringToParse, options);
10150
10647
  };
10151
10648
  var doTruncation = (version2, truncation) => {
10152
10649
  if (isPrerelease(truncation)) {
@@ -11182,7 +11679,7 @@ var require_semver2 = __commonJS({
11182
11679
  var constants2 = require_constants();
11183
11680
  var SemVer = require_semver();
11184
11681
  var identifiers = require_identifiers();
11185
- var parse7 = require_parse2();
11682
+ var parse8 = require_parse3();
11186
11683
  var valid = require_valid();
11187
11684
  var clean = require_clean();
11188
11685
  var inc = require_inc();
@@ -11221,7 +11718,7 @@ var require_semver2 = __commonJS({
11221
11718
  var simplifyRange = require_simplify();
11222
11719
  var subset = require_subset();
11223
11720
  module2.exports = {
11224
- parse: parse7,
11721
+ parse: parse8,
11225
11722
  valid,
11226
11723
  clean,
11227
11724
  inc,
@@ -13366,7 +13863,7 @@ var require_extension = __commonJS({
13366
13863
  if (dest[name] === void 0) dest[name] = [elem];
13367
13864
  else dest[name].push(elem);
13368
13865
  }
13369
- function parse7(header) {
13866
+ function parse8(header) {
13370
13867
  const offers = /* @__PURE__ */ Object.create(null);
13371
13868
  let params = /* @__PURE__ */ Object.create(null);
13372
13869
  let mustUnescape = false;
@@ -13506,7 +14003,7 @@ var require_extension = __commonJS({
13506
14003
  }).join(", ");
13507
14004
  }).join(", ");
13508
14005
  }
13509
- module2.exports = { format, parse: parse7 };
14006
+ module2.exports = { format, parse: parse8 };
13510
14007
  }
13511
14008
  });
13512
14009
 
@@ -13540,7 +14037,7 @@ var require_websocket = __commonJS({
13540
14037
  var {
13541
14038
  EventTarget: { addEventListener, removeEventListener }
13542
14039
  } = require_event_target();
13543
- var { format, parse: parse7 } = require_extension();
14040
+ var { format, parse: parse8 } = require_extension();
13544
14041
  var { toBuffer } = require_buffer_util();
13545
14042
  var kAborted = Symbol("kAborted");
13546
14043
  var protocolVersions = [8, 13];
@@ -14217,7 +14714,7 @@ var require_websocket = __commonJS({
14217
14714
  }
14218
14715
  let extensions;
14219
14716
  try {
14220
- extensions = parse7(secWebSocketExtensions);
14717
+ extensions = parse8(secWebSocketExtensions);
14221
14718
  } catch (err) {
14222
14719
  const message = "Invalid Sec-WebSocket-Extensions header";
14223
14720
  abortHandshake(websocket, socket, message);
@@ -14509,7 +15006,7 @@ var require_subprotocol = __commonJS({
14509
15006
  "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
14510
15007
  "use strict";
14511
15008
  var { tokenChars } = require_validation2();
14512
- function parse7(header) {
15009
+ function parse8(header) {
14513
15010
  const protocols = /* @__PURE__ */ new Set();
14514
15011
  let start = -1;
14515
15012
  let end = -1;
@@ -14545,7 +15042,7 @@ var require_subprotocol = __commonJS({
14545
15042
  protocols.add(protocol);
14546
15043
  return protocols;
14547
15044
  }
14548
- module2.exports = { parse: parse7 };
15045
+ module2.exports = { parse: parse8 };
14549
15046
  }
14550
15047
  });
14551
15048
 
@@ -15991,11 +16488,11 @@ var require_signals = __commonJS({
15991
16488
  // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
15992
16489
  var require_signal_exit = __commonJS({
15993
16490
  "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports2, module2) {
15994
- var process4 = global.process;
15995
- var processOk = function(process5) {
15996
- return process5 && typeof process5 === "object" && typeof process5.removeListener === "function" && typeof process5.emit === "function" && typeof process5.reallyExit === "function" && typeof process5.listeners === "function" && typeof process5.kill === "function" && typeof process5.pid === "number" && typeof process5.on === "function";
16491
+ var process5 = global.process;
16492
+ var processOk = function(process6) {
16493
+ return process6 && typeof process6 === "object" && typeof process6.removeListener === "function" && typeof process6.emit === "function" && typeof process6.reallyExit === "function" && typeof process6.listeners === "function" && typeof process6.kill === "function" && typeof process6.pid === "number" && typeof process6.on === "function";
15997
16494
  };
15998
- if (!processOk(process4)) {
16495
+ if (!processOk(process5)) {
15999
16496
  module2.exports = function() {
16000
16497
  return function() {
16001
16498
  };
@@ -16003,15 +16500,15 @@ var require_signal_exit = __commonJS({
16003
16500
  } else {
16004
16501
  assert2 = require("assert");
16005
16502
  signals = require_signals();
16006
- isWin = /^win/i.test(process4.platform);
16503
+ isWin = /^win/i.test(process5.platform);
16007
16504
  EE = require("events");
16008
16505
  if (typeof EE !== "function") {
16009
16506
  EE = EE.EventEmitter;
16010
16507
  }
16011
- if (process4.__signal_exit_emitter__) {
16012
- emitter = process4.__signal_exit_emitter__;
16508
+ if (process5.__signal_exit_emitter__) {
16509
+ emitter = process5.__signal_exit_emitter__;
16013
16510
  } else {
16014
- emitter = process4.__signal_exit_emitter__ = new EE();
16511
+ emitter = process5.__signal_exit_emitter__ = new EE();
16015
16512
  emitter.count = 0;
16016
16513
  emitter.emitted = {};
16017
16514
  }
@@ -16048,12 +16545,12 @@ var require_signal_exit = __commonJS({
16048
16545
  loaded = false;
16049
16546
  signals.forEach(function(sig) {
16050
16547
  try {
16051
- process4.removeListener(sig, sigListeners[sig]);
16548
+ process5.removeListener(sig, sigListeners[sig]);
16052
16549
  } catch (er) {
16053
16550
  }
16054
16551
  });
16055
- process4.emit = originalProcessEmit;
16056
- process4.reallyExit = originalProcessReallyExit;
16552
+ process5.emit = originalProcessEmit;
16553
+ process5.reallyExit = originalProcessReallyExit;
16057
16554
  emitter.count -= 1;
16058
16555
  };
16059
16556
  module2.exports.unload = unload;
@@ -16070,7 +16567,7 @@ var require_signal_exit = __commonJS({
16070
16567
  if (!processOk(global.process)) {
16071
16568
  return;
16072
16569
  }
16073
- var listeners = process4.listeners(sig);
16570
+ var listeners = process5.listeners(sig);
16074
16571
  if (listeners.length === emitter.count) {
16075
16572
  unload();
16076
16573
  emit("exit", null, sig);
@@ -16078,7 +16575,7 @@ var require_signal_exit = __commonJS({
16078
16575
  if (isWin && sig === "SIGHUP") {
16079
16576
  sig = "SIGINT";
16080
16577
  }
16081
- process4.kill(process4.pid, sig);
16578
+ process5.kill(process5.pid, sig);
16082
16579
  }
16083
16580
  };
16084
16581
  });
@@ -16094,36 +16591,36 @@ var require_signal_exit = __commonJS({
16094
16591
  emitter.count += 1;
16095
16592
  signals = signals.filter(function(sig) {
16096
16593
  try {
16097
- process4.on(sig, sigListeners[sig]);
16594
+ process5.on(sig, sigListeners[sig]);
16098
16595
  return true;
16099
16596
  } catch (er) {
16100
16597
  return false;
16101
16598
  }
16102
16599
  });
16103
- process4.emit = processEmit;
16104
- process4.reallyExit = processReallyExit;
16600
+ process5.emit = processEmit;
16601
+ process5.reallyExit = processReallyExit;
16105
16602
  };
16106
16603
  module2.exports.load = load;
16107
- originalProcessReallyExit = process4.reallyExit;
16604
+ originalProcessReallyExit = process5.reallyExit;
16108
16605
  processReallyExit = function processReallyExit2(code) {
16109
16606
  if (!processOk(global.process)) {
16110
16607
  return;
16111
16608
  }
16112
- process4.exitCode = code || /* istanbul ignore next */
16609
+ process5.exitCode = code || /* istanbul ignore next */
16113
16610
  0;
16114
- emit("exit", process4.exitCode, null);
16115
- emit("afterexit", process4.exitCode, null);
16116
- originalProcessReallyExit.call(process4, process4.exitCode);
16611
+ emit("exit", process5.exitCode, null);
16612
+ emit("afterexit", process5.exitCode, null);
16613
+ originalProcessReallyExit.call(process5, process5.exitCode);
16117
16614
  };
16118
- originalProcessEmit = process4.emit;
16615
+ originalProcessEmit = process5.emit;
16119
16616
  processEmit = function processEmit2(ev, arg) {
16120
16617
  if (ev === "exit" && processOk(global.process)) {
16121
16618
  if (arg !== void 0) {
16122
- process4.exitCode = arg;
16619
+ process5.exitCode = arg;
16123
16620
  }
16124
16621
  var ret = originalProcessEmit.apply(this, arguments);
16125
- emit("exit", process4.exitCode, null);
16126
- emit("afterexit", process4.exitCode, null);
16622
+ emit("exit", process5.exitCode, null);
16623
+ emit("afterexit", process5.exitCode, null);
16127
16624
  return ret;
16128
16625
  } else {
16129
16626
  return originalProcessEmit.apply(this, arguments);
@@ -17420,7 +17917,7 @@ var require_regex = __commonJS({
17420
17917
  });
17421
17918
 
17422
17919
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
17423
- var require_mode = __commonJS({
17920
+ var require_mode2 = __commonJS({
17424
17921
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js"(exports2) {
17425
17922
  var VersionCheck = require_version_check();
17426
17923
  var Regex = require_regex();
@@ -17506,7 +18003,7 @@ var require_version = __commonJS({
17506
18003
  var Utils = require_utils2();
17507
18004
  var ECCode = require_error_correction_code();
17508
18005
  var ECLevel = require_error_correction_level();
17509
- var Mode = require_mode();
18006
+ var Mode = require_mode2();
17510
18007
  var VersionCheck = require_version_check();
17511
18008
  var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
17512
18009
  var G18_BCH = Utils.getBCHDigit(G18);
@@ -17616,7 +18113,7 @@ var require_format_info = __commonJS({
17616
18113
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
17617
18114
  var require_numeric_data = __commonJS({
17618
18115
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js"(exports2, module2) {
17619
- var Mode = require_mode();
18116
+ var Mode = require_mode2();
17620
18117
  function NumericData(data) {
17621
18118
  this.mode = Mode.NUMERIC;
17622
18119
  this.data = data.toString();
@@ -17651,7 +18148,7 @@ var require_numeric_data = __commonJS({
17651
18148
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
17652
18149
  var require_alphanumeric_data = __commonJS({
17653
18150
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js"(exports2, module2) {
17654
- var Mode = require_mode();
18151
+ var Mode = require_mode2();
17655
18152
  var ALPHA_NUM_CHARS = [
17656
18153
  "0",
17657
18154
  "1",
@@ -17730,7 +18227,7 @@ var require_alphanumeric_data = __commonJS({
17730
18227
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
17731
18228
  var require_byte_data = __commonJS({
17732
18229
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js"(exports2, module2) {
17733
- var Mode = require_mode();
18230
+ var Mode = require_mode2();
17734
18231
  function ByteData(data) {
17735
18232
  this.mode = Mode.BYTE;
17736
18233
  if (typeof data === "string") {
@@ -17760,7 +18257,7 @@ var require_byte_data = __commonJS({
17760
18257
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
17761
18258
  var require_kanji_data = __commonJS({
17762
18259
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js"(exports2, module2) {
17763
- var Mode = require_mode();
18260
+ var Mode = require_mode2();
17764
18261
  var Utils = require_utils2();
17765
18262
  function KanjiData(data) {
17766
18263
  this.mode = Mode.KANJI;
@@ -17900,7 +18397,7 @@ var require_dijkstra = __commonJS({
17900
18397
  // ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
17901
18398
  var require_segments = __commonJS({
17902
18399
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js"(exports2) {
17903
- var Mode = require_mode();
18400
+ var Mode = require_mode2();
17904
18401
  var NumericData = require_numeric_data();
17905
18402
  var AlphanumericData = require_alphanumeric_data();
17906
18403
  var ByteData = require_byte_data();
@@ -18097,7 +18594,7 @@ var require_qrcode = __commonJS({
18097
18594
  var ReedSolomonEncoder = require_reed_solomon_encoder();
18098
18595
  var Version = require_version();
18099
18596
  var FormatInfo = require_format_info();
18100
- var Mode = require_mode();
18597
+ var Mode = require_mode2();
18101
18598
  var Segments = require_segments();
18102
18599
  function setupFinderPattern(matrix, version2) {
18103
18600
  const size = matrix.size;
@@ -20276,10 +20773,10 @@ var require_packer_sync = __commonJS({
20276
20773
  var require_png_sync = __commonJS({
20277
20774
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/png-sync.js"(exports2) {
20278
20775
  "use strict";
20279
- var parse7 = require_parser_sync();
20776
+ var parse8 = require_parser_sync();
20280
20777
  var pack = require_packer_sync();
20281
20778
  exports2.read = function(buffer, options) {
20282
- return parse7(buffer, options || {});
20779
+ return parse8(buffer, options || {});
20283
20780
  };
20284
20781
  exports2.write = function(png, options) {
20285
20782
  return pack(png, options);
@@ -21114,7 +21611,7 @@ async function installPublicMcpServerToConfigs(serverId, expected) {
21114
21611
  if (await pathExists5(codexPath)) {
21115
21612
  try {
21116
21613
  const content = await import_promises15.default.readFile(codexPath, "utf8");
21117
- const parsed = toml3.parse(content);
21614
+ const parsed = toml4.parse(content);
21118
21615
  if (!parsed.mcp_servers?.[serverId]) {
21119
21616
  const appended = content.replace(/\n$/, "") + renderTomlBlock(serverId, expected);
21120
21617
  await writeAtomic(codexPath, appended);
@@ -21146,14 +21643,14 @@ async function installPublicMcpServerToConfigs(serverId, expected) {
21146
21643
  await writeAtomic(agyPath, JSON.stringify({ mcpServers: { [serverId]: expected } }, null, 2) + "\n");
21147
21644
  }
21148
21645
  }
21149
- var import_promises15, import_node_os16, import_node_path36, toml3;
21646
+ var import_promises15, import_node_os16, import_node_path36, toml4;
21150
21647
  var init_install_public_mcp = __esm({
21151
21648
  "src/install-public-mcp.ts"() {
21152
21649
  "use strict";
21153
21650
  import_promises15 = __toESM(require("node:fs/promises"), 1);
21154
21651
  import_node_os16 = __toESM(require("node:os"), 1);
21155
21652
  import_node_path36 = __toESM(require("node:path"), 1);
21156
- toml3 = __toESM(require_toml(), 1);
21653
+ toml4 = __toESM(require_toml(), 1);
21157
21654
  }
21158
21655
  });
21159
21656
 
@@ -21168,7 +21665,7 @@ var import_node_path42 = __toESM(require("node:path"), 1);
21168
21665
  var import_promises = __toESM(require("node:fs/promises"), 1);
21169
21666
  var import_node_os3 = __toESM(require("node:os"), 1);
21170
21667
  var import_node_path3 = __toESM(require("node:path"), 1);
21171
- var toml = __toESM(require_toml(), 1);
21668
+ var toml2 = __toESM(require_toml(), 1);
21172
21669
 
21173
21670
  // src/api-base-url.ts
21174
21671
  var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
@@ -21242,17 +21739,10 @@ function isLoopbackUrl(input) {
21242
21739
  function readConfiguredApiBaseUrl(explicit) {
21243
21740
  const direct = explicit ?? process.env.MRRLIN_API_BASE_URL;
21244
21741
  if (direct?.trim()) return retargetRetiredApiBaseUrl(direct.trim()).baseUrl;
21245
- if (process.env.MRRLIN_STAGING === "1") return STAGING_API_BASE_URL;
21246
- return DEFAULT_API_BASE_URL;
21247
- }
21248
- function readDirectorBridgeApiBaseUrl(explicit) {
21249
- const direct = explicit ?? process.env.MRRLIN_API_BASE_URL;
21250
- if (direct?.trim()) return retargetRetiredApiBaseUrl(direct.trim()).baseUrl;
21251
- if (process.env.MRRLIN_STAGING === "1") return STAGING_API_BASE_URL;
21252
21742
  return PRODUCTION_API_BASE_URL;
21253
21743
  }
21254
- function isRemoteApiAllowed(apiBaseUrl) {
21255
- return isLoopbackUrl(apiBaseUrl) || isStagingApiBaseUrl(apiBaseUrl) || isProductionApiBaseUrl(apiBaseUrl) || process.env.MRRLIN_API_ALLOW_REMOTE === "1";
21744
+ function readDirectorBridgeApiBaseUrl(explicit) {
21745
+ return readConfiguredApiBaseUrl(explicit);
21256
21746
  }
21257
21747
  function readProbeTimeoutMs(env) {
21258
21748
  const raw = Number((env.MRRLIN_API_PROBE_TIMEOUT_MS ?? "").trim());
@@ -21281,16 +21771,12 @@ async function resolveApiBaseUrlDynamic(opts = {}) {
21281
21771
  const { baseUrl, retargeted } = retargetRetiredApiBaseUrl(direct.trim());
21282
21772
  return { baseUrl, source: retargeted ? "retired-retarget" : "explicit" };
21283
21773
  }
21284
- if ((env.MRRLIN_STAGING ?? "").trim() === "1") {
21285
- return { baseUrl: STAGING_API_BASE_URL, source: "staging-env" };
21286
- }
21287
21774
  const autoDetect = (env.MRRLIN_API_AUTODETECT ?? "").trim() === "1";
21288
21775
  const timeoutMs = opts.probeTimeoutMs ?? readProbeTimeoutMs(env);
21289
21776
  if (autoDetect) {
21290
21777
  if (await probeLocalHealth(DEFAULT_API_BASE_URL, timeoutMs, fetchImpl)) {
21291
21778
  return { baseUrl: DEFAULT_API_BASE_URL, source: "local-probe" };
21292
21779
  }
21293
- return { baseUrl: STAGING_API_BASE_URL, source: "staging-autodetect" };
21294
21780
  }
21295
21781
  return { baseUrl: PRODUCTION_API_BASE_URL, source: "production-default" };
21296
21782
  }
@@ -21496,7 +21982,8 @@ async function installBrowser(opts = {}) {
21496
21982
  var import_node_fs = __toESM(require("node:fs"), 1);
21497
21983
  var import_node_os2 = __toESM(require("node:os"), 1);
21498
21984
  var import_node_path2 = __toESM(require("node:path"), 1);
21499
- var KNOWN_MRRLIN_ENV_KEYS = /* @__PURE__ */ new Set(["MRRLIN_STAGING", "MRRLIN_API_BASE_URL", "MRRLIN_API_ALLOW_REMOTE"]);
21985
+ var toml = __toESM(require_toml(), 1);
21986
+ var KNOWN_MRRLIN_ENV_KEYS = /* @__PURE__ */ new Set(["MRRLIN_API_BASE_URL"]);
21500
21987
  function commandArgsTimeoutEqual(candidate, expected) {
21501
21988
  if (candidate.command !== expected.command) return false;
21502
21989
  const actualArgs = candidate.args === void 0 && expected.args.length === 0 ? [] : Array.isArray(candidate.args) ? candidate.args : null;
@@ -21525,13 +22012,9 @@ function tablesEqual(actual, expected) {
21525
22012
  }
21526
22013
  function isCoherentMrrlinEnv(env) {
21527
22014
  const keys = Object.keys(env);
21528
- const staging = env.MRRLIN_STAGING;
21529
22015
  const url2 = env.MRRLIN_API_BASE_URL;
21530
- const allowRemote = env.MRRLIN_API_ALLOW_REMOTE;
21531
22016
  const hasUrl = typeof url2 === "string" && url2.trim() !== "";
21532
- if (keys.length === 1 && staging === "1") return true;
21533
22017
  if (keys.length === 1 && hasUrl) return true;
21534
- if (keys.length === 2 && hasUrl && allowRemote === "1") return true;
21535
22018
  return false;
21536
22019
  }
21537
22020
  function classifyExistingBlock(actual, expected) {
@@ -21561,9 +22044,6 @@ function blockEnvHasRetiredApiUrl(actual) {
21561
22044
  }
21562
22045
  return retiredApiHostnames().includes(hostname3);
21563
22046
  }
21564
- function isFirstPartyOrLoopbackApiUrl(value) {
21565
- return isStagingApiBaseUrl(value) || isProductionApiBaseUrl(value) || isLoopbackUrl(value);
21566
- }
21567
22047
  function normalizedApiUrlFromEnv(env) {
21568
22048
  const pinned = env.MRRLIN_API_BASE_URL;
21569
22049
  if (typeof pinned === "string" && pinned.trim()) return retargetRetiredApiBaseUrl(pinned.trim()).baseUrl;
@@ -21574,10 +22054,11 @@ function blockEnvNeedsApiRoutingMigration(actual) {
21574
22054
  const env = actual.env;
21575
22055
  if (typeof env !== "object" || env === null) return false;
21576
22056
  const vars = env;
21577
- if (vars.MRRLIN_STAGING === "1") return true;
22057
+ if (vars.MRRLIN_STAGING !== void 0) return true;
22058
+ if (vars.MRRLIN_API_ALLOW_REMOTE !== void 0) return true;
21578
22059
  if (blockEnvHasRetiredApiUrl(actual)) return true;
21579
22060
  const apiUrl = normalizedApiUrlFromEnv(vars);
21580
- return apiUrl !== void 0 && (isProductionApiBaseUrl(apiUrl) || vars.MRRLIN_API_ALLOW_REMOTE === "1" && isFirstPartyOrLoopbackApiUrl(apiUrl));
22061
+ return apiUrl !== void 0 && isProductionApiBaseUrl(apiUrl);
21581
22062
  }
21582
22063
  function renderEnvPreservedNotice(blockId, envKeys) {
21583
22064
  const keys = [...envKeys].sort().join(", ");
@@ -21598,9 +22079,6 @@ function reconcileMcpServerBlock(existing, desired) {
21598
22079
  }
21599
22080
  if (apiUrl && !isProductionApiBaseUrl(apiUrl)) {
21600
22081
  healedEnv.MRRLIN_API_BASE_URL = apiUrl;
21601
- if (existingEnv.MRRLIN_API_ALLOW_REMOTE === "1" && !isFirstPartyOrLoopbackApiUrl(apiUrl)) {
21602
- healedEnv.MRRLIN_API_ALLOW_REMOTE = "1";
21603
- }
21604
22082
  }
21605
22083
  const finalEnv = { ...desired.env, ...healedEnv };
21606
22084
  const block = { ...desired };
@@ -21627,27 +22105,76 @@ function readMcpServerById(configPath, serverId) {
21627
22105
  } catch {
21628
22106
  return null;
21629
22107
  }
21630
- let parsed;
21631
- try {
21632
- parsed = JSON.parse(raw);
21633
- } catch {
21634
- return null;
22108
+ let servers;
22109
+ if (configPath.endsWith(".toml")) {
22110
+ try {
22111
+ const parsed = toml.parse(raw);
22112
+ servers = parsed.mcp_servers ?? parsed.mcpServers;
22113
+ } catch {
22114
+ return null;
22115
+ }
22116
+ } else {
22117
+ let parsed;
22118
+ try {
22119
+ parsed = JSON.parse(raw);
22120
+ } catch {
22121
+ return null;
22122
+ }
22123
+ if (typeof parsed !== "object" || parsed === null) return null;
22124
+ const rawServers = parsed.mcpServers ?? parsed.mcp_servers;
22125
+ if (typeof rawServers !== "object" || rawServers === null) return null;
22126
+ servers = rawServers;
21635
22127
  }
21636
- if (typeof parsed !== "object" || parsed === null) return null;
21637
- const servers = parsed.mcpServers;
21638
- if (typeof servers !== "object" || servers === null) return null;
22128
+ if (!servers || typeof servers !== "object") return null;
21639
22129
  const entry = servers[serverId];
21640
22130
  if (typeof entry !== "object" || entry === null) return null;
21641
- const url2 = entry.url;
21642
- if (typeof url2 !== "string" || url2.trim() === "") return null;
21643
- const rawHeaders = entry.headers;
21644
- const headers = {};
21645
- if (typeof rawHeaders === "object" && rawHeaders !== null) {
21646
- for (const [key, value] of Object.entries(rawHeaders)) {
21647
- if (typeof value === "string") headers[key] = value;
22131
+ const record2 = entry;
22132
+ const url2 = typeof record2.url === "string" ? record2.url.trim() : "";
22133
+ const command = typeof record2.command === "string" ? record2.command.trim() : "";
22134
+ if (url2 !== "" && command !== "") return null;
22135
+ if (url2 !== "") {
22136
+ try {
22137
+ new URL(url2);
22138
+ } catch {
22139
+ return null;
22140
+ }
22141
+ const rawHeaders = record2.headers;
22142
+ const headers = {};
22143
+ if (rawHeaders !== void 0) {
22144
+ if (typeof rawHeaders !== "object" || rawHeaders === null || Array.isArray(rawHeaders)) {
22145
+ return null;
22146
+ }
22147
+ for (const [key, value] of Object.entries(rawHeaders)) {
22148
+ if (typeof value !== "string") return null;
22149
+ headers[key] = value;
22150
+ }
22151
+ }
22152
+ return { id: serverId, transport: "http", url: url2, headers };
22153
+ }
22154
+ if (command !== "") {
22155
+ const rawArgs = record2.args;
22156
+ const args = [];
22157
+ if (rawArgs !== void 0) {
22158
+ if (!Array.isArray(rawArgs)) return null;
22159
+ for (const item of rawArgs) {
22160
+ if (typeof item !== "string") return null;
22161
+ args.push(item);
22162
+ }
21648
22163
  }
22164
+ const rawEnv = record2.env;
22165
+ const env = {};
22166
+ if (rawEnv !== void 0) {
22167
+ if (typeof rawEnv !== "object" || rawEnv === null || Array.isArray(rawEnv)) {
22168
+ return null;
22169
+ }
22170
+ for (const [key, value] of Object.entries(rawEnv)) {
22171
+ if (typeof value !== "string") return null;
22172
+ env[key] = value;
22173
+ }
22174
+ }
22175
+ return { id: serverId, transport: "stdio", command, args, env };
21649
22176
  }
21650
- return { url: url2, headers };
22177
+ return null;
21651
22178
  }
21652
22179
  function parseTomlMcpServers(raw) {
21653
22180
  const result = {};
@@ -21779,11 +22306,8 @@ function deriveServeEnvFromProcessEnv(env) {
21779
22306
  if (apiUrl) {
21780
22307
  if (!isProductionApiBaseUrl(apiUrl)) {
21781
22308
  out.MRRLIN_API_BASE_URL = apiUrl;
21782
- if (env.MRRLIN_API_ALLOW_REMOTE === "1" && !isStagingApiBaseUrl(apiUrl) && !isLoopbackUrl(apiUrl)) {
21783
- out.MRRLIN_API_ALLOW_REMOTE = "1";
21784
- }
21785
22309
  }
21786
- } else if (env.MRRLIN_STAGING === "1" || bridgeWantsStaging) {
22310
+ } else if (bridgeWantsStaging) {
21787
22311
  out.MRRLIN_API_BASE_URL = STAGING_API_BASE_URL;
21788
22312
  }
21789
22313
  return Object.keys(out).length > 0 ? out : void 0;
@@ -21904,7 +22428,7 @@ async function installCodex(options) {
21904
22428
  let content = await import_promises.default.readFile(realPath, "utf8");
21905
22429
  let parsed = null;
21906
22430
  try {
21907
- parsed = toml.parse(content);
22431
+ parsed = toml2.parse(content);
21908
22432
  } catch (error51) {
21909
22433
  const detail = error51 instanceof Error ? error51.message : String(error51);
21910
22434
  const err = {
@@ -22327,7 +22851,7 @@ __export(external_exports, {
22327
22851
  object: () => object,
22328
22852
  optional: () => optional,
22329
22853
  overwrite: () => _overwrite,
22330
- parse: () => parse3,
22854
+ parse: () => parse4,
22331
22855
  parseAsync: () => parseAsync2,
22332
22856
  partialRecord: () => partialRecord,
22333
22857
  pipe: () => pipe,
@@ -22647,7 +23171,7 @@ __export(core_exports2, {
22647
23171
  isValidJWT: () => isValidJWT,
22648
23172
  locales: () => locales_exports,
22649
23173
  meta: () => meta,
22650
- parse: () => parse2,
23174
+ parse: () => parse3,
22651
23175
  parseAsync: () => parseAsync,
22652
23176
  prettifyError: () => prettifyError,
22653
23177
  process: () => process2,
@@ -23592,7 +24116,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
23592
24116
  }
23593
24117
  return result.value;
23594
24118
  };
23595
- var parse2 = /* @__PURE__ */ _parse($ZodRealError);
24119
+ var parse3 = /* @__PURE__ */ _parse($ZodRealError);
23596
24120
  var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
23597
24121
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
23598
24122
  let result = schema._zod.run({ value, issues: [] }, ctx);
@@ -26384,10 +26908,10 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
26384
26908
  throw new Error("implement() must be called with a function");
26385
26909
  }
26386
26910
  return function(...args) {
26387
- const parsedArgs = inst._def.input ? parse2(inst._def.input, args) : args;
26911
+ const parsedArgs = inst._def.input ? parse3(inst._def.input, args) : args;
26388
26912
  const result = Reflect.apply(func, this, parsedArgs);
26389
26913
  if (inst._def.output) {
26390
- return parse2(inst._def.output, result);
26914
+ return parse3(inst._def.output, result);
26391
26915
  }
26392
26916
  return result;
26393
26917
  };
@@ -34821,7 +35345,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
34821
35345
  });
34822
35346
 
34823
35347
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
34824
- var parse3 = /* @__PURE__ */ _parse(ZodRealError);
35348
+ var parse4 = /* @__PURE__ */ _parse(ZodRealError);
34825
35349
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
34826
35350
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
34827
35351
  var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -34884,7 +35408,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
34884
35408
  inst.def = def;
34885
35409
  inst.type = def.type;
34886
35410
  Object.defineProperty(inst, "_def", { value: def });
34887
- inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
35411
+ inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
34888
35412
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
34889
35413
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
34890
35414
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
@@ -36691,11 +37215,11 @@ function resolveKindCapability(kind) {
36691
37215
  var REFUSAL_TEMPLATES = {
36692
37216
  no_route: {
36693
37217
  happened: ({ artifactKind, projectSlug }) => `Nothing is configured to deliver \`${artifactKind}\` for project \`${projectSlug}\`.`,
36694
- action: ({ capability }) => `Grant an MCP server that provides the "${capability}" capability and route it on the Integrations page. Retrying before that will refuse identically.`
37218
+ action: ({ capability }) => `Grant an MCP server that provides the "${capability}" capability and route it on the Integrations page (/integrations?query=${encodeURIComponent(capability)}). Retrying before that will refuse identically.`
36695
37219
  },
36696
37220
  no_grant: {
36697
37221
  happened: ({ projectSlug, capability }) => `Project \`${projectSlug}\` routes "${capability}" to a server whose access has been revoked.`,
36698
- action: () => "Grant that server again on the Integrations page, or re-point the route. Retrying before that will refuse identically."
37222
+ action: ({ capability }) => `Grant that server again on the Integrations page (/integrations?query=${encodeURIComponent(capability)}), or re-point the route. Retrying before that will refuse identically.`
36699
37223
  },
36700
37224
  project_mismatch: {
36701
37225
  happened: ({ capability }) => `The route for "${capability}" belongs to a different project than this task does.`,
@@ -36764,7 +37288,6 @@ var openApiOperationIds = {
36764
37288
  deleteTaskDependency: "deleteTaskDependency",
36765
37289
  getExecutionRun: "getExecutionRun",
36766
37290
  getProjectSchedulerPolicy: "getProjectSchedulerPolicy",
36767
- getProjectDeployWorkflow: "getProjectDeployWorkflow",
36768
37291
  getDeployTopology: "getDeployTopology",
36769
37292
  writeDeployTopology: "writeDeployTopology",
36770
37293
  getTaskDeployTarget: "getTaskDeployTarget",
@@ -36797,7 +37320,6 @@ var openApiOperationIds = {
36797
37320
  searchKnowledge: "searchKnowledge",
36798
37321
  updateExecutionRun: "updateExecutionRun",
36799
37322
  upsertProjectSchedulerPolicy: "upsertProjectSchedulerPolicy",
36800
- upsertProjectDeployWorkflow: "upsertProjectDeployWorkflow",
36801
37323
  updatePlan: "updatePlan",
36802
37324
  updateTask: "updateTask",
36803
37325
  updateWikiPage: "updateWikiPage",
@@ -37477,6 +37999,35 @@ var TASK_NOTES_JOURNAL_SECTIONS = [
37477
37999
  ];
37478
38000
  var JOURNAL_HEADING_RE = new RegExp(`^##[ \\t]+(${TASK_NOTES_JOURNAL_SECTIONS.map((s) => s.heading).join("|")})\\b[ \\t]*(?:[\u2014\u2013-][ \\t]*(\\S.*?))?[ \\t]*$`);
37479
38001
 
38002
+ // ../../packages/schemas/dist/integration-route-defaults.js
38003
+ var DEFAULT_INTEGRATION_ROUTES = {
38004
+ github: {
38005
+ capability: "repo_host",
38006
+ artifactKind: "code_change",
38007
+ operations: {
38008
+ pull_request: "create_pull_request",
38009
+ pull_request_state: "get_pull_request"
38010
+ }
38011
+ },
38012
+ slack: {
38013
+ capability: "send",
38014
+ artifactKind: "message",
38015
+ operations: {
38016
+ dispatch: "slack_post_message"
38017
+ }
38018
+ }
38019
+ };
38020
+ var SERVER_ALIASES = {
38021
+ "github-mcp": "github",
38022
+ gh: "github",
38023
+ "github-server": "github",
38024
+ "slack-mcp": "slack"
38025
+ };
38026
+ function getDefaultCapabilityRouteForServer(serverId) {
38027
+ const normalizedId = (SERVER_ALIASES[serverId.toLowerCase()] ?? serverId).toLowerCase();
38028
+ return DEFAULT_INTEGRATION_ROUTES[normalizedId] ?? null;
38029
+ }
38030
+
37480
38031
  // ../../packages/schemas/dist/index.js
37481
38032
  var mrrlinTaskStatusSchema = external_exports.enum([
37482
38033
  "backlog",
@@ -37556,7 +38107,7 @@ var mrrlinDeclaredOutcomeSchema = mrrlinDeclaredOutcomeShapeSchema.superRefine((
37556
38107
  var mrrlinReceiptSchema = external_exports.object({
37557
38108
  kind: external_exports.enum(["outcome", "attempt"]),
37558
38109
  evidence: external_exports.object({
37559
- type: external_exports.enum(["url", "build", "human_tap"]),
38110
+ type: external_exports.enum(["url", "build", "status", "human_tap"]),
37560
38111
  value: external_exports.string().trim().min(1)
37561
38112
  }),
37562
38113
  observedAt: external_exports.string().datetime(),
@@ -38106,9 +38657,9 @@ function refineTaskCreateDomain(data, ctx) {
38106
38657
  }
38107
38658
  var mrrlinTaskCreateSchema = mrrlinTaskCreateShapeSchema.superRefine(refineTaskCreateDomain);
38108
38659
  var mrrlinTaskCreateWithoutIdSchema = mrrlinTaskCreateShapeSchema.omit({ id: true }).superRefine(refineTaskCreateDomain);
38109
- var mrrlinDeployWorkflowEnvSchema = external_exports.enum(["dev", "prod"]);
38660
+ var mrrlinDeployEnvSchema = external_exports.enum(["dev", "prod"]);
38110
38661
  var mrrlinTaskDeployTargetInputSchema = external_exports.object({
38111
- env: mrrlinDeployWorkflowEnvSchema,
38662
+ env: mrrlinDeployEnvSchema,
38112
38663
  targetLabel: external_exports.string().min(1),
38113
38664
  // publish-as-capability: which provider's namespace the workflow fields below belong to. Defaulted
38114
38665
  // rather than required so adding it breaks no caller, and `github` is the only provider that
@@ -38126,7 +38677,7 @@ var deployTopologyResponseSchema = external_exports.object({
38126
38677
  snapshot: external_exports.array(external_exports.object({ id: external_exports.number(), path: external_exports.string(), sha: external_exports.string(), state: external_exports.string() })).nullable(),
38127
38678
  entries: external_exports.array(external_exports.object({
38128
38679
  label: external_exports.string(),
38129
- env: mrrlinDeployWorkflowEnvSchema,
38680
+ env: mrrlinDeployEnvSchema,
38130
38681
  workflowId: external_exports.number(),
38131
38682
  workflowPath: external_exports.string(),
38132
38683
  workflowSha: external_exports.string()
@@ -38137,7 +38688,7 @@ var mrrlinDeployTopologyWriteSchema = external_exports.object({
38137
38688
  fingerprint: external_exports.string().min(1),
38138
38689
  entries: external_exports.array(external_exports.object({
38139
38690
  label: external_exports.string().min(1),
38140
- env: mrrlinDeployWorkflowEnvSchema,
38691
+ env: mrrlinDeployEnvSchema,
38141
38692
  workflowId: external_exports.number().int().positive(),
38142
38693
  workflowPath: external_exports.string().min(1),
38143
38694
  workflowSha: external_exports.string().min(1)
@@ -38881,37 +39432,6 @@ var mrrlinProjectSchedulerPolicyUpsertSchema = external_exports.object({
38881
39432
  var projectSchedulerPolicyResponseSchema = external_exports.object({
38882
39433
  data: mrrlinProjectSchedulerPolicySchema
38883
39434
  });
38884
- var mrrlinDeployWorkflowSourceSchema = external_exports.enum(["agent", "operator"]);
38885
- var mrrlinDeployWorkflowStateSchema = external_exports.enum(["resolved", "ambiguous"]);
38886
- var mrrlinProjectDeployWorkflowSchema = external_exports.object({
38887
- projectSlug: mrrlinProjectSlugSchema,
38888
- env: mrrlinDeployWorkflowEnvSchema,
38889
- workflowId: external_exports.number().int().positive().nullable(),
38890
- workflowPath: external_exports.string().nullable(),
38891
- reason: external_exports.string().nullable(),
38892
- source: mrrlinDeployWorkflowSourceSchema.nullable(),
38893
- state: mrrlinDeployWorkflowStateSchema,
38894
- activeSetFingerprint: external_exports.string().nullable(),
38895
- reverifyRequested: external_exports.boolean(),
38896
- resolvedAt: external_exports.string().datetime().nullable(),
38897
- createdAt: external_exports.string().datetime(),
38898
- updatedAt: external_exports.string().datetime()
38899
- });
38900
- var mrrlinProjectDeployWorkflowUpsertSchema = external_exports.object({
38901
- workflowId: external_exports.number().int().positive().nullable(),
38902
- workflowPath: external_exports.string().nullable().optional(),
38903
- reason: external_exports.string().nullable().optional(),
38904
- state: mrrlinDeployWorkflowStateSchema.optional(),
38905
- activeSetFingerprint: external_exports.string().nullable().optional(),
38906
- reverifyRequested: external_exports.boolean().optional()
38907
- }).refine((value) => (value.state ?? "resolved") !== "resolved" || value.workflowId !== null, {
38908
- message: "A resolved deploy-workflow row requires a non-null workflowId."
38909
- }).refine((value) => (value.state ?? "resolved") !== "ambiguous" || value.workflowId === null, {
38910
- message: "An ambiguous deploy-workflow row must not carry a workflowId."
38911
- });
38912
- var projectDeployWorkflowResponseSchema = external_exports.object({
38913
- data: mrrlinProjectDeployWorkflowSchema
38914
- });
38915
39435
  var mrrlinSchedulerPendingReasonSchema = external_exports.enum([
38916
39436
  "follow_up_due",
38917
39437
  "verification_due",
@@ -40654,13 +41174,37 @@ var CATEGORIES = [
40654
41174
  ];
40655
41175
  var CAT_SET = new Set(CATEGORIES);
40656
41176
  function parseVerdict(raw) {
40657
- const verdictMatch = raw.match(/\*\*Verdict\*\*:\s*(APPROVE|REQUEST_CHANGES|REJECT)\b/i);
40658
- const parsedVerdict = verdictMatch?.[1]?.toUpperCase();
40659
- const verdict = parsedVerdict === "APPROVE" || parsedVerdict === "REQUEST_CHANGES" || parsedVerdict === "REJECT" ? parsedVerdict : "REQUEST_CHANGES";
40660
- const afterCritical = raw.split(/\*\*Critical issues\*\*/i)[1];
40661
- const block = afterCritical?.split(/\n\*\*/)[0] ?? "";
40662
41177
  const issues = [];
40663
41178
  const parseFallbacks = [];
41179
+ const VERDICT_LINE_RE = /^[ \t]*(>?[ \t]*)(?:\*\*)?Verdict(?:\*\*)?:[ \t]*(.*)$/i;
41180
+ const APPROVE_VAL_RE = /^(?:\*\*)?[ \t]*APPROVE[ \t]*(?:\*\*)?$/i;
41181
+ const REQUEST_CHANGES_VAL_RE = /^(?:\*\*)?[ \t]*REQUEST[ _]CHANGES\b/i;
41182
+ const REJECT_VAL_RE = /^(?:\*\*)?[ \t]*REJECT\b/i;
41183
+ const candidates = [];
41184
+ for (const line of raw.split(/\r?\n/)) {
41185
+ const m = line.match(VERDICT_LINE_RE);
41186
+ if (!m) continue;
41187
+ const isBlockquote = m[1]?.includes(">") ?? false;
41188
+ const rest = (m[2] ?? "").trim();
41189
+ if (APPROVE_VAL_RE.test(rest)) {
41190
+ candidates.push({ verdict: "APPROVE", isBlockquote, line });
41191
+ } else if (REQUEST_CHANGES_VAL_RE.test(rest)) {
41192
+ candidates.push({ verdict: "REQUEST_CHANGES", isBlockquote, line });
41193
+ } else if (REJECT_VAL_RE.test(rest)) {
41194
+ candidates.push({ verdict: "REJECT", isBlockquote, line });
41195
+ }
41196
+ }
41197
+ const unquoted = candidates.filter((c) => !c.isBlockquote);
41198
+ const eligible = unquoted.length > 0 ? unquoted : candidates;
41199
+ const chosen = eligible.length > 0 ? eligible[eligible.length - 1] : null;
41200
+ let verdict;
41201
+ if (chosen) {
41202
+ verdict = chosen.verdict;
41203
+ } else {
41204
+ verdict = "REQUEST_CHANGES";
41205
+ }
41206
+ const afterCritical = raw.split(/\*\*Critical issues\*\*/i)[1] ?? raw.split(/(?:\*\*)?Critical issues(?:\*\*)?:?/i)[1];
41207
+ const block = afterCritical?.split(/\n\*\*/)[0] ?? "";
40664
41208
  for (const line of block.split(/\r?\n/)) {
40665
41209
  const bulletMatch = line.match(/^\s*-\s+(.*\S)\s*$/);
40666
41210
  if (!bulletMatch) continue;
@@ -43584,7 +44128,7 @@ function firstString(...values) {
43584
44128
  return null;
43585
44129
  }
43586
44130
  function runCodexExec(input, deps) {
43587
- const spawn5 = deps?.spawn ?? import_node_child_process6.spawn;
44131
+ const spawn6 = deps?.spawn ?? import_node_child_process6.spawn;
43588
44132
  const executable = input.codexExecutable ?? "codex";
43589
44133
  const sandbox = input.sandbox ?? "read-only";
43590
44134
  const fullPrompt = input.developerInstructions.trim() ? `${input.developerInstructions.trim()}
@@ -43624,7 +44168,7 @@ ${input.prompt}` : input.prompt;
43624
44168
  };
43625
44169
  let child;
43626
44170
  try {
43627
- child = spawn5(executable, args, options);
44171
+ child = spawn6(executable, args, options);
43628
44172
  } catch (err) {
43629
44173
  finish({ ok: false, error: `Failed to spawn codex exec: ${errMessage(err)}` });
43630
44174
  return;
@@ -43667,7 +44211,7 @@ function errMessage(err) {
43667
44211
  // ../../packages/agent-client/dist/providers/claude/exec.js
43668
44212
  var import_node_child_process7 = require("node:child_process");
43669
44213
  function runClaudeExec(input, deps) {
43670
- const spawn5 = deps?.spawn ?? import_node_child_process7.spawn;
44214
+ const spawn6 = deps?.spawn ?? import_node_child_process7.spawn;
43671
44215
  const executable = input.codexExecutable ?? "claude";
43672
44216
  const args = ["--print", "--output-format", "json", "--strict-mcp-config"];
43673
44217
  if (input.mcpConfig) {
@@ -43705,7 +44249,7 @@ function runClaudeExec(input, deps) {
43705
44249
  };
43706
44250
  let child;
43707
44251
  try {
43708
- child = spawn5(executable, args, options);
44252
+ child = spawn6(executable, args, options);
43709
44253
  } catch (err) {
43710
44254
  finish({ ok: false, error: `Failed to spawn ${executable} exec: ${errMessage2(err)}` });
43711
44255
  return;
@@ -44868,7 +45412,7 @@ var DEFAULT_STATUS_TIMEOUT_MS = 1e4;
44868
45412
  function errMessage3(err) {
44869
45413
  return err instanceof Error ? err.message : String(err);
44870
45414
  }
44871
- function runExternalAgentsStatus(bin, args, timeoutMs, spawn5) {
45415
+ function runExternalAgentsStatus(bin, args, timeoutMs, spawn6) {
44872
45416
  return new Promise((resolve) => {
44873
45417
  let settled = false;
44874
45418
  const timerRef = { id: void 0 };
@@ -44881,7 +45425,7 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn5) {
44881
45425
  const options = { stdio: ["ignore", "pipe", "pipe"], env: process.env, shell: false };
44882
45426
  let child;
44883
45427
  try {
44884
- child = spawn5(bin, args, options);
45428
+ child = spawn6(bin, args, options);
44885
45429
  } catch (err) {
44886
45430
  finish({ stdout: "", error: `spawn ${bin} failed: ${errMessage3(err)}` });
44887
45431
  return;
@@ -44905,13 +45449,13 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn5) {
44905
45449
  });
44906
45450
  }
44907
45451
  async function fetchRegistrySnapshot(deps) {
44908
- const spawn5 = deps?.spawn ?? import_node_child_process9.spawn;
45452
+ const spawn6 = deps?.spawn ?? import_node_child_process9.spawn;
44909
45453
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
44910
45454
  const { stdout, error: error51 } = await runExternalAgentsStatus(
44911
45455
  command,
44912
45456
  [...prefixArgs, "status", "--json"],
44913
45457
  deps?.statusTimeoutMs ?? DEFAULT_STATUS_TIMEOUT_MS,
44914
- spawn5
45458
+ spawn6
44915
45459
  );
44916
45460
  if (error51) return { ok: false, error: error51 };
44917
45461
  try {
@@ -44955,7 +45499,7 @@ function estimateTokenCount(text) {
44955
45499
  function errMessage4(err) {
44956
45500
  return err instanceof Error ? err.message : String(err);
44957
45501
  }
44958
- function runExternalAgents(bin, args, label, timeoutMs, spawn5) {
45502
+ function runExternalAgents(bin, args, label, timeoutMs, spawn6) {
44959
45503
  return new Promise((resolve) => {
44960
45504
  let settled = false;
44961
45505
  const timerRef = { id: void 0 };
@@ -44973,7 +45517,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn5) {
44973
45517
  };
44974
45518
  let child;
44975
45519
  try {
44976
- child = spawn5(bin, args, options);
45520
+ child = spawn6(bin, args, options);
44977
45521
  } catch (err) {
44978
45522
  finish({ code: null, stdout: "", error: `spawn ${bin} failed: ${errMessage4(err)}` });
44979
45523
  return;
@@ -44993,7 +45537,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn5) {
44993
45537
  });
44994
45538
  }
44995
45539
  async function pickPanel(input, deps) {
44996
- const spawn5 = deps?.spawn ?? import_node_child_process10.spawn;
45540
+ const spawn6 = deps?.spawn ?? import_node_child_process10.spawn;
44997
45541
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
44998
45542
  const args = [
44999
45543
  "pick",
@@ -45006,7 +45550,7 @@ async function pickPanel(input, deps) {
45006
45550
  "--exclude-providers",
45007
45551
  input.excludeProvider
45008
45552
  ];
45009
- const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs, spawn5);
45553
+ const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs, spawn6);
45010
45554
  if (r.error) return { ok: false, error: r.error };
45011
45555
  if (r.code === 3) return { ok: true, agents: [] };
45012
45556
  if (r.code !== 0) return { ok: false, error: `external-agents pick exited ${r.code}` };
@@ -45040,10 +45584,10 @@ function parseDispatch(agentId, stdout, exitCode) {
45040
45584
  return { ok: true, text: parsed.text, usage };
45041
45585
  }
45042
45586
  async function dispatchHead(agentId, prompt, timeoutMs, deps) {
45043
- const spawn5 = deps?.spawn ?? import_node_child_process10.spawn;
45587
+ const spawn6 = deps?.spawn ?? import_node_child_process10.spawn;
45044
45588
  const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
45045
45589
  const args = ["dispatch", agentId, "--json", prompt];
45046
- const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs, spawn5);
45590
+ const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs, spawn6);
45047
45591
  if (r.error) return { ok: false, error: r.error };
45048
45592
  return parseDispatch(agentId, r.stdout, r.code);
45049
45593
  }
@@ -50169,37 +50713,271 @@ var StreamableHTTPClientTransport = class {
50169
50713
  }
50170
50714
  };
50171
50715
 
50716
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
50717
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
50718
+ var import_node_process = __toESM(require("node:process"), 1);
50719
+ var import_node_stream = require("node:stream");
50720
+
50721
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
50722
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
50723
+ var ReadBuffer = class {
50724
+ constructor(options) {
50725
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
50726
+ }
50727
+ append(chunk) {
50728
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
50729
+ if (newSize > this._maxBufferSize) {
50730
+ this.clear();
50731
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
50732
+ }
50733
+ this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
50734
+ }
50735
+ readMessage() {
50736
+ if (!this._buffer) {
50737
+ return null;
50738
+ }
50739
+ const index = this._buffer.indexOf("\n");
50740
+ if (index === -1) {
50741
+ return null;
50742
+ }
50743
+ const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
50744
+ this._buffer = this._buffer.subarray(index + 1);
50745
+ return deserializeMessage(line);
50746
+ }
50747
+ clear() {
50748
+ this._buffer = void 0;
50749
+ }
50750
+ };
50751
+ function deserializeMessage(line) {
50752
+ return JSONRPCMessageSchema.parse(JSON.parse(line));
50753
+ }
50754
+ function serializeMessage(message) {
50755
+ return JSON.stringify(message) + "\n";
50756
+ }
50757
+
50758
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
50759
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process.default.platform === "win32" ? [
50760
+ "APPDATA",
50761
+ "HOMEDRIVE",
50762
+ "HOMEPATH",
50763
+ "LOCALAPPDATA",
50764
+ "PATH",
50765
+ "PROCESSOR_ARCHITECTURE",
50766
+ "SYSTEMDRIVE",
50767
+ "SYSTEMROOT",
50768
+ "TEMP",
50769
+ "USERNAME",
50770
+ "USERPROFILE",
50771
+ "PROGRAMFILES"
50772
+ ] : (
50773
+ /* list inspired by the default env inheritance of sudo */
50774
+ ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"]
50775
+ );
50776
+ function getDefaultEnvironment() {
50777
+ const env = {};
50778
+ for (const key of DEFAULT_INHERITED_ENV_VARS) {
50779
+ const value = import_node_process.default.env[key];
50780
+ if (value === void 0) {
50781
+ continue;
50782
+ }
50783
+ if (value.startsWith("()")) {
50784
+ continue;
50785
+ }
50786
+ env[key] = value;
50787
+ }
50788
+ return env;
50789
+ }
50790
+ var StdioClientTransport = class {
50791
+ constructor(server) {
50792
+ this._stderrStream = null;
50793
+ this._serverParams = server;
50794
+ this._readBuffer = new ReadBuffer({ maxBufferSize: server.maxBufferSize });
50795
+ if (server.stderr === "pipe" || server.stderr === "overlapped") {
50796
+ this._stderrStream = new import_node_stream.PassThrough();
50797
+ }
50798
+ }
50799
+ /**
50800
+ * Starts the server process and prepares to communicate with it.
50801
+ */
50802
+ async start() {
50803
+ if (this._process) {
50804
+ throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
50805
+ }
50806
+ return new Promise((resolve, reject) => {
50807
+ this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
50808
+ // merge default env with server env because mcp server needs some env vars
50809
+ env: {
50810
+ ...getDefaultEnvironment(),
50811
+ ...this._serverParams.env
50812
+ },
50813
+ stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
50814
+ shell: false,
50815
+ windowsHide: import_node_process.default.platform === "win32",
50816
+ cwd: this._serverParams.cwd
50817
+ });
50818
+ this._process.on("error", (error51) => {
50819
+ reject(error51);
50820
+ this.onerror?.(error51);
50821
+ });
50822
+ this._process.on("spawn", () => {
50823
+ resolve();
50824
+ });
50825
+ this._process.on("close", (_code) => {
50826
+ this._process = void 0;
50827
+ this.onclose?.();
50828
+ });
50829
+ this._process.stdin?.on("error", (error51) => {
50830
+ this.onerror?.(error51);
50831
+ });
50832
+ this._process.stdout?.on("data", (chunk) => {
50833
+ try {
50834
+ this._readBuffer.append(chunk);
50835
+ this.processReadBuffer();
50836
+ } catch (error51) {
50837
+ this.onerror?.(error51);
50838
+ this.close().catch(() => {
50839
+ });
50840
+ }
50841
+ });
50842
+ this._process.stdout?.on("error", (error51) => {
50843
+ this.onerror?.(error51);
50844
+ });
50845
+ if (this._stderrStream && this._process.stderr) {
50846
+ this._process.stderr.pipe(this._stderrStream);
50847
+ }
50848
+ });
50849
+ }
50850
+ /**
50851
+ * The stderr stream of the child process, if `StdioServerParameters.stderr` was set to "pipe" or "overlapped".
50852
+ *
50853
+ * If stderr piping was requested, a PassThrough stream is returned _immediately_, allowing callers to
50854
+ * attach listeners before the start method is invoked. This prevents loss of any early
50855
+ * error output emitted by the child process.
50856
+ */
50857
+ get stderr() {
50858
+ if (this._stderrStream) {
50859
+ return this._stderrStream;
50860
+ }
50861
+ return this._process?.stderr ?? null;
50862
+ }
50863
+ /**
50864
+ * The child process pid spawned by this transport.
50865
+ *
50866
+ * This is only available after the transport has been started.
50867
+ */
50868
+ get pid() {
50869
+ return this._process?.pid ?? null;
50870
+ }
50871
+ processReadBuffer() {
50872
+ while (true) {
50873
+ try {
50874
+ const message = this._readBuffer.readMessage();
50875
+ if (message === null) {
50876
+ break;
50877
+ }
50878
+ this.onmessage?.(message);
50879
+ } catch (error51) {
50880
+ this.onerror?.(error51);
50881
+ }
50882
+ }
50883
+ }
50884
+ async close() {
50885
+ if (this._process) {
50886
+ const processToClose = this._process;
50887
+ this._process = void 0;
50888
+ const closePromise = new Promise((resolve) => {
50889
+ processToClose.once("close", () => {
50890
+ resolve();
50891
+ });
50892
+ });
50893
+ try {
50894
+ processToClose.stdin?.end();
50895
+ } catch {
50896
+ }
50897
+ await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
50898
+ if (processToClose.exitCode === null) {
50899
+ try {
50900
+ processToClose.kill("SIGTERM");
50901
+ } catch {
50902
+ }
50903
+ await Promise.race([closePromise, new Promise((resolve) => setTimeout(resolve, 2e3).unref())]);
50904
+ }
50905
+ if (processToClose.exitCode === null) {
50906
+ try {
50907
+ processToClose.kill("SIGKILL");
50908
+ } catch {
50909
+ }
50910
+ }
50911
+ }
50912
+ this._readBuffer.clear();
50913
+ }
50914
+ send(message) {
50915
+ return new Promise((resolve) => {
50916
+ if (!this._process?.stdin) {
50917
+ throw new Error("Not connected");
50918
+ }
50919
+ const json2 = serializeMessage(message);
50920
+ if (this._process.stdin.write(json2)) {
50921
+ resolve();
50922
+ } else {
50923
+ this._process.stdin.once("drain", resolve);
50924
+ }
50925
+ });
50926
+ }
50927
+ };
50928
+
50172
50929
  // src/delivery/invoke.ts
50173
50930
  async function invokeCapability(server, toolName, payload) {
50174
- const headers = Object.fromEntries(
50175
- Object.entries(server.headers ?? {}).map(([key, value]) => {
50176
- const expandedValue = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, varName) => {
50177
- const envVal = process.env[varName];
50178
- if (envVal === void 0) {
50179
- throw new InvokeUnexpandedHeaderError(key, varName);
50180
- }
50181
- return envVal;
50182
- });
50183
- return [key, expandedValue];
50184
- })
50185
- );
50186
50931
  const client = new Client({ name: "mrrlin-delivery-invoker", version: "1.0.0" });
50187
50932
  try {
50188
50933
  let result;
50934
+ const target = server.transport === "stdio" ? server.command : server.url;
50189
50935
  try {
50190
- const transport = new StreamableHTTPClientTransport(new URL(server.url), {
50191
- requestInit: {
50192
- headers,
50193
- signal: AbortSignal.timeout(3e4)
50936
+ if (server.transport === "stdio") {
50937
+ const env = {};
50938
+ for (const [key, value] of Object.entries(server.env ?? {})) {
50939
+ const expandedValue = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, varName) => {
50940
+ const envVal = process.env[varName];
50941
+ if (envVal === void 0) {
50942
+ throw new InvokeUnexpandedHeaderError(key, varName);
50943
+ }
50944
+ return envVal;
50945
+ });
50946
+ env[key] = expandedValue;
50194
50947
  }
50195
- });
50196
- await client.connect(transport);
50948
+ const transport = new StdioClientTransport({
50949
+ command: server.command,
50950
+ args: server.args ?? [],
50951
+ env
50952
+ });
50953
+ await client.connect(transport);
50954
+ } else {
50955
+ const headers = Object.fromEntries(
50956
+ Object.entries(server.headers ?? {}).map(([key, value]) => {
50957
+ const expandedValue = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, varName) => {
50958
+ const envVal = process.env[varName];
50959
+ if (envVal === void 0) {
50960
+ throw new InvokeUnexpandedHeaderError(key, varName);
50961
+ }
50962
+ return envVal;
50963
+ });
50964
+ return [key, expandedValue];
50965
+ })
50966
+ );
50967
+ const transport = new StreamableHTTPClientTransport(new URL(server.url), {
50968
+ requestInit: {
50969
+ headers,
50970
+ signal: AbortSignal.timeout(3e4)
50971
+ }
50972
+ });
50973
+ await client.connect(transport);
50974
+ }
50197
50975
  result = await client.callTool({
50198
50976
  name: toolName,
50199
50977
  arguments: isRecord(payload) ? payload : void 0
50200
50978
  });
50201
50979
  } catch (error51) {
50202
- throw classifyInvokeError(error51, server.url, toolName);
50980
+ throw classifyInvokeError(error51, target, toolName);
50203
50981
  }
50204
50982
  if (result.isError) {
50205
50983
  throw new Error(`invokeCapability: tool "${toolName}" reported isError -- ${extractFirstText(result.content)}`);
@@ -50241,6 +51019,9 @@ var InvokeUnexpandedHeaderError = class extends Error {
50241
51019
  }
50242
51020
  };
50243
51021
  function classifyInvokeError(error51, url2, toolName) {
51022
+ if (error51 instanceof InvokeUnexpandedHeaderError) {
51023
+ return error51;
51024
+ }
50244
51025
  if (error51 instanceof StreamableHTTPError) {
50245
51026
  if (error51.code === 401 || error51.code === 403) return new InvokeAuthError(url2, error51);
50246
51027
  return new InvokeUnreachableError(url2, error51);
@@ -50296,9 +51077,78 @@ function findFirstMatch(value, pattern) {
50296
51077
  var gitPullRequestStateResponseSchema = external_exports.object({
50297
51078
  merged: external_exports.boolean()
50298
51079
  });
51080
+ function parsePullRequestUrl(url2) {
51081
+ try {
51082
+ const parsed = new URL(url2);
51083
+ const parts = parsed.pathname.split("/").filter(Boolean);
51084
+ const pullIdx = parts.indexOf("pull");
51085
+ if (pullIdx >= 2 && pullIdx + 1 < parts.length) {
51086
+ const owner = parts[pullIdx - 2];
51087
+ const repo = parts[pullIdx - 1];
51088
+ const pullPart = parts[pullIdx + 1];
51089
+ const pullNumber = pullPart ? parseInt(pullPart, 10) : NaN;
51090
+ if (owner && repo && !Number.isNaN(pullNumber)) {
51091
+ return { owner, repo, pullNumber };
51092
+ }
51093
+ }
51094
+ } catch {
51095
+ }
51096
+ return {};
51097
+ }
50299
51098
  async function deliverToGit(server, toolName, payload) {
50300
- const { operation: _operation, ...args } = payload;
50301
- return invokeCapability(server, toolName, args);
51099
+ const defaultRoute = server.id ? getDefaultCapabilityRouteForServer(server.id) : null;
51100
+ const isDefaultGitHubRoute = defaultRoute?.capability === "repo_host";
51101
+ if (payload.operation === "pull_request") {
51102
+ const { operation: _operation, ...args } = payload;
51103
+ if (isDefaultGitHubRoute && toolName === defaultRoute.operations.pull_request) {
51104
+ let owner = args.owner;
51105
+ let repo = args.repo;
51106
+ const repository = args.repository;
51107
+ if ((!owner || !repo) && repository && repository.includes("/")) {
51108
+ const parts = repository.split("/");
51109
+ owner = parts[0];
51110
+ repo = parts[1];
51111
+ }
51112
+ const head = args.head ?? payload.headBranch;
51113
+ const base = args.base ?? payload.baseBranch ?? "main";
51114
+ const title = args.title ?? payload.title ?? "";
51115
+ const body = args.body ?? payload.body ?? "";
51116
+ const adaptedArgs = {
51117
+ head,
51118
+ base,
51119
+ title,
51120
+ body
51121
+ };
51122
+ if (owner) adaptedArgs.owner = owner;
51123
+ if (repo) adaptedArgs.repo = repo;
51124
+ if (typeof payload.draft === "boolean") {
51125
+ adaptedArgs.draft = payload.draft;
51126
+ }
51127
+ return invokeCapability(server, toolName, adaptedArgs);
51128
+ }
51129
+ return invokeCapability(server, toolName, args);
51130
+ }
51131
+ if (isDefaultGitHubRoute && toolName === defaultRoute.operations.pull_request_state) {
51132
+ const { operation: _operation, ...args } = payload;
51133
+ const urlParts = parsePullRequestUrl(payload.pullRequestUrl);
51134
+ let owner = args.owner ?? urlParts.owner;
51135
+ let repo = args.repo ?? urlParts.repo;
51136
+ const repository = args.repository;
51137
+ if ((!owner || !repo) && repository && repository.includes("/")) {
51138
+ const parts = repository.split("/");
51139
+ owner = parts[0];
51140
+ repo = parts[1];
51141
+ }
51142
+ const pullNumber = args.pull_number ?? args.pullNumber ?? urlParts.pullNumber;
51143
+ const adaptedArgs = {};
51144
+ if (owner) adaptedArgs.owner = owner;
51145
+ if (repo) adaptedArgs.repo = repo;
51146
+ if (pullNumber !== void 0) {
51147
+ adaptedArgs.pull_number = pullNumber;
51148
+ }
51149
+ return invokeCapability(server, toolName, adaptedArgs);
51150
+ }
51151
+ return invokeCapability(server, toolName, { pullRequestUrl: payload.pullRequestUrl });
50302
51152
  }
50303
51153
 
50304
51154
  // src/mcp-tool-error.ts
@@ -50379,6 +51229,16 @@ async function deliverToArtifacts(client, projectSlug, payload, bareFetch) {
50379
51229
  // src/delivery/send.ts
50380
51230
  async function deliverToSend(server, toolName, payload) {
50381
51231
  const { operation: _operation, ...args } = payload;
51232
+ const defaultRoute = server.id ? getDefaultCapabilityRouteForServer(server.id) : null;
51233
+ const isDefaultSlackRoute = defaultRoute?.capability === "send";
51234
+ if (payload.operation === "dispatch" && isDefaultSlackRoute && toolName === defaultRoute.operations.dispatch) {
51235
+ const channelId = args.channel_id ?? args.destination ?? args.channel ?? args.to;
51236
+ const text = args.text ?? args.body ?? args.message ?? args.content;
51237
+ const adaptedArgs = {};
51238
+ if (channelId !== void 0) adaptedArgs.channel_id = channelId;
51239
+ if (text !== void 0) adaptedArgs.text = text;
51240
+ return invokeCapability(server, toolName, adaptedArgs);
51241
+ }
50382
51242
  return invokeCapability(server, toolName, args);
50383
51243
  }
50384
51244
 
@@ -55466,7 +56326,7 @@ var import_node_fs10 = require("node:fs");
55466
56326
  var import_node_os11 = __toESM(require("node:os"), 1);
55467
56327
  var import_node_path18 = __toESM(require("node:path"), 1);
55468
56328
  var import_semver2 = __toESM(require_semver2(), 1);
55469
- var toml2 = __toESM(require_toml(), 1);
56329
+ var toml3 = __toESM(require_toml(), 1);
55470
56330
 
55471
56331
  // src/agent-version.ts
55472
56332
  var import_node_child_process12 = require("node:child_process");
@@ -55649,7 +56509,7 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
55649
56509
  const configPath = import_node_path18.default.join(resolveCodexHome2(opts), "config.toml");
55650
56510
  try {
55651
56511
  const raw = await (0, import_promises10.readFile)(configPath, "utf8");
55652
- const parsed = toml2.parse(raw);
56512
+ const parsed = toml3.parse(raw);
55653
56513
  checks.mcpReachable = isExternalAgentsWrapper(parsed.mcp_servers?.["external-agents"]);
55654
56514
  } catch {
55655
56515
  }
@@ -56831,7 +57691,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
56831
57691
  }
56832
57692
 
56833
57693
  // src/_generated/version.ts
56834
- var PKG_VERSION = "0.4.87";
57694
+ var PKG_VERSION = "0.4.90";
56835
57695
 
56836
57696
  // src/api-base-url-migrate.ts
56837
57697
  var import_node_fs13 = __toESM(require("node:fs"), 1);
@@ -56856,28 +57716,42 @@ function resolveServiceCwd(opts) {
56856
57716
  }
56857
57717
  var BRIDGE_APP_NAME = "mrrlin-bridge";
56858
57718
  function renderEcosystemConfig(opts) {
56859
- const env = {
56860
- HOME: opts.home,
56861
- PATH: opts.pathEnv,
56862
- MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
56863
- };
56864
- if (opts.user) {
56865
- env.USER = opts.user;
56866
- if (process.platform === "win32") {
56867
- env.USERNAME = opts.user;
57719
+ let envLines;
57720
+ if ("env" in opts && opts.env !== void 0) {
57721
+ const safeEnv = /* @__PURE__ */ Object.create(null);
57722
+ for (const key of Object.keys(opts.env)) {
57723
+ const val = opts.env[key];
57724
+ if (val !== void 0) {
57725
+ safeEnv[key] = val;
57726
+ }
57727
+ }
57728
+ const keys = Object.keys(safeEnv).sort();
57729
+ envLines = keys.map((k) => {
57730
+ const keyProp = k === "__proto__" ? '["__proto__"]' : k;
57731
+ return ` ${keyProp}: ${JSON.stringify(safeEnv[k])},`;
57732
+ }).join("\n");
57733
+ } else {
57734
+ const legacyOpts = opts;
57735
+ const env = {
57736
+ HOME: legacyOpts.home,
57737
+ PATH: legacyOpts.pathEnv,
57738
+ MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
57739
+ };
57740
+ if (legacyOpts.user) {
57741
+ env.USER = legacyOpts.user;
57742
+ if (process.platform === "win32") {
57743
+ env.USERNAME = legacyOpts.user;
57744
+ }
56868
57745
  }
56869
- }
56870
- if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
56871
- const claudeConfigDir = opts.claudeConfigDir?.trim();
56872
- if (claudeConfigDir) env.CLAUDE_CONFIG_DIR = claudeConfigDir;
56873
- const apiBaseUrl = opts.apiBaseUrl ? retargetRetiredApiBaseUrl(opts.apiBaseUrl).baseUrl : void 0;
56874
- if (apiBaseUrl && !isProductionApiBaseUrl(apiBaseUrl)) {
56875
- env.MRRLIN_API_BASE_URL = apiBaseUrl;
56876
- if (opts.apiAllowRemote && !isStagingApiBaseUrl(apiBaseUrl) && !isLoopbackUrl(apiBaseUrl)) {
56877
- env.MRRLIN_API_ALLOW_REMOTE = "1";
57746
+ if (legacyOpts.codexHome) env.CODEX_HOME = legacyOpts.codexHome;
57747
+ const claudeConfigDir = legacyOpts.claudeConfigDir?.trim();
57748
+ if (claudeConfigDir) env.CLAUDE_CONFIG_DIR = claudeConfigDir;
57749
+ const apiBaseUrl = legacyOpts.apiBaseUrl ? retargetRetiredApiBaseUrl(legacyOpts.apiBaseUrl).baseUrl : void 0;
57750
+ if (apiBaseUrl && !isProductionApiBaseUrl(apiBaseUrl)) {
57751
+ env.MRRLIN_API_BASE_URL = apiBaseUrl;
56878
57752
  }
57753
+ envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
56879
57754
  }
56880
- const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
56881
57755
  return `module.exports = {
56882
57756
  apps: [{
56883
57757
  name: ${JSON.stringify(BRIDGE_APP_NAME)},
@@ -59922,35 +60796,7 @@ var EXECUTOR_BASE_INSTRUCTIONS = [
59922
60796
  "You MUST verify every delegated result against the actual files and tests before it lands \u2014",
59923
60797
  "pool models are lower-reliability and a wrong delegated edit is YOUR responsibility; never",
59924
60798
  "commit unverified delegated output. If dispatch fails or the pool is unavailable, do the",
59925
- "work yourself \u2014 never block the run on the pool.",
59926
- "",
59927
- // Auto-deploy design Part C (2026-08-04), C4: the workflow-resolution procedure. Only relevant
59928
- // when the deploy gate has parked this run on a missing/stale workflow id for one environment —
59929
- // most turns will never need this. This choice becomes durable project state (record_deploy_workflow
59930
- // writes project_deploy_workflow), not a per-run decision, so resolve it AT MOST ONCE per
59931
- // project+environment, only when actually needed (lazy, per env — do not speculatively resolve
59932
- // prod when only dev was asked for).
59933
- "If your context shows the deploy gate parked on a missing or stale workflow id for an",
59934
- "environment, resolve it once with this fail-closed procedure \u2014 do this AT MOST ONCE per",
59935
- "project+environment; it becomes durable project state, not a per-run choice:",
59936
- '1. Call `list_github_workflows` and keep only candidates with state: "active". A workflow\'s',
59937
- " name is NOT evidence it deploys anything \u2014 e.g. this repo also has `publish` (ships an npm",
59938
- " package) and `bootstrap-changelog`; picking by name resemblance can dispatch the wrong thing.",
59939
- "2. For each active candidate, read its file at `<worktree>/<path>` \u2014 the list API's `path` is",
59940
- " already repo-root-relative (e.g. `.github/workflows/deploy.yml`), so do NOT prefix it again",
59941
- " with `.github/workflows/`. Require an explicit `workflow_dispatch` trigger \u2014 a workflow you",
59942
- " cannot confirm is dispatchable this way is not a candidate.",
59943
- "3. Require positive evidence from the workflow's own steps that it deploys THIS project \u2014 not",
59944
- " just a plausible-sounding name.",
59945
- "4. Exactly one confirmed candidate \u2192 call `record_deploy_workflow` with that workflowId (state",
59946
- ' defaults to "resolved") and a one-sentence reason. The server captures its own snapshot of',
59947
- " the live active-workflow set at write time \u2014 you do not need to compute or pass one; hand-",
59948
- " assembling it yourself would risk a format mismatch against what the deploy gate recomputes",
59949
- " later, silently disabling the drift check. Append a `checkpoint` artifact with the same pick",
59950
- " + reason so the decision stays auditable.",
59951
- "5. Zero confirmed candidates, or more than one \u2192 call `record_deploy_workflow` with",
59952
- ' workflowId: null and state: "ambiguous", and file a clarifying question through the normal',
59953
- " inbox question path. Do NOT guess between multiple plausible candidates."
60799
+ "work yourself \u2014 never block the run on the pool."
59954
60800
  ].join("\n");
59955
60801
  function artifactKindForEvent(event) {
59956
60802
  switch (event.type) {
@@ -59995,21 +60841,21 @@ function isBlastRadiusFloorPath(path28) {
59995
60841
  }
59996
60842
  var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process18.execFile);
59997
60843
  async function defaultListRunDiffPaths(opts) {
59998
- const parse7 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
60844
+ const parse8 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
59999
60845
  try {
60000
60846
  const { stdout } = await execFileAsync2(
60001
60847
  "git",
60002
60848
  ["-C", opts.worktreePath, "diff", "--name-only", `origin/${opts.defaultBranch}...HEAD`],
60003
60849
  { timeout: 3e4 }
60004
60850
  );
60005
- return parse7(stdout);
60851
+ return parse8(stdout);
60006
60852
  } catch {
60007
60853
  const { stdout } = await execFileAsync2(
60008
60854
  "git",
60009
60855
  ["-C", opts.worktreePath, "diff", "--name-only", `${opts.defaultBranch}...HEAD`],
60010
60856
  { timeout: 3e4 }
60011
60857
  );
60012
- return parse7(stdout);
60858
+ return parse8(stdout);
60013
60859
  }
60014
60860
  }
60015
60861
  var BLAST_RADIUS_FLOOR_REASON = "migration or database schema files changed";
@@ -60071,23 +60917,6 @@ async function gatherContext(client, projectSlug, task, openRunId) {
60071
60917
  autonomyEvents
60072
60918
  };
60073
60919
  }
60074
- async function deployWorkflowReverifyNotice(client, projectSlug) {
60075
- const envs = ["dev", "prod"];
60076
- const flagged = [];
60077
- const clientWithDeploy = client;
60078
- for (const env of envs) {
60079
- try {
60080
- const row = await clientWithDeploy.getProjectDeployWorkflow?.(projectSlug, env);
60081
- if (row?.reverifyRequested) flagged.push(env);
60082
- } catch {
60083
- }
60084
- }
60085
- if (flagged.length === 0) return "";
60086
- return `
60087
-
60088
- ## Deploy workflow re-verification needed
60089
- The GitHub Actions workflow set changed since the deploy workflow was last confirmed for: ${flagged.join(", ")}. Re-run the workflow-resolution procedure (list_github_workflows -> confirm -> record_deploy_workflow) for ${flagged.length === 1 ? "this environment" : "these environments"} if you have a worktree this turn \u2014 this is a hint, not a blocker, so it is fine to skip if unrelated work is more urgent this turn.`;
60090
- }
60091
60920
  async function assertRunCompletionReady(deps, projectSlug, taskId, runId, allowedStatuses) {
60092
60921
  const task = await deps.client.getTask(projectSlug, taskId);
60093
60922
  if (!allowedStatuses.has(task.status)) {
@@ -60419,7 +61248,6 @@ async function driveRun(deps, projectSlug, runId) {
60419
61248
  }
60420
61249
  } : context
60421
61250
  );
60422
- bundle += await deployWorkflowReverifyNotice(deps.client, projectSlug);
60423
61251
  const runTelemetry = {
60424
61252
  promptBytes: 0,
60425
61253
  turnCount: 0,
@@ -60848,6 +61676,7 @@ Continue executing task ${task.id}. Make the next concrete increment of progress
60848
61676
  runId,
60849
61677
  payload: {
60850
61678
  operation: "pull_request",
61679
+ repository: expectedRepoFullName,
60851
61680
  headBranch,
60852
61681
  title: `[mrrlin] ${readiness.task.title}`,
60853
61682
  body: buildPullRequestBody({ runId, taskId: readiness.task.id, producedUrls }),
@@ -61360,23 +62189,16 @@ async function driveNonCodeRun(deps, projectSlug, runId, leaseId, task, domain2)
61360
62189
  return;
61361
62190
  }
61362
62191
  }
61363
- let evidenceValue = pageId;
61364
- if (task.blockedBy.length > 0) {
61365
- for (const blockerId of task.blockedBy) {
61366
- const runs = (await deps.client.listExecutionRuns(projectSlug, { taskId: blockerId })).sort(
61367
- (a, b) => (b.createdAt ?? "").localeCompare(a.createdAt ?? "")
61368
- );
61369
- if (runs[0]?.prodEnvUrl) {
61370
- evidenceValue = runs[0].prodEnvUrl;
61371
- break;
61372
- }
61373
- }
61374
- }
61375
- const receipt = parsedResult.outcome === "completed" && task.declaredOutcome != null ? buildReceipt({
62192
+ const receipt = parsedResult.outcome === "completed" && task.declaredOutcome != null ? task.declaredOutcome.requires.includes("document") ? buildReceipt({
61376
62193
  declaredOutcome: task.declaredOutcome,
61377
- evidenceType: "url",
61378
- evidenceValue,
61379
- coveredKinds: ["page"]
62194
+ evidenceType: "human_tap",
62195
+ evidenceValue: pageId,
62196
+ coveredKinds: ["document"]
62197
+ }) : buildReceipt({
62198
+ declaredOutcome: task.declaredOutcome,
62199
+ evidenceType: "human_tap",
62200
+ evidenceValue: pageId,
62201
+ coveredKinds: []
61380
62202
  }) : void 0;
61381
62203
  try {
61382
62204
  const settled = await deps.client.settleExecutionRunOutcome(projectSlug, runId, {
@@ -67472,7 +68294,7 @@ function collectedTurnTimeoutMs() {
67472
68294
  return COLLECTED_TURN_TIMEOUT_DEFAULT_MS;
67473
68295
  }
67474
68296
  var DEFAULT_IMAGE_ONLY_PROMPT = "Look at the attached image.";
67475
- var VERIFICATION_BASE_INSTRUCTIONS = [
68297
+ var _VERIFICATION_BASE_INSTRUCTIONS = [
67476
68298
  "You are a deployment verification agent. Make ONLY read-only HTTP requests to the single",
67477
68299
  "environment URL given in the prompt to confirm a deploy succeeded. Do not read or write any",
67478
68300
  "files, do not use repository or credential access, do not contact any other host, and do not",
@@ -69215,11 +70037,6 @@ async function startDirectorBridge() {
69215
70037
  } catch {
69216
70038
  }
69217
70039
  const apiBaseUrl = readDirectorBridgeApiBaseUrl();
69218
- if (!isRemoteApiAllowed(apiBaseUrl)) {
69219
- throw new Error(
69220
- `Refusing to run the director-bridge execution consumer against untrusted remote API URL ${apiBaseUrl}. Set MRRLIN_API_ALLOW_REMOTE=1 for a custom remote, or set MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com for the official staging API.`
69221
- );
69222
- }
69223
70040
  const envToken = process.env.MRRLIN_TOKEN?.trim() || void 0;
69224
70041
  const agentSecret = readAgentSecret();
69225
70042
  let tokenProvider = null;
@@ -70739,48 +71556,9 @@ var Server = class extends Protocol {
70739
71556
  };
70740
71557
 
70741
71558
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
70742
- var import_node_process = __toESM(require("node:process"), 1);
70743
-
70744
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
70745
- var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
70746
- var ReadBuffer = class {
70747
- constructor(options) {
70748
- this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
70749
- }
70750
- append(chunk) {
70751
- const newSize = (this._buffer?.length ?? 0) + chunk.length;
70752
- if (newSize > this._maxBufferSize) {
70753
- this.clear();
70754
- throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
70755
- }
70756
- this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
70757
- }
70758
- readMessage() {
70759
- if (!this._buffer) {
70760
- return null;
70761
- }
70762
- const index = this._buffer.indexOf("\n");
70763
- if (index === -1) {
70764
- return null;
70765
- }
70766
- const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
70767
- this._buffer = this._buffer.subarray(index + 1);
70768
- return deserializeMessage(line);
70769
- }
70770
- clear() {
70771
- this._buffer = void 0;
70772
- }
70773
- };
70774
- function deserializeMessage(line) {
70775
- return JSONRPCMessageSchema.parse(JSON.parse(line));
70776
- }
70777
- function serializeMessage(message) {
70778
- return JSON.stringify(message) + "\n";
70779
- }
70780
-
70781
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
71559
+ var import_node_process2 = __toESM(require("node:process"), 1);
70782
71560
  var StdioServerTransport = class {
70783
- constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout, options) {
71561
+ constructor(_stdin = import_node_process2.default.stdin, _stdout = import_node_process2.default.stdout, options) {
70784
71562
  this._stdin = _stdin;
70785
71563
  this._stdout = _stdout;
70786
71564
  this._started = false;
@@ -70856,16 +71634,10 @@ function redactUrlForLog(value) {
70856
71634
  }
70857
71635
  function resolveServerOptions(input = {}) {
70858
71636
  const apiBaseUrl = readConfiguredApiBaseUrl(input.apiBaseUrl);
70859
- const remoteAllowed = isRemoteApiAllowed(apiBaseUrl) || input.allowRemoteApi === true;
70860
- if (!remoteAllowed) {
70861
- throw new Error(
70862
- `Refusing to start MCP server against non-loopback URL ${apiBaseUrl}. Set MRRLIN_API_ALLOW_REMOTE=1 for a custom remote, or set MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com for the official staging API.`
70863
- );
70864
- }
70865
71637
  return {
70866
71638
  apiBaseUrl,
70867
71639
  fetch: input.fetch,
70868
- remoteAllowed,
71640
+ remoteAllowed: true,
70869
71641
  // Deliberately do NOT bake process.env.MRRLIN_TOKEN in here: withAuth (tools.ts) resolves
70870
71642
  // env + the bridge-persisted operator-token file lazily per request, so long-lived MCP
70871
71643
  // processes pick up token rotation. An explicit input.token still wins when provided.
@@ -70987,7 +71759,7 @@ async function startStdioServer(options = {}) {
70987
71759
  effective = {
70988
71760
  ...options,
70989
71761
  apiBaseUrl: baseUrl,
70990
- allowRemoteApi: source === "staging-env" || source === "staging-autodetect" || source === "retired-retarget"
71762
+ allowRemoteApi: true
70991
71763
  };
70992
71764
  process.stderr.write(`[mrrlin-mcp] API resolved: ${redactUrlForLog(baseUrl)} (source=${source})
70993
71765
  `);
@@ -71029,49 +71801,437 @@ function runSetCredential(args) {
71029
71801
  var import_node_os18 = __toESM(require("node:os"), 1);
71030
71802
  var import_node_fs24 = require("node:fs");
71031
71803
  var import_node_path38 = __toESM(require("node:path"), 1);
71032
- function isOwnedEcosystemConfig(text) {
71033
- return /name:\s*"mrrlin-bridge"/.test(text) && /script:\s*"mrrlin-mcp"/.test(text) && /args:\s*"director-bridge"/.test(text);
71034
- }
71035
- function readEnvString(text, key) {
71036
- const match = new RegExp(`\\b${key}:\\s*("(?:[^"\\\\]|\\\\.)*")`).exec(text);
71037
- if (!match?.[1]) return void 0;
71804
+ function parseEnvLine(line, env) {
71805
+ const trimmed = line.trim();
71806
+ if (!trimmed || trimmed === "}" || trimmed === "},") return;
71807
+ const match = /^\s*(?:([a-zA-Z_$][a-zA-Z0-9_$]*)|"((?:[^"\\]|\\.)*)"|(\["__proto__"\]))\s*:\s*("(?:[^"\\]|\\.)*")\s*,?\s*$/.exec(line);
71808
+ if (!match) return;
71809
+ const identKey = match[1];
71810
+ const quotedKey = match[2];
71811
+ const computedProto = match[3];
71812
+ const rawValue = match[4];
71813
+ if (!rawValue) return;
71814
+ let key = null;
71815
+ if (computedProto) {
71816
+ key = "__proto__";
71817
+ } else if (identKey) {
71818
+ if (identKey === "__proto__") {
71819
+ return;
71820
+ }
71821
+ key = identKey;
71822
+ } else if (quotedKey !== void 0) {
71823
+ try {
71824
+ const parsedKey = JSON.parse(`"${quotedKey}"`);
71825
+ if (typeof parsedKey !== "string" || parsedKey === "__proto__") {
71826
+ return;
71827
+ }
71828
+ key = parsedKey;
71829
+ } catch {
71830
+ return;
71831
+ }
71832
+ }
71833
+ if (key === null) return;
71038
71834
  try {
71039
- const value = JSON.parse(match[1]);
71040
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
71835
+ const parsedValue = JSON.parse(rawValue);
71836
+ if (typeof parsedValue === "string") {
71837
+ env[key] = parsedValue;
71838
+ }
71041
71839
  } catch {
71042
- return void 0;
71840
+ return;
71841
+ }
71842
+ }
71843
+ function parseExistingEcosystemConfig(text) {
71844
+ if (text === null || text === void 0) {
71845
+ return { kind: "missing" };
71846
+ }
71847
+ let mode = "code";
71848
+ const templateCurlyStack = [];
71849
+ let curlyDepth = 0;
71850
+ let squareDepth = 0;
71851
+ let parenDepth = 0;
71852
+ let moduleExportsOpened = false;
71853
+ let moduleExportsClosed = false;
71854
+ let appsArrayOpened = false;
71855
+ let appsArrayClosed = false;
71856
+ let appCandidateActive = false;
71857
+ let candidateHasName = false;
71858
+ let candidateHasScript = false;
71859
+ let candidateHasArgs = false;
71860
+ let candidateHasEnv = false;
71861
+ let candidateEnvOpenedOnLine = false;
71862
+ let candidateEnvClosed = false;
71863
+ let candidateEnv = null;
71864
+ let matchedAppEnv = null;
71865
+ let matchedAppCount = 0;
71866
+ let recentCode = "";
71867
+ let lineCode = "";
71868
+ const len = text.length;
71869
+ let i = 0;
71870
+ while (i < len) {
71871
+ const ch = text[i] ?? "";
71872
+ if (mode === "line_comment") {
71873
+ if (ch === "\n") {
71874
+ mode = "code";
71875
+ lineCode = "";
71876
+ candidateEnvOpenedOnLine = false;
71877
+ }
71878
+ i++;
71879
+ continue;
71880
+ }
71881
+ if (mode === "block_comment") {
71882
+ if (ch === "*" && i + 1 < len && text[i + 1] === "/") {
71883
+ mode = "code";
71884
+ i += 2;
71885
+ continue;
71886
+ }
71887
+ if (ch === "\n") {
71888
+ lineCode = "";
71889
+ candidateEnvOpenedOnLine = false;
71890
+ }
71891
+ i++;
71892
+ continue;
71893
+ }
71894
+ if (mode === "single_quote") {
71895
+ if (ch === "\\") {
71896
+ i += 2;
71897
+ continue;
71898
+ }
71899
+ if (ch === "'") {
71900
+ mode = "code";
71901
+ i++;
71902
+ continue;
71903
+ }
71904
+ if (ch === "\n" || ch === "\r") {
71905
+ return { kind: "rejected", text };
71906
+ }
71907
+ i++;
71908
+ continue;
71909
+ }
71910
+ if (mode === "double_quote") {
71911
+ if (ch === "\\") {
71912
+ lineCode += ch + (text[i + 1] ?? "");
71913
+ i += 2;
71914
+ continue;
71915
+ }
71916
+ lineCode += ch;
71917
+ if (ch === '"') {
71918
+ mode = "code";
71919
+ if (appCandidateActive && curlyDepth === 2 && squareDepth === 1) {
71920
+ if (/name\s*:\s*"mrrlin-bridge"/.test(lineCode)) candidateHasName = true;
71921
+ if (/script\s*:\s*"mrrlin-mcp"/.test(lineCode)) candidateHasScript = true;
71922
+ if (/args\s*:\s*"director-bridge"/.test(lineCode)) candidateHasArgs = true;
71923
+ }
71924
+ i++;
71925
+ continue;
71926
+ }
71927
+ if (ch === "\n" || ch === "\r") {
71928
+ return { kind: "rejected", text };
71929
+ }
71930
+ i++;
71931
+ continue;
71932
+ }
71933
+ if (mode === "template") {
71934
+ if (ch === "\\") {
71935
+ i += 2;
71936
+ continue;
71937
+ }
71938
+ if (ch === "`") {
71939
+ mode = "code";
71940
+ i++;
71941
+ continue;
71942
+ }
71943
+ if (ch === "$" && i + 1 < len && text[i + 1] === "{") {
71944
+ mode = "code";
71945
+ templateCurlyStack.push(curlyDepth);
71946
+ curlyDepth++;
71947
+ i += 2;
71948
+ continue;
71949
+ }
71950
+ i++;
71951
+ continue;
71952
+ }
71953
+ if (ch === "/" && i + 1 < len) {
71954
+ if (text[i + 1] === "/") {
71955
+ mode = "line_comment";
71956
+ i += 2;
71957
+ continue;
71958
+ }
71959
+ if (text[i + 1] === "*") {
71960
+ mode = "block_comment";
71961
+ i += 2;
71962
+ continue;
71963
+ }
71964
+ return { kind: "rejected", text };
71965
+ }
71966
+ if (ch === "/") {
71967
+ return { kind: "rejected", text };
71968
+ }
71969
+ if (ch === "'") {
71970
+ mode = "single_quote";
71971
+ i++;
71972
+ continue;
71973
+ }
71974
+ if (ch === '"') {
71975
+ mode = "double_quote";
71976
+ lineCode += ch;
71977
+ i++;
71978
+ continue;
71979
+ }
71980
+ if (ch === "`") {
71981
+ mode = "template";
71982
+ i++;
71983
+ continue;
71984
+ }
71985
+ if (ch === "\n") {
71986
+ if (appCandidateActive && candidateHasEnv && !candidateEnvClosed && curlyDepth === 3 && candidateEnv) {
71987
+ parseEnvLine(lineCode, candidateEnv);
71988
+ }
71989
+ lineCode = "";
71990
+ candidateEnvOpenedOnLine = false;
71991
+ recentCode += " ";
71992
+ i++;
71993
+ continue;
71994
+ }
71995
+ lineCode += ch;
71996
+ recentCode += ch;
71997
+ if (ch === "{") {
71998
+ if (curlyDepth === 0 && squareDepth === 0) {
71999
+ if (/module\.exports\s*=\s*\{$/.test(recentCode.trim())) {
72000
+ if (moduleExportsOpened) return { kind: "rejected", text };
72001
+ moduleExportsOpened = true;
72002
+ }
72003
+ } else if (moduleExportsOpened && !moduleExportsClosed && appsArrayOpened && !appsArrayClosed && squareDepth === 1 && curlyDepth === 1) {
72004
+ appCandidateActive = true;
72005
+ candidateHasName = false;
72006
+ candidateHasScript = false;
72007
+ candidateHasArgs = false;
72008
+ candidateHasEnv = false;
72009
+ candidateEnvOpenedOnLine = false;
72010
+ candidateEnvClosed = false;
72011
+ candidateEnv = /* @__PURE__ */ Object.create(null);
72012
+ } else if (appCandidateActive && squareDepth === 1 && curlyDepth === 2) {
72013
+ if (/\benv\s*:\s*\{$/.test(recentCode.trim())) {
72014
+ candidateHasEnv = true;
72015
+ candidateEnvOpenedOnLine = true;
72016
+ }
72017
+ }
72018
+ curlyDepth++;
72019
+ recentCode = "";
72020
+ i++;
72021
+ continue;
72022
+ }
72023
+ if (ch === "}") {
72024
+ if (curlyDepth === 0) return { kind: "rejected", text };
72025
+ if (templateCurlyStack.length > 0 && templateCurlyStack[templateCurlyStack.length - 1] === curlyDepth - 1) {
72026
+ templateCurlyStack.pop();
72027
+ mode = "template";
72028
+ curlyDepth--;
72029
+ recentCode = "";
72030
+ i++;
72031
+ continue;
72032
+ }
72033
+ if (appCandidateActive && candidateHasEnv && !candidateEnvClosed && curlyDepth === 3) {
72034
+ if (candidateEnvOpenedOnLine) {
72035
+ candidateHasEnv = false;
72036
+ }
72037
+ const beforeBrace = lineCode.slice(0, -1);
72038
+ if (beforeBrace.trim() && candidateEnv) {
72039
+ parseEnvLine(beforeBrace, candidateEnv);
72040
+ }
72041
+ candidateEnvClosed = true;
72042
+ } else if (appCandidateActive && curlyDepth === 2 && squareDepth === 1) {
72043
+ if (candidateHasName && candidateHasScript && candidateHasArgs && candidateHasEnv && candidateEnvClosed) {
72044
+ matchedAppCount++;
72045
+ if (matchedAppCount > 1) return { kind: "rejected", text };
72046
+ matchedAppEnv = candidateEnv;
72047
+ }
72048
+ appCandidateActive = false;
72049
+ candidateEnv = null;
72050
+ } else if (moduleExportsOpened && !moduleExportsClosed && curlyDepth === 1 && squareDepth === 0) {
72051
+ moduleExportsClosed = true;
72052
+ }
72053
+ curlyDepth--;
72054
+ recentCode = "";
72055
+ i++;
72056
+ continue;
72057
+ }
72058
+ if (ch === "[") {
72059
+ if (moduleExportsOpened && !moduleExportsClosed && curlyDepth === 1 && squareDepth === 0) {
72060
+ if (/\bapps\s*:\s*\[$/.test(recentCode.trim())) {
72061
+ if (appsArrayOpened) return { kind: "rejected", text };
72062
+ appsArrayOpened = true;
72063
+ }
72064
+ }
72065
+ squareDepth++;
72066
+ recentCode = "";
72067
+ i++;
72068
+ continue;
72069
+ }
72070
+ if (ch === "]") {
72071
+ if (squareDepth === 0) return { kind: "rejected", text };
72072
+ if (moduleExportsOpened && !moduleExportsClosed && appsArrayOpened && squareDepth === 1 && curlyDepth === 1) {
72073
+ appsArrayClosed = true;
72074
+ }
72075
+ squareDepth--;
72076
+ recentCode = "";
72077
+ i++;
72078
+ continue;
72079
+ }
72080
+ if (ch === "(") {
72081
+ parenDepth++;
72082
+ i++;
72083
+ continue;
72084
+ }
72085
+ if (ch === ")") {
72086
+ if (parenDepth === 0) return { kind: "rejected", text };
72087
+ parenDepth--;
72088
+ i++;
72089
+ continue;
72090
+ }
72091
+ i++;
71043
72092
  }
72093
+ if (mode !== "code") return { kind: "rejected", text };
72094
+ if (curlyDepth !== 0 || squareDepth !== 0 || parenDepth !== 0) return { kind: "rejected", text };
72095
+ if (!moduleExportsOpened || !moduleExportsClosed) return { kind: "rejected", text };
72096
+ if (!appsArrayOpened || !appsArrayClosed) return { kind: "rejected", text };
72097
+ if (matchedAppCount !== 1 || !matchedAppEnv) return { kind: "rejected", text };
72098
+ return { kind: "accepted", env: matchedAppEnv, text };
72099
+ }
72100
+ var CURATED_KEYS = [
72101
+ "CODEX_HOME",
72102
+ "CLAUDE_CONFIG_DIR",
72103
+ "MRRLIN_DIRECTOR_BRIDGE_LOG",
72104
+ "MRRLIN_API_BASE_URL"
72105
+ ];
72106
+ function mergeConfigEnv(depsEnv, carriedEnv) {
72107
+ const isWin = process.platform === "win32";
72108
+ const DENIED_CARRIED_KEYS = new Set(isWin ? ["HOME", "PATH", "USER", "USERNAME"] : ["HOME", "PATH", "USER"]);
72109
+ const mergedEnv = /* @__PURE__ */ Object.create(null);
72110
+ const preservedNames = [];
72111
+ const droppedNames = [];
72112
+ const carriedKeys = Object.keys(carriedEnv);
72113
+ for (const key of carriedKeys) {
72114
+ if (DENIED_CARRIED_KEYS.has(key)) {
72115
+ droppedNames.push(key);
72116
+ continue;
72117
+ }
72118
+ const envVal = depsEnv[key];
72119
+ if (Object.hasOwn(depsEnv, key) && envVal !== void 0) {
72120
+ let installerVal = envVal;
72121
+ if (key === "CODEX_HOME" || key === "CLAUDE_CONFIG_DIR" || key === "MRRLIN_API_BASE_URL") {
72122
+ installerVal = installerVal.trim();
72123
+ }
72124
+ if (installerVal === "") {
72125
+ droppedNames.push(key);
72126
+ } else {
72127
+ preservedNames.push(key);
72128
+ mergedEnv[key] = installerVal;
72129
+ }
72130
+ } else {
72131
+ const carriedVal = carriedEnv[key];
72132
+ if (carriedVal !== void 0) {
72133
+ preservedNames.push(key);
72134
+ mergedEnv[key] = carriedVal;
72135
+ }
72136
+ }
72137
+ }
72138
+ for (const key of CURATED_KEYS) {
72139
+ if (Object.hasOwn(carriedEnv, key)) continue;
72140
+ const envVal = depsEnv[key];
72141
+ if (Object.hasOwn(depsEnv, key) && envVal !== void 0) {
72142
+ let val = envVal;
72143
+ if (key === "CODEX_HOME" || key === "CLAUDE_CONFIG_DIR" || key === "MRRLIN_API_BASE_URL") {
72144
+ val = val.trim();
72145
+ }
72146
+ if (val !== "") {
72147
+ mergedEnv[key] = val;
72148
+ }
72149
+ } else {
72150
+ if (key === "MRRLIN_DIRECTOR_BRIDGE_LOG") {
72151
+ mergedEnv[key] = "1";
72152
+ }
72153
+ }
72154
+ }
72155
+ preservedNames.sort();
72156
+ droppedNames.sort();
72157
+ return { mergedEnv, preservedNames, droppedNames };
71044
72158
  }
71045
- function normalizeServiceApiTarget(apiBaseUrl, allowRemote) {
71046
- const normalized = retargetRetiredApiBaseUrl(apiBaseUrl).baseUrl;
71047
- if (isProductionApiBaseUrl(normalized)) return {};
71048
- const target = { apiBaseUrl: normalized };
71049
- if (allowRemote && !isStagingApiBaseUrl(normalized) && !isLoopbackUrl(normalized)) target.apiAllowRemote = true;
71050
- return target;
72159
+ function deriveMergedApiRouting(mergedEnv, invokingBridgeUrl) {
72160
+ const result = /* @__PURE__ */ Object.create(null);
72161
+ for (const k of Object.keys(mergedEnv)) {
72162
+ if (k === "MRRLIN_STAGING" || k === "MRRLIN_API_ALLOW_REMOTE") continue;
72163
+ const v = mergedEnv[k];
72164
+ if (v !== void 0) {
72165
+ result[k] = v;
72166
+ }
72167
+ }
72168
+ if (Object.hasOwn(result, "MRRLIN_API_BASE_URL")) {
72169
+ const rawApi = result["MRRLIN_API_BASE_URL"];
72170
+ if (rawApi === "") {
72171
+ result["MRRLIN_API_BASE_URL"] = "";
72172
+ } else if (rawApi !== void 0) {
72173
+ const retargeted = retargetRetiredApiBaseUrl(rawApi).baseUrl;
72174
+ result["MRRLIN_API_BASE_URL"] = retargeted;
72175
+ }
72176
+ } else {
72177
+ if (mergedEnv["MRRLIN_STAGING"] === "1" || bridgeUrlImpliesStaging(invokingBridgeUrl)) {
72178
+ result["MRRLIN_API_BASE_URL"] = STAGING_API_BASE_URL;
72179
+ }
72180
+ }
72181
+ return result;
72182
+ }
72183
+ function escapeRegex2(s) {
72184
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
71051
72185
  }
71052
- function readExistingServiceApiTarget(deps, ecoPath) {
72186
+ function performConfigBackup(deps, ecoPath, existingText) {
71053
72187
  try {
71054
- const existing = deps.readFile?.(ecoPath);
71055
- if (!existing || !isOwnedEcosystemConfig(existing)) return void 0;
71056
- const apiBaseUrl = readEnvString(existing, "MRRLIN_API_BASE_URL");
71057
- if (apiBaseUrl) {
71058
- return normalizeServiceApiTarget(apiBaseUrl, readEnvString(existing, "MRRLIN_API_ALLOW_REMOTE") === "1");
72188
+ if (!deps.listDir || !deps.writeExclusiveFile) {
72189
+ deps.log("Service config backup failed.");
72190
+ return;
71059
72191
  }
71060
- if (readEnvString(existing, "MRRLIN_STAGING") === "1") {
71061
- return { apiBaseUrl: STAGING_API_BASE_URL };
72192
+ const dir = import_node_path38.default.dirname(ecoPath);
72193
+ let files;
72194
+ try {
72195
+ files = deps.listDir(dir);
72196
+ } catch {
72197
+ deps.log("Service config backup failed.");
72198
+ return;
71062
72199
  }
71063
- return void 0;
72200
+ if (!files || !Array.isArray(files)) {
72201
+ deps.log("Service config backup failed.");
72202
+ return;
72203
+ }
72204
+ const base = import_node_path38.default.basename(ecoPath);
72205
+ const backupRegex = new RegExp(`^${escapeRegex2(base)}\\.bak-\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}-\\d{3}Z$`);
72206
+ const existingBackups = files.filter((f) => backupRegex.test(f));
72207
+ if (existingBackups.length >= 10) {
72208
+ deps.log("Service config backup failed.");
72209
+ return;
72210
+ }
72211
+ let now;
72212
+ try {
72213
+ now = deps.clock ? deps.clock() : /* @__PURE__ */ new Date();
72214
+ } catch {
72215
+ deps.log("Service config backup failed.");
72216
+ return;
72217
+ }
72218
+ let iso;
72219
+ try {
72220
+ iso = now.toISOString();
72221
+ } catch {
72222
+ deps.log("Service config backup failed.");
72223
+ return;
72224
+ }
72225
+ if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(iso)) {
72226
+ deps.log("Service config backup failed.");
72227
+ return;
72228
+ }
72229
+ const ts = iso.replace(/:/g, "-").replace(/\./g, "-");
72230
+ const backupPath = `${ecoPath}.bak-${ts}`;
72231
+ deps.writeExclusiveFile(backupPath, existingText);
71064
72232
  } catch {
71065
- return void 0;
71066
- }
71067
- }
71068
- function deriveServiceApiTarget(deps, ecoPath) {
71069
- const apiBaseUrl = deps.env.MRRLIN_API_BASE_URL?.trim();
71070
- if (apiBaseUrl) return normalizeServiceApiTarget(apiBaseUrl, deps.env.MRRLIN_API_ALLOW_REMOTE === "1");
71071
- if (deps.env.MRRLIN_STAGING === "1" || bridgeUrlImpliesStaging(deps.env.MRRLIN_BRIDGE_URL)) {
71072
- return { apiBaseUrl: STAGING_API_BASE_URL };
72233
+ deps.log("Service config backup failed.");
71073
72234
  }
71074
- return readExistingServiceApiTarget(deps, ecoPath) ?? {};
71075
72235
  }
71076
72236
  var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
71077
72237
  function defaultHomeOwnerUid(home) {
@@ -71147,19 +72307,34 @@ function installService(deps) {
71147
72307
  /* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path38.default.dirname(b)), ...systemDirs])
71148
72308
  ).join(import_node_path38.default.delimiter);
71149
72309
  const ecoPath = import_node_path38.default.join(home, ".mrrlin", "ecosystem.config.cjs");
71150
- const apiTarget = deriveServiceApiTarget(deps, ecoPath);
72310
+ const existingText = deps.readFile ? deps.readFile(ecoPath) : null;
72311
+ const parseResult = parseExistingEcosystemConfig(existingText);
72312
+ if (parseResult.kind === "rejected") {
72313
+ deps.log("Service config env carry skipped.");
72314
+ }
72315
+ if (existingText !== null && existingText !== void 0) {
72316
+ performConfigBackup(deps, ecoPath, existingText);
72317
+ }
72318
+ const carriedEnv = parseResult.kind === "accepted" ? parseResult.env : /* @__PURE__ */ Object.create(null);
72319
+ const { mergedEnv, preservedNames, droppedNames } = mergeConfigEnv(deps.env, carriedEnv);
72320
+ const routedEnv = deriveMergedApiRouting(mergedEnv, deps.env.MRRLIN_BRIDGE_URL);
72321
+ routedEnv.HOME = home;
72322
+ routedEnv.PATH = pathEnv;
72323
+ if (user !== void 0) {
72324
+ routedEnv.USER = user;
72325
+ }
72326
+ if (preservedNames.length > 0) {
72327
+ deps.log(`Service env preserved: ${preservedNames.join(", ")}.`);
72328
+ }
72329
+ if (droppedNames.length > 0) {
72330
+ deps.log(`Service env dropped: ${droppedNames.join(", ")}.`);
72331
+ }
71151
72332
  const text = renderEcosystemConfig({
71152
72333
  cwd: resolved.cwd,
71153
- home,
71154
- user,
71155
- codexHome: deps.env.CODEX_HOME?.trim() || void 0,
71156
- claudeConfigDir: deps.env.CLAUDE_CONFIG_DIR?.trim() || void 0,
71157
- pathEnv,
71158
- apiBaseUrl: apiTarget.apiBaseUrl,
71159
- apiAllowRemote: apiTarget.apiAllowRemote
72334
+ env: routedEnv
71160
72335
  });
71161
72336
  deps.writeFile(ecoPath, text);
71162
- const start = deps.runPm2(["startOrReload", ecoPath, "--reset-env"]);
72337
+ const start = deps.runPm2(["startOrReload", ecoPath, "--update-env"]);
71163
72338
  if (start.code !== 0) {
71164
72339
  deps.log(`pm2 startOrReload failed (exit ${start.code}).`);
71165
72340
  return { ok: false };
@@ -71211,7 +72386,7 @@ function uninstallService(deps) {
71211
72386
  var import_promises16 = __toESM(require("node:fs/promises"), 1);
71212
72387
  var import_node_os19 = __toESM(require("node:os"), 1);
71213
72388
  var import_node_path39 = __toESM(require("node:path"), 1);
71214
- var toml4 = __toESM(require_toml(), 1);
72389
+ var toml5 = __toESM(require_toml(), 1);
71215
72390
  function resolveCodexHome3(options) {
71216
72391
  if (options.codexHome) return options.codexHome;
71217
72392
  if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
@@ -71237,7 +72412,7 @@ async function uninstallCodex(options = {}) {
71237
72412
  const existing = await import_promises16.default.readFile(realPath, "utf8");
71238
72413
  let parsed = null;
71239
72414
  try {
71240
- parsed = toml4.parse(existing);
72415
+ parsed = toml5.parse(existing);
71241
72416
  } catch (error51) {
71242
72417
  const detail = error51 instanceof Error ? error51.message : String(error51);
71243
72418
  const err = {
@@ -71437,11 +72612,11 @@ var HELP_TEXT = `mrrlin-mcp - Mrrlin Phase 1 MCP server CLI
71437
72612
 
71438
72613
  Usage:
71439
72614
  mrrlin-mcp serve Run the stdio MCP server. Honors
71440
- MRRLIN_API_BASE_URL (default http://127.0.0.1:8787)
71441
- and MRRLIN_TOKEN. Non-loopback API URLs require
71442
- MRRLIN_API_ALLOW_REMOTE=1 for a custom remote. Use
71443
- MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com
71444
- to target the known staging API.
72615
+ MRRLIN_API_BASE_URL (default
72616
+ https://api.mrrlin.com) and MRRLIN_TOKEN.
72617
+ Use MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com
72618
+ to target the known staging API, or http://127.0.0.1:8787
72619
+ for local development.
71445
72620
 
71446
72621
  mrrlin-mcp install-browser Idempotently install the dedicated, pinned
71447
72622
  Chromium into ~/.mrrlin/browser/browsers (its own
@@ -71478,15 +72653,9 @@ Usage:
71478
72653
  inline env table so \`serve\` boots even when the
71479
72654
  local 127.0.0.1:8787 is not running. Setup guide:
71480
72655
  MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com mrrlin-mcp configure bridge
71481
- is the canonical staging path. For a custom remote,
71482
- pass BOTH the URL AND the allow gate:
71483
- MRRLIN_API_BASE_URL=https://... \\
71484
- MRRLIN_API_ALLOW_REMOTE=1 mrrlin-mcp configure bridge
71485
- Without an allow gate, \`serve\` still refuses any
71486
- non-loopback URL (see \`mrrlin-mcp serve\` above).
72656
+ is the canonical staging path.
71487
72657
  An explicit URL is the only routing selector at bake
71488
- time. Production needs no routing env; a custom
71489
- remote also needs MRRLIN_API_ALLOW_REMOTE=1.
72658
+ time. Production is the default and needs no routing env.
71490
72659
  Re-running BARE (no env vars) over a block you
71491
72660
  already pinned to staging/a remote target is safe:
71492
72661
  it keeps your env verbatim (reported as
@@ -71518,11 +72687,9 @@ Usage:
71518
72687
  user turn text from the log when logging is enabled)
71519
72688
  It also hosts the execution-run consumer (advances
71520
72689
  pending runs, read-only). Consumer env:
71521
- - MRRLIN_API_BASE_URL (default http://127.0.0.1:8787;
71522
- non-loopback requires MRRLIN_API_ALLOW_REMOTE=1,
71523
- or an explicit staging API URL)
71524
- - MRRLIN_API_BASE_URL=https://api-staging.mrrlin.com
71525
- (known staging API)
72690
+ - MRRLIN_API_BASE_URL (default https://api.mrrlin.com;
72691
+ set to https://api-staging.mrrlin.com for staging,
72692
+ or http://127.0.0.1:8787 for local development)
71526
72693
  - MRRLIN_TOKEN (service-principal auth to the API;
71527
72694
  if unset, chat still works but claim-sweep /
71528
72695
  autonomous execution stays disabled)
@@ -71782,6 +72949,15 @@ async function main() {
71782
72949
  (0, import_node_fs25.mkdirSync)(import_node_path42.default.dirname(p), { recursive: true, mode: 448 });
71783
72950
  (0, import_node_fs25.writeFileSync)(p, c, { mode: 384 });
71784
72951
  },
72952
+ writeExclusiveFile: (p, c) => (0, import_node_fs25.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
72953
+ listDir: (p) => {
72954
+ try {
72955
+ return (0, import_node_fs25.readdirSync)(p);
72956
+ } catch {
72957
+ return null;
72958
+ }
72959
+ },
72960
+ clock: () => /* @__PURE__ */ new Date(),
71785
72961
  // Swallows every error on purpose — the only caller uses this to recover settings from the
71786
72962
  // config it is about to overwrite, and a missing or unreadable file means "no previous
71787
72963
  // value", never a failed install. See readExistingTelemetryDefaultProject.