@mrrlin-dev/mcp 0.3.47 → 0.3.50
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.
- package/dist/bin.cjs +1016 -546
- package/dist/consensus/personas/compliance-reviewer.md +29 -0
- package/package.json +4 -4
package/dist/bin.cjs
CHANGED
|
@@ -7703,54 +7703,54 @@ var require_polyfills = __commonJS({
|
|
|
7703
7703
|
}
|
|
7704
7704
|
var chdir;
|
|
7705
7705
|
module2.exports = patch;
|
|
7706
|
-
function patch(
|
|
7706
|
+
function patch(fs8) {
|
|
7707
7707
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
7708
|
-
patchLchmod(
|
|
7709
|
-
}
|
|
7710
|
-
if (!
|
|
7711
|
-
patchLutimes(
|
|
7712
|
-
}
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
if (
|
|
7732
|
-
|
|
7708
|
+
patchLchmod(fs8);
|
|
7709
|
+
}
|
|
7710
|
+
if (!fs8.lutimes) {
|
|
7711
|
+
patchLutimes(fs8);
|
|
7712
|
+
}
|
|
7713
|
+
fs8.chown = chownFix(fs8.chown);
|
|
7714
|
+
fs8.fchown = chownFix(fs8.fchown);
|
|
7715
|
+
fs8.lchown = chownFix(fs8.lchown);
|
|
7716
|
+
fs8.chmod = chmodFix(fs8.chmod);
|
|
7717
|
+
fs8.fchmod = chmodFix(fs8.fchmod);
|
|
7718
|
+
fs8.lchmod = chmodFix(fs8.lchmod);
|
|
7719
|
+
fs8.chownSync = chownFixSync(fs8.chownSync);
|
|
7720
|
+
fs8.fchownSync = chownFixSync(fs8.fchownSync);
|
|
7721
|
+
fs8.lchownSync = chownFixSync(fs8.lchownSync);
|
|
7722
|
+
fs8.chmodSync = chmodFixSync(fs8.chmodSync);
|
|
7723
|
+
fs8.fchmodSync = chmodFixSync(fs8.fchmodSync);
|
|
7724
|
+
fs8.lchmodSync = chmodFixSync(fs8.lchmodSync);
|
|
7725
|
+
fs8.stat = statFix(fs8.stat);
|
|
7726
|
+
fs8.fstat = statFix(fs8.fstat);
|
|
7727
|
+
fs8.lstat = statFix(fs8.lstat);
|
|
7728
|
+
fs8.statSync = statFixSync(fs8.statSync);
|
|
7729
|
+
fs8.fstatSync = statFixSync(fs8.fstatSync);
|
|
7730
|
+
fs8.lstatSync = statFixSync(fs8.lstatSync);
|
|
7731
|
+
if (fs8.chmod && !fs8.lchmod) {
|
|
7732
|
+
fs8.lchmod = function(path18, mode, cb) {
|
|
7733
7733
|
if (cb) process.nextTick(cb);
|
|
7734
7734
|
};
|
|
7735
|
-
|
|
7735
|
+
fs8.lchmodSync = function() {
|
|
7736
7736
|
};
|
|
7737
7737
|
}
|
|
7738
|
-
if (
|
|
7739
|
-
|
|
7738
|
+
if (fs8.chown && !fs8.lchown) {
|
|
7739
|
+
fs8.lchown = function(path18, uid, gid, cb) {
|
|
7740
7740
|
if (cb) process.nextTick(cb);
|
|
7741
7741
|
};
|
|
7742
|
-
|
|
7742
|
+
fs8.lchownSync = function() {
|
|
7743
7743
|
};
|
|
7744
7744
|
}
|
|
7745
7745
|
if (platform === "win32") {
|
|
7746
|
-
|
|
7746
|
+
fs8.rename = typeof fs8.rename !== "function" ? fs8.rename : function(fs$rename) {
|
|
7747
7747
|
function rename(from, to, cb) {
|
|
7748
7748
|
var start = Date.now();
|
|
7749
7749
|
var backoff = 0;
|
|
7750
7750
|
fs$rename(from, to, function CB(er) {
|
|
7751
7751
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
7752
7752
|
setTimeout(function() {
|
|
7753
|
-
|
|
7753
|
+
fs8.stat(to, function(stater, st) {
|
|
7754
7754
|
if (stater && stater.code === "ENOENT")
|
|
7755
7755
|
fs$rename(from, to, CB);
|
|
7756
7756
|
else
|
|
@@ -7766,9 +7766,9 @@ var require_polyfills = __commonJS({
|
|
|
7766
7766
|
}
|
|
7767
7767
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
7768
7768
|
return rename;
|
|
7769
|
-
}(
|
|
7769
|
+
}(fs8.rename);
|
|
7770
7770
|
}
|
|
7771
|
-
|
|
7771
|
+
fs8.read = typeof fs8.read !== "function" ? fs8.read : function(fs$read) {
|
|
7772
7772
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
7773
7773
|
var callback;
|
|
7774
7774
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -7776,22 +7776,22 @@ var require_polyfills = __commonJS({
|
|
|
7776
7776
|
callback = function(er, _, __) {
|
|
7777
7777
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
7778
7778
|
eagCounter++;
|
|
7779
|
-
return fs$read.call(
|
|
7779
|
+
return fs$read.call(fs8, fd, buffer, offset, length, position, callback);
|
|
7780
7780
|
}
|
|
7781
7781
|
callback_.apply(this, arguments);
|
|
7782
7782
|
};
|
|
7783
7783
|
}
|
|
7784
|
-
return fs$read.call(
|
|
7784
|
+
return fs$read.call(fs8, fd, buffer, offset, length, position, callback);
|
|
7785
7785
|
}
|
|
7786
7786
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
7787
7787
|
return read;
|
|
7788
|
-
}(
|
|
7789
|
-
|
|
7788
|
+
}(fs8.read);
|
|
7789
|
+
fs8.readSync = typeof fs8.readSync !== "function" ? fs8.readSync : /* @__PURE__ */ function(fs$readSync) {
|
|
7790
7790
|
return function(fd, buffer, offset, length, position) {
|
|
7791
7791
|
var eagCounter = 0;
|
|
7792
7792
|
while (true) {
|
|
7793
7793
|
try {
|
|
7794
|
-
return fs$readSync.call(
|
|
7794
|
+
return fs$readSync.call(fs8, fd, buffer, offset, length, position);
|
|
7795
7795
|
} catch (er) {
|
|
7796
7796
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
7797
7797
|
eagCounter++;
|
|
@@ -7801,11 +7801,11 @@ var require_polyfills = __commonJS({
|
|
|
7801
7801
|
}
|
|
7802
7802
|
}
|
|
7803
7803
|
};
|
|
7804
|
-
}(
|
|
7805
|
-
function patchLchmod(
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7804
|
+
}(fs8.readSync);
|
|
7805
|
+
function patchLchmod(fs9) {
|
|
7806
|
+
fs9.lchmod = function(path18, mode, callback) {
|
|
7807
|
+
fs9.open(
|
|
7808
|
+
path18,
|
|
7809
7809
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
7810
7810
|
mode,
|
|
7811
7811
|
function(err, fd) {
|
|
@@ -7813,80 +7813,80 @@ var require_polyfills = __commonJS({
|
|
|
7813
7813
|
if (callback) callback(err);
|
|
7814
7814
|
return;
|
|
7815
7815
|
}
|
|
7816
|
-
|
|
7817
|
-
|
|
7816
|
+
fs9.fchmod(fd, mode, function(err2) {
|
|
7817
|
+
fs9.close(fd, function(err22) {
|
|
7818
7818
|
if (callback) callback(err2 || err22);
|
|
7819
7819
|
});
|
|
7820
7820
|
});
|
|
7821
7821
|
}
|
|
7822
7822
|
);
|
|
7823
7823
|
};
|
|
7824
|
-
|
|
7825
|
-
var fd =
|
|
7824
|
+
fs9.lchmodSync = function(path18, mode) {
|
|
7825
|
+
var fd = fs9.openSync(path18, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
7826
7826
|
var threw = true;
|
|
7827
7827
|
var ret;
|
|
7828
7828
|
try {
|
|
7829
|
-
ret =
|
|
7829
|
+
ret = fs9.fchmodSync(fd, mode);
|
|
7830
7830
|
threw = false;
|
|
7831
7831
|
} finally {
|
|
7832
7832
|
if (threw) {
|
|
7833
7833
|
try {
|
|
7834
|
-
|
|
7834
|
+
fs9.closeSync(fd);
|
|
7835
7835
|
} catch (er) {
|
|
7836
7836
|
}
|
|
7837
7837
|
} else {
|
|
7838
|
-
|
|
7838
|
+
fs9.closeSync(fd);
|
|
7839
7839
|
}
|
|
7840
7840
|
}
|
|
7841
7841
|
return ret;
|
|
7842
7842
|
};
|
|
7843
7843
|
}
|
|
7844
|
-
function patchLutimes(
|
|
7845
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
7846
|
-
|
|
7847
|
-
|
|
7844
|
+
function patchLutimes(fs9) {
|
|
7845
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs9.futimes) {
|
|
7846
|
+
fs9.lutimes = function(path18, at, mt, cb) {
|
|
7847
|
+
fs9.open(path18, constants.O_SYMLINK, function(er, fd) {
|
|
7848
7848
|
if (er) {
|
|
7849
7849
|
if (cb) cb(er);
|
|
7850
7850
|
return;
|
|
7851
7851
|
}
|
|
7852
|
-
|
|
7853
|
-
|
|
7852
|
+
fs9.futimes(fd, at, mt, function(er2) {
|
|
7853
|
+
fs9.close(fd, function(er22) {
|
|
7854
7854
|
if (cb) cb(er2 || er22);
|
|
7855
7855
|
});
|
|
7856
7856
|
});
|
|
7857
7857
|
});
|
|
7858
7858
|
};
|
|
7859
|
-
|
|
7860
|
-
var fd =
|
|
7859
|
+
fs9.lutimesSync = function(path18, at, mt) {
|
|
7860
|
+
var fd = fs9.openSync(path18, constants.O_SYMLINK);
|
|
7861
7861
|
var ret;
|
|
7862
7862
|
var threw = true;
|
|
7863
7863
|
try {
|
|
7864
|
-
ret =
|
|
7864
|
+
ret = fs9.futimesSync(fd, at, mt);
|
|
7865
7865
|
threw = false;
|
|
7866
7866
|
} finally {
|
|
7867
7867
|
if (threw) {
|
|
7868
7868
|
try {
|
|
7869
|
-
|
|
7869
|
+
fs9.closeSync(fd);
|
|
7870
7870
|
} catch (er) {
|
|
7871
7871
|
}
|
|
7872
7872
|
} else {
|
|
7873
|
-
|
|
7873
|
+
fs9.closeSync(fd);
|
|
7874
7874
|
}
|
|
7875
7875
|
}
|
|
7876
7876
|
return ret;
|
|
7877
7877
|
};
|
|
7878
|
-
} else if (
|
|
7879
|
-
|
|
7878
|
+
} else if (fs9.futimes) {
|
|
7879
|
+
fs9.lutimes = function(_a3, _b, _c, cb) {
|
|
7880
7880
|
if (cb) process.nextTick(cb);
|
|
7881
7881
|
};
|
|
7882
|
-
|
|
7882
|
+
fs9.lutimesSync = function() {
|
|
7883
7883
|
};
|
|
7884
7884
|
}
|
|
7885
7885
|
}
|
|
7886
7886
|
function chmodFix(orig) {
|
|
7887
7887
|
if (!orig) return orig;
|
|
7888
7888
|
return function(target, mode, cb) {
|
|
7889
|
-
return orig.call(
|
|
7889
|
+
return orig.call(fs8, target, mode, function(er) {
|
|
7890
7890
|
if (chownErOk(er)) er = null;
|
|
7891
7891
|
if (cb) cb.apply(this, arguments);
|
|
7892
7892
|
});
|
|
@@ -7896,7 +7896,7 @@ var require_polyfills = __commonJS({
|
|
|
7896
7896
|
if (!orig) return orig;
|
|
7897
7897
|
return function(target, mode) {
|
|
7898
7898
|
try {
|
|
7899
|
-
return orig.call(
|
|
7899
|
+
return orig.call(fs8, target, mode);
|
|
7900
7900
|
} catch (er) {
|
|
7901
7901
|
if (!chownErOk(er)) throw er;
|
|
7902
7902
|
}
|
|
@@ -7905,7 +7905,7 @@ var require_polyfills = __commonJS({
|
|
|
7905
7905
|
function chownFix(orig) {
|
|
7906
7906
|
if (!orig) return orig;
|
|
7907
7907
|
return function(target, uid, gid, cb) {
|
|
7908
|
-
return orig.call(
|
|
7908
|
+
return orig.call(fs8, target, uid, gid, function(er) {
|
|
7909
7909
|
if (chownErOk(er)) er = null;
|
|
7910
7910
|
if (cb) cb.apply(this, arguments);
|
|
7911
7911
|
});
|
|
@@ -7915,7 +7915,7 @@ var require_polyfills = __commonJS({
|
|
|
7915
7915
|
if (!orig) return orig;
|
|
7916
7916
|
return function(target, uid, gid) {
|
|
7917
7917
|
try {
|
|
7918
|
-
return orig.call(
|
|
7918
|
+
return orig.call(fs8, target, uid, gid);
|
|
7919
7919
|
} catch (er) {
|
|
7920
7920
|
if (!chownErOk(er)) throw er;
|
|
7921
7921
|
}
|
|
@@ -7935,13 +7935,13 @@ var require_polyfills = __commonJS({
|
|
|
7935
7935
|
}
|
|
7936
7936
|
if (cb) cb.apply(this, arguments);
|
|
7937
7937
|
}
|
|
7938
|
-
return options ? orig.call(
|
|
7938
|
+
return options ? orig.call(fs8, target, options, callback) : orig.call(fs8, target, callback);
|
|
7939
7939
|
};
|
|
7940
7940
|
}
|
|
7941
7941
|
function statFixSync(orig) {
|
|
7942
7942
|
if (!orig) return orig;
|
|
7943
7943
|
return function(target, options) {
|
|
7944
|
-
var stats = options ? orig.call(
|
|
7944
|
+
var stats = options ? orig.call(fs8, target, options) : orig.call(fs8, target);
|
|
7945
7945
|
if (stats) {
|
|
7946
7946
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
7947
7947
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -7970,16 +7970,16 @@ var require_legacy_streams = __commonJS({
|
|
|
7970
7970
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
|
|
7971
7971
|
var Stream = require("stream").Stream;
|
|
7972
7972
|
module2.exports = legacy;
|
|
7973
|
-
function legacy(
|
|
7973
|
+
function legacy(fs8) {
|
|
7974
7974
|
return {
|
|
7975
7975
|
ReadStream,
|
|
7976
7976
|
WriteStream
|
|
7977
7977
|
};
|
|
7978
|
-
function ReadStream(
|
|
7979
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
7978
|
+
function ReadStream(path18, options) {
|
|
7979
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path18, options);
|
|
7980
7980
|
Stream.call(this);
|
|
7981
7981
|
var self = this;
|
|
7982
|
-
this.path =
|
|
7982
|
+
this.path = path18;
|
|
7983
7983
|
this.fd = null;
|
|
7984
7984
|
this.readable = true;
|
|
7985
7985
|
this.paused = false;
|
|
@@ -8013,7 +8013,7 @@ var require_legacy_streams = __commonJS({
|
|
|
8013
8013
|
});
|
|
8014
8014
|
return;
|
|
8015
8015
|
}
|
|
8016
|
-
|
|
8016
|
+
fs8.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
8017
8017
|
if (err) {
|
|
8018
8018
|
self.emit("error", err);
|
|
8019
8019
|
self.readable = false;
|
|
@@ -8024,10 +8024,10 @@ var require_legacy_streams = __commonJS({
|
|
|
8024
8024
|
self._read();
|
|
8025
8025
|
});
|
|
8026
8026
|
}
|
|
8027
|
-
function WriteStream(
|
|
8028
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
8027
|
+
function WriteStream(path18, options) {
|
|
8028
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path18, options);
|
|
8029
8029
|
Stream.call(this);
|
|
8030
|
-
this.path =
|
|
8030
|
+
this.path = path18;
|
|
8031
8031
|
this.fd = null;
|
|
8032
8032
|
this.writable = true;
|
|
8033
8033
|
this.flags = "w";
|
|
@@ -8052,7 +8052,7 @@ var require_legacy_streams = __commonJS({
|
|
|
8052
8052
|
this.busy = false;
|
|
8053
8053
|
this._queue = [];
|
|
8054
8054
|
if (this.fd === null) {
|
|
8055
|
-
this._open =
|
|
8055
|
+
this._open = fs8.open;
|
|
8056
8056
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
8057
8057
|
this.flush();
|
|
8058
8058
|
}
|
|
@@ -8087,7 +8087,7 @@ var require_clone = __commonJS({
|
|
|
8087
8087
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
8088
8088
|
var require_graceful_fs = __commonJS({
|
|
8089
8089
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
|
|
8090
|
-
var
|
|
8090
|
+
var fs8 = require("fs");
|
|
8091
8091
|
var polyfills = require_polyfills();
|
|
8092
8092
|
var legacy = require_legacy_streams();
|
|
8093
8093
|
var clone2 = require_clone();
|
|
@@ -8119,12 +8119,12 @@ var require_graceful_fs = __commonJS({
|
|
|
8119
8119
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
8120
8120
|
console.error(m);
|
|
8121
8121
|
};
|
|
8122
|
-
if (!
|
|
8122
|
+
if (!fs8[gracefulQueue]) {
|
|
8123
8123
|
queue = global[gracefulQueue] || [];
|
|
8124
|
-
publishQueue(
|
|
8125
|
-
|
|
8124
|
+
publishQueue(fs8, queue);
|
|
8125
|
+
fs8.close = function(fs$close) {
|
|
8126
8126
|
function close(fd, cb) {
|
|
8127
|
-
return fs$close.call(
|
|
8127
|
+
return fs$close.call(fs8, fd, function(err) {
|
|
8128
8128
|
if (!err) {
|
|
8129
8129
|
resetQueue();
|
|
8130
8130
|
}
|
|
@@ -8136,48 +8136,48 @@ var require_graceful_fs = __commonJS({
|
|
|
8136
8136
|
value: fs$close
|
|
8137
8137
|
});
|
|
8138
8138
|
return close;
|
|
8139
|
-
}(
|
|
8140
|
-
|
|
8139
|
+
}(fs8.close);
|
|
8140
|
+
fs8.closeSync = function(fs$closeSync) {
|
|
8141
8141
|
function closeSync(fd) {
|
|
8142
|
-
fs$closeSync.apply(
|
|
8142
|
+
fs$closeSync.apply(fs8, arguments);
|
|
8143
8143
|
resetQueue();
|
|
8144
8144
|
}
|
|
8145
8145
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
8146
8146
|
value: fs$closeSync
|
|
8147
8147
|
});
|
|
8148
8148
|
return closeSync;
|
|
8149
|
-
}(
|
|
8149
|
+
}(fs8.closeSync);
|
|
8150
8150
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
8151
8151
|
process.on("exit", function() {
|
|
8152
|
-
debug(
|
|
8153
|
-
require("assert").equal(
|
|
8152
|
+
debug(fs8[gracefulQueue]);
|
|
8153
|
+
require("assert").equal(fs8[gracefulQueue].length, 0);
|
|
8154
8154
|
});
|
|
8155
8155
|
}
|
|
8156
8156
|
}
|
|
8157
8157
|
var queue;
|
|
8158
8158
|
if (!global[gracefulQueue]) {
|
|
8159
|
-
publishQueue(global,
|
|
8160
|
-
}
|
|
8161
|
-
module2.exports = patch(clone2(
|
|
8162
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
8163
|
-
module2.exports = patch(
|
|
8164
|
-
|
|
8165
|
-
}
|
|
8166
|
-
function patch(
|
|
8167
|
-
polyfills(
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
var fs$readFile =
|
|
8172
|
-
|
|
8173
|
-
function readFile2(
|
|
8159
|
+
publishQueue(global, fs8[gracefulQueue]);
|
|
8160
|
+
}
|
|
8161
|
+
module2.exports = patch(clone2(fs8));
|
|
8162
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs8.__patched) {
|
|
8163
|
+
module2.exports = patch(fs8);
|
|
8164
|
+
fs8.__patched = true;
|
|
8165
|
+
}
|
|
8166
|
+
function patch(fs9) {
|
|
8167
|
+
polyfills(fs9);
|
|
8168
|
+
fs9.gracefulify = patch;
|
|
8169
|
+
fs9.createReadStream = createReadStream;
|
|
8170
|
+
fs9.createWriteStream = createWriteStream;
|
|
8171
|
+
var fs$readFile = fs9.readFile;
|
|
8172
|
+
fs9.readFile = readFile2;
|
|
8173
|
+
function readFile2(path18, options, cb) {
|
|
8174
8174
|
if (typeof options === "function")
|
|
8175
8175
|
cb = options, options = null;
|
|
8176
|
-
return go$readFile(
|
|
8177
|
-
function go$readFile(
|
|
8178
|
-
return fs$readFile(
|
|
8176
|
+
return go$readFile(path18, options, cb);
|
|
8177
|
+
function go$readFile(path19, options2, cb2, startTime) {
|
|
8178
|
+
return fs$readFile(path19, options2, function(err) {
|
|
8179
8179
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8180
|
-
enqueue([go$readFile, [
|
|
8180
|
+
enqueue([go$readFile, [path19, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8181
8181
|
else {
|
|
8182
8182
|
if (typeof cb2 === "function")
|
|
8183
8183
|
cb2.apply(this, arguments);
|
|
@@ -8185,16 +8185,16 @@ var require_graceful_fs = __commonJS({
|
|
|
8185
8185
|
});
|
|
8186
8186
|
}
|
|
8187
8187
|
}
|
|
8188
|
-
var fs$writeFile =
|
|
8189
|
-
|
|
8190
|
-
function writeFile(
|
|
8188
|
+
var fs$writeFile = fs9.writeFile;
|
|
8189
|
+
fs9.writeFile = writeFile;
|
|
8190
|
+
function writeFile(path18, data, options, cb) {
|
|
8191
8191
|
if (typeof options === "function")
|
|
8192
8192
|
cb = options, options = null;
|
|
8193
|
-
return go$writeFile(
|
|
8194
|
-
function go$writeFile(
|
|
8195
|
-
return fs$writeFile(
|
|
8193
|
+
return go$writeFile(path18, data, options, cb);
|
|
8194
|
+
function go$writeFile(path19, data2, options2, cb2, startTime) {
|
|
8195
|
+
return fs$writeFile(path19, data2, options2, function(err) {
|
|
8196
8196
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8197
|
-
enqueue([go$writeFile, [
|
|
8197
|
+
enqueue([go$writeFile, [path19, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8198
8198
|
else {
|
|
8199
8199
|
if (typeof cb2 === "function")
|
|
8200
8200
|
cb2.apply(this, arguments);
|
|
@@ -8202,17 +8202,17 @@ var require_graceful_fs = __commonJS({
|
|
|
8202
8202
|
});
|
|
8203
8203
|
}
|
|
8204
8204
|
}
|
|
8205
|
-
var fs$appendFile =
|
|
8205
|
+
var fs$appendFile = fs9.appendFile;
|
|
8206
8206
|
if (fs$appendFile)
|
|
8207
|
-
|
|
8208
|
-
function appendFile(
|
|
8207
|
+
fs9.appendFile = appendFile;
|
|
8208
|
+
function appendFile(path18, data, options, cb) {
|
|
8209
8209
|
if (typeof options === "function")
|
|
8210
8210
|
cb = options, options = null;
|
|
8211
|
-
return go$appendFile(
|
|
8212
|
-
function go$appendFile(
|
|
8213
|
-
return fs$appendFile(
|
|
8211
|
+
return go$appendFile(path18, data, options, cb);
|
|
8212
|
+
function go$appendFile(path19, data2, options2, cb2, startTime) {
|
|
8213
|
+
return fs$appendFile(path19, data2, options2, function(err) {
|
|
8214
8214
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8215
|
-
enqueue([go$appendFile, [
|
|
8215
|
+
enqueue([go$appendFile, [path19, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8216
8216
|
else {
|
|
8217
8217
|
if (typeof cb2 === "function")
|
|
8218
8218
|
cb2.apply(this, arguments);
|
|
@@ -8220,9 +8220,9 @@ var require_graceful_fs = __commonJS({
|
|
|
8220
8220
|
});
|
|
8221
8221
|
}
|
|
8222
8222
|
}
|
|
8223
|
-
var fs$copyFile =
|
|
8223
|
+
var fs$copyFile = fs9.copyFile;
|
|
8224
8224
|
if (fs$copyFile)
|
|
8225
|
-
|
|
8225
|
+
fs9.copyFile = copyFile;
|
|
8226
8226
|
function copyFile(src, dest, flags, cb) {
|
|
8227
8227
|
if (typeof flags === "function") {
|
|
8228
8228
|
cb = flags;
|
|
@@ -8240,34 +8240,34 @@ var require_graceful_fs = __commonJS({
|
|
|
8240
8240
|
});
|
|
8241
8241
|
}
|
|
8242
8242
|
}
|
|
8243
|
-
var fs$readdir =
|
|
8244
|
-
|
|
8243
|
+
var fs$readdir = fs9.readdir;
|
|
8244
|
+
fs9.readdir = readdir2;
|
|
8245
8245
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
8246
|
-
function readdir2(
|
|
8246
|
+
function readdir2(path18, options, cb) {
|
|
8247
8247
|
if (typeof options === "function")
|
|
8248
8248
|
cb = options, options = null;
|
|
8249
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
8250
|
-
return fs$readdir(
|
|
8251
|
-
|
|
8249
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path19, options2, cb2, startTime) {
|
|
8250
|
+
return fs$readdir(path19, fs$readdirCallback(
|
|
8251
|
+
path19,
|
|
8252
8252
|
options2,
|
|
8253
8253
|
cb2,
|
|
8254
8254
|
startTime
|
|
8255
8255
|
));
|
|
8256
|
-
} : function go$readdir2(
|
|
8257
|
-
return fs$readdir(
|
|
8258
|
-
|
|
8256
|
+
} : function go$readdir2(path19, options2, cb2, startTime) {
|
|
8257
|
+
return fs$readdir(path19, options2, fs$readdirCallback(
|
|
8258
|
+
path19,
|
|
8259
8259
|
options2,
|
|
8260
8260
|
cb2,
|
|
8261
8261
|
startTime
|
|
8262
8262
|
));
|
|
8263
8263
|
};
|
|
8264
|
-
return go$readdir(
|
|
8265
|
-
function fs$readdirCallback(
|
|
8264
|
+
return go$readdir(path18, options, cb);
|
|
8265
|
+
function fs$readdirCallback(path19, options2, cb2, startTime) {
|
|
8266
8266
|
return function(err, files) {
|
|
8267
8267
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8268
8268
|
enqueue([
|
|
8269
8269
|
go$readdir,
|
|
8270
|
-
[
|
|
8270
|
+
[path19, options2, cb2],
|
|
8271
8271
|
err,
|
|
8272
8272
|
startTime || Date.now(),
|
|
8273
8273
|
Date.now()
|
|
@@ -8282,21 +8282,21 @@ var require_graceful_fs = __commonJS({
|
|
|
8282
8282
|
}
|
|
8283
8283
|
}
|
|
8284
8284
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
8285
|
-
var legStreams = legacy(
|
|
8285
|
+
var legStreams = legacy(fs9);
|
|
8286
8286
|
ReadStream = legStreams.ReadStream;
|
|
8287
8287
|
WriteStream = legStreams.WriteStream;
|
|
8288
8288
|
}
|
|
8289
|
-
var fs$ReadStream =
|
|
8289
|
+
var fs$ReadStream = fs9.ReadStream;
|
|
8290
8290
|
if (fs$ReadStream) {
|
|
8291
8291
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
8292
8292
|
ReadStream.prototype.open = ReadStream$open;
|
|
8293
8293
|
}
|
|
8294
|
-
var fs$WriteStream =
|
|
8294
|
+
var fs$WriteStream = fs9.WriteStream;
|
|
8295
8295
|
if (fs$WriteStream) {
|
|
8296
8296
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
8297
8297
|
WriteStream.prototype.open = WriteStream$open;
|
|
8298
8298
|
}
|
|
8299
|
-
Object.defineProperty(
|
|
8299
|
+
Object.defineProperty(fs9, "ReadStream", {
|
|
8300
8300
|
get: function() {
|
|
8301
8301
|
return ReadStream;
|
|
8302
8302
|
},
|
|
@@ -8306,7 +8306,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8306
8306
|
enumerable: true,
|
|
8307
8307
|
configurable: true
|
|
8308
8308
|
});
|
|
8309
|
-
Object.defineProperty(
|
|
8309
|
+
Object.defineProperty(fs9, "WriteStream", {
|
|
8310
8310
|
get: function() {
|
|
8311
8311
|
return WriteStream;
|
|
8312
8312
|
},
|
|
@@ -8317,7 +8317,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8317
8317
|
configurable: true
|
|
8318
8318
|
});
|
|
8319
8319
|
var FileReadStream = ReadStream;
|
|
8320
|
-
Object.defineProperty(
|
|
8320
|
+
Object.defineProperty(fs9, "FileReadStream", {
|
|
8321
8321
|
get: function() {
|
|
8322
8322
|
return FileReadStream;
|
|
8323
8323
|
},
|
|
@@ -8328,7 +8328,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8328
8328
|
configurable: true
|
|
8329
8329
|
});
|
|
8330
8330
|
var FileWriteStream = WriteStream;
|
|
8331
|
-
Object.defineProperty(
|
|
8331
|
+
Object.defineProperty(fs9, "FileWriteStream", {
|
|
8332
8332
|
get: function() {
|
|
8333
8333
|
return FileWriteStream;
|
|
8334
8334
|
},
|
|
@@ -8338,7 +8338,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8338
8338
|
enumerable: true,
|
|
8339
8339
|
configurable: true
|
|
8340
8340
|
});
|
|
8341
|
-
function ReadStream(
|
|
8341
|
+
function ReadStream(path18, options) {
|
|
8342
8342
|
if (this instanceof ReadStream)
|
|
8343
8343
|
return fs$ReadStream.apply(this, arguments), this;
|
|
8344
8344
|
else
|
|
@@ -8358,7 +8358,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8358
8358
|
}
|
|
8359
8359
|
});
|
|
8360
8360
|
}
|
|
8361
|
-
function WriteStream(
|
|
8361
|
+
function WriteStream(path18, options) {
|
|
8362
8362
|
if (this instanceof WriteStream)
|
|
8363
8363
|
return fs$WriteStream.apply(this, arguments), this;
|
|
8364
8364
|
else
|
|
@@ -8376,22 +8376,22 @@ var require_graceful_fs = __commonJS({
|
|
|
8376
8376
|
}
|
|
8377
8377
|
});
|
|
8378
8378
|
}
|
|
8379
|
-
function createReadStream(
|
|
8380
|
-
return new
|
|
8379
|
+
function createReadStream(path18, options) {
|
|
8380
|
+
return new fs9.ReadStream(path18, options);
|
|
8381
8381
|
}
|
|
8382
|
-
function createWriteStream(
|
|
8383
|
-
return new
|
|
8382
|
+
function createWriteStream(path18, options) {
|
|
8383
|
+
return new fs9.WriteStream(path18, options);
|
|
8384
8384
|
}
|
|
8385
|
-
var fs$open =
|
|
8386
|
-
|
|
8387
|
-
function open(
|
|
8385
|
+
var fs$open = fs9.open;
|
|
8386
|
+
fs9.open = open;
|
|
8387
|
+
function open(path18, flags, mode, cb) {
|
|
8388
8388
|
if (typeof mode === "function")
|
|
8389
8389
|
cb = mode, mode = null;
|
|
8390
|
-
return go$open(
|
|
8391
|
-
function go$open(
|
|
8392
|
-
return fs$open(
|
|
8390
|
+
return go$open(path18, flags, mode, cb);
|
|
8391
|
+
function go$open(path19, flags2, mode2, cb2, startTime) {
|
|
8392
|
+
return fs$open(path19, flags2, mode2, function(err, fd) {
|
|
8393
8393
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8394
|
-
enqueue([go$open, [
|
|
8394
|
+
enqueue([go$open, [path19, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8395
8395
|
else {
|
|
8396
8396
|
if (typeof cb2 === "function")
|
|
8397
8397
|
cb2.apply(this, arguments);
|
|
@@ -8399,20 +8399,20 @@ var require_graceful_fs = __commonJS({
|
|
|
8399
8399
|
});
|
|
8400
8400
|
}
|
|
8401
8401
|
}
|
|
8402
|
-
return
|
|
8402
|
+
return fs9;
|
|
8403
8403
|
}
|
|
8404
8404
|
function enqueue(elem) {
|
|
8405
8405
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
8406
|
-
|
|
8406
|
+
fs8[gracefulQueue].push(elem);
|
|
8407
8407
|
retry();
|
|
8408
8408
|
}
|
|
8409
8409
|
var retryTimer;
|
|
8410
8410
|
function resetQueue() {
|
|
8411
8411
|
var now = Date.now();
|
|
8412
|
-
for (var i = 0; i <
|
|
8413
|
-
if (
|
|
8414
|
-
|
|
8415
|
-
|
|
8412
|
+
for (var i = 0; i < fs8[gracefulQueue].length; ++i) {
|
|
8413
|
+
if (fs8[gracefulQueue][i].length > 2) {
|
|
8414
|
+
fs8[gracefulQueue][i][3] = now;
|
|
8415
|
+
fs8[gracefulQueue][i][4] = now;
|
|
8416
8416
|
}
|
|
8417
8417
|
}
|
|
8418
8418
|
retry();
|
|
@@ -8420,9 +8420,9 @@ var require_graceful_fs = __commonJS({
|
|
|
8420
8420
|
function retry() {
|
|
8421
8421
|
clearTimeout(retryTimer);
|
|
8422
8422
|
retryTimer = void 0;
|
|
8423
|
-
if (
|
|
8423
|
+
if (fs8[gracefulQueue].length === 0)
|
|
8424
8424
|
return;
|
|
8425
|
-
var elem =
|
|
8425
|
+
var elem = fs8[gracefulQueue].shift();
|
|
8426
8426
|
var fn = elem[0];
|
|
8427
8427
|
var args = elem[1];
|
|
8428
8428
|
var err = elem[2];
|
|
@@ -8444,7 +8444,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8444
8444
|
debug("RETRY", fn.name, args);
|
|
8445
8445
|
fn.apply(null, args.concat([startTime]));
|
|
8446
8446
|
} else {
|
|
8447
|
-
|
|
8447
|
+
fs8[gracefulQueue].push(elem);
|
|
8448
8448
|
}
|
|
8449
8449
|
}
|
|
8450
8450
|
if (retryTimer === void 0) {
|
|
@@ -8879,10 +8879,10 @@ var require_mtime_precision = __commonJS({
|
|
|
8879
8879
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) {
|
|
8880
8880
|
"use strict";
|
|
8881
8881
|
var cacheSymbol = Symbol();
|
|
8882
|
-
function probe(file2,
|
|
8883
|
-
const cachedPrecision =
|
|
8882
|
+
function probe(file2, fs8, callback) {
|
|
8883
|
+
const cachedPrecision = fs8[cacheSymbol];
|
|
8884
8884
|
if (cachedPrecision) {
|
|
8885
|
-
return
|
|
8885
|
+
return fs8.stat(file2, (err, stat2) => {
|
|
8886
8886
|
if (err) {
|
|
8887
8887
|
return callback(err);
|
|
8888
8888
|
}
|
|
@@ -8890,16 +8890,16 @@ var require_mtime_precision = __commonJS({
|
|
|
8890
8890
|
});
|
|
8891
8891
|
}
|
|
8892
8892
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
8893
|
-
|
|
8893
|
+
fs8.utimes(file2, mtime, mtime, (err) => {
|
|
8894
8894
|
if (err) {
|
|
8895
8895
|
return callback(err);
|
|
8896
8896
|
}
|
|
8897
|
-
|
|
8897
|
+
fs8.stat(file2, (err2, stat2) => {
|
|
8898
8898
|
if (err2) {
|
|
8899
8899
|
return callback(err2);
|
|
8900
8900
|
}
|
|
8901
8901
|
const precision = stat2.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
8902
|
-
Object.defineProperty(
|
|
8902
|
+
Object.defineProperty(fs8, cacheSymbol, { value: precision });
|
|
8903
8903
|
callback(null, stat2.mtime, precision);
|
|
8904
8904
|
});
|
|
8905
8905
|
});
|
|
@@ -8920,8 +8920,8 @@ var require_mtime_precision = __commonJS({
|
|
|
8920
8920
|
var require_lockfile = __commonJS({
|
|
8921
8921
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
|
|
8922
8922
|
"use strict";
|
|
8923
|
-
var
|
|
8924
|
-
var
|
|
8923
|
+
var path18 = require("path");
|
|
8924
|
+
var fs8 = require_graceful_fs();
|
|
8925
8925
|
var retry = require_retry2();
|
|
8926
8926
|
var onExit = require_signal_exit();
|
|
8927
8927
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -8931,7 +8931,7 @@ var require_lockfile = __commonJS({
|
|
|
8931
8931
|
}
|
|
8932
8932
|
function resolveCanonicalPath(file2, options, callback) {
|
|
8933
8933
|
if (!options.realpath) {
|
|
8934
|
-
return callback(null,
|
|
8934
|
+
return callback(null, path18.resolve(file2));
|
|
8935
8935
|
}
|
|
8936
8936
|
options.fs.realpath(file2, callback);
|
|
8937
8937
|
}
|
|
@@ -9052,7 +9052,7 @@ var require_lockfile = __commonJS({
|
|
|
9052
9052
|
update: null,
|
|
9053
9053
|
realpath: true,
|
|
9054
9054
|
retries: 0,
|
|
9055
|
-
fs:
|
|
9055
|
+
fs: fs8,
|
|
9056
9056
|
onCompromised: (err) => {
|
|
9057
9057
|
throw err;
|
|
9058
9058
|
},
|
|
@@ -9096,7 +9096,7 @@ var require_lockfile = __commonJS({
|
|
|
9096
9096
|
}
|
|
9097
9097
|
function unlock(file2, options, callback) {
|
|
9098
9098
|
options = {
|
|
9099
|
-
fs:
|
|
9099
|
+
fs: fs8,
|
|
9100
9100
|
realpath: true,
|
|
9101
9101
|
...options
|
|
9102
9102
|
};
|
|
@@ -9118,7 +9118,7 @@ var require_lockfile = __commonJS({
|
|
|
9118
9118
|
options = {
|
|
9119
9119
|
stale: 1e4,
|
|
9120
9120
|
realpath: true,
|
|
9121
|
-
fs:
|
|
9121
|
+
fs: fs8,
|
|
9122
9122
|
...options
|
|
9123
9123
|
};
|
|
9124
9124
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -9157,16 +9157,16 @@ var require_lockfile = __commonJS({
|
|
|
9157
9157
|
var require_adapter = __commonJS({
|
|
9158
9158
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) {
|
|
9159
9159
|
"use strict";
|
|
9160
|
-
var
|
|
9161
|
-
function createSyncFs(
|
|
9160
|
+
var fs8 = require_graceful_fs();
|
|
9161
|
+
function createSyncFs(fs9) {
|
|
9162
9162
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
9163
|
-
const newFs = { ...
|
|
9163
|
+
const newFs = { ...fs9 };
|
|
9164
9164
|
methods.forEach((method) => {
|
|
9165
9165
|
newFs[method] = (...args) => {
|
|
9166
9166
|
const callback = args.pop();
|
|
9167
9167
|
let ret;
|
|
9168
9168
|
try {
|
|
9169
|
-
ret =
|
|
9169
|
+
ret = fs9[`${method}Sync`](...args);
|
|
9170
9170
|
} catch (err) {
|
|
9171
9171
|
return callback(err);
|
|
9172
9172
|
}
|
|
@@ -9204,7 +9204,7 @@ var require_adapter = __commonJS({
|
|
|
9204
9204
|
}
|
|
9205
9205
|
function toSyncOptions(options) {
|
|
9206
9206
|
options = { ...options };
|
|
9207
|
-
options.fs = createSyncFs(options.fs ||
|
|
9207
|
+
options.fs = createSyncFs(options.fs || fs8);
|
|
9208
9208
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
9209
9209
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
9210
9210
|
}
|
|
@@ -10795,10 +10795,10 @@ var require_segments = __commonJS({
|
|
|
10795
10795
|
const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
|
|
10796
10796
|
const nodes = buildNodes(segs);
|
|
10797
10797
|
const graph = buildGraph(nodes, version2);
|
|
10798
|
-
const
|
|
10798
|
+
const path18 = dijkstra.find_path(graph.map, "start", "end");
|
|
10799
10799
|
const optimizedSegs = [];
|
|
10800
|
-
for (let i = 1; i <
|
|
10801
|
-
optimizedSegs.push(graph.table[
|
|
10800
|
+
for (let i = 1; i < path18.length - 1; i++) {
|
|
10801
|
+
optimizedSegs.push(graph.table[path18[i]].node);
|
|
10802
10802
|
}
|
|
10803
10803
|
return exports2.fromArray(mergeSegments(optimizedSegs));
|
|
10804
10804
|
};
|
|
@@ -13234,7 +13234,7 @@ var require_utils2 = __commonJS({
|
|
|
13234
13234
|
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js
|
|
13235
13235
|
var require_png2 = __commonJS({
|
|
13236
13236
|
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/png.js"(exports2) {
|
|
13237
|
-
var
|
|
13237
|
+
var fs8 = require("fs");
|
|
13238
13238
|
var PNG = require_png().PNG;
|
|
13239
13239
|
var Utils = require_utils2();
|
|
13240
13240
|
exports2.render = function render(qrData, options) {
|
|
@@ -13275,7 +13275,7 @@ var require_png2 = __commonJS({
|
|
|
13275
13275
|
});
|
|
13276
13276
|
png.pack();
|
|
13277
13277
|
};
|
|
13278
|
-
exports2.renderToFile = function renderToFile(
|
|
13278
|
+
exports2.renderToFile = function renderToFile(path18, qrData, options, cb) {
|
|
13279
13279
|
if (typeof cb === "undefined") {
|
|
13280
13280
|
cb = options;
|
|
13281
13281
|
options = void 0;
|
|
@@ -13286,7 +13286,7 @@ var require_png2 = __commonJS({
|
|
|
13286
13286
|
called = true;
|
|
13287
13287
|
cb.apply(null, args);
|
|
13288
13288
|
};
|
|
13289
|
-
const stream =
|
|
13289
|
+
const stream = fs8.createWriteStream(path18);
|
|
13290
13290
|
stream.on("error", done);
|
|
13291
13291
|
stream.on("close", done);
|
|
13292
13292
|
exports2.renderToFileStream(stream, qrData, options);
|
|
@@ -13348,14 +13348,14 @@ var require_utf8 = __commonJS({
|
|
|
13348
13348
|
}
|
|
13349
13349
|
return output3;
|
|
13350
13350
|
};
|
|
13351
|
-
exports2.renderToFile = function renderToFile(
|
|
13351
|
+
exports2.renderToFile = function renderToFile(path18, qrData, options, cb) {
|
|
13352
13352
|
if (typeof cb === "undefined") {
|
|
13353
13353
|
cb = options;
|
|
13354
13354
|
options = void 0;
|
|
13355
13355
|
}
|
|
13356
|
-
const
|
|
13356
|
+
const fs8 = require("fs");
|
|
13357
13357
|
const utf8 = exports2.render(qrData, options);
|
|
13358
|
-
|
|
13358
|
+
fs8.writeFile(path18, utf8, cb);
|
|
13359
13359
|
};
|
|
13360
13360
|
}
|
|
13361
13361
|
});
|
|
@@ -13476,7 +13476,7 @@ var require_svg_tag = __commonJS({
|
|
|
13476
13476
|
return str;
|
|
13477
13477
|
}
|
|
13478
13478
|
function qrToPath(data, size, margin) {
|
|
13479
|
-
let
|
|
13479
|
+
let path18 = "";
|
|
13480
13480
|
let moveBy = 0;
|
|
13481
13481
|
let newRow = false;
|
|
13482
13482
|
let lineLength = 0;
|
|
@@ -13487,19 +13487,19 @@ var require_svg_tag = __commonJS({
|
|
|
13487
13487
|
if (data[i]) {
|
|
13488
13488
|
lineLength++;
|
|
13489
13489
|
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
13490
|
-
|
|
13490
|
+
path18 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
|
|
13491
13491
|
moveBy = 0;
|
|
13492
13492
|
newRow = false;
|
|
13493
13493
|
}
|
|
13494
13494
|
if (!(col + 1 < size && data[i + 1])) {
|
|
13495
|
-
|
|
13495
|
+
path18 += svgCmd("h", lineLength);
|
|
13496
13496
|
lineLength = 0;
|
|
13497
13497
|
}
|
|
13498
13498
|
} else {
|
|
13499
13499
|
moveBy++;
|
|
13500
13500
|
}
|
|
13501
13501
|
}
|
|
13502
|
-
return
|
|
13502
|
+
return path18;
|
|
13503
13503
|
}
|
|
13504
13504
|
exports2.render = function render(qrData, options, cb) {
|
|
13505
13505
|
const opts = Utils.getOptions(options);
|
|
@@ -13507,10 +13507,10 @@ var require_svg_tag = __commonJS({
|
|
|
13507
13507
|
const data = qrData.modules.data;
|
|
13508
13508
|
const qrcodesize = size + opts.margin * 2;
|
|
13509
13509
|
const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
|
|
13510
|
-
const
|
|
13510
|
+
const path18 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
|
|
13511
13511
|
const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
|
|
13512
13512
|
const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
|
|
13513
|
-
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg +
|
|
13513
|
+
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path18 + "</svg>\n";
|
|
13514
13514
|
if (typeof cb === "function") {
|
|
13515
13515
|
cb(null, svgTag);
|
|
13516
13516
|
}
|
|
@@ -13524,15 +13524,15 @@ var require_svg = __commonJS({
|
|
|
13524
13524
|
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
|
|
13525
13525
|
var svgTagRenderer = require_svg_tag();
|
|
13526
13526
|
exports2.render = svgTagRenderer.render;
|
|
13527
|
-
exports2.renderToFile = function renderToFile(
|
|
13527
|
+
exports2.renderToFile = function renderToFile(path18, qrData, options, cb) {
|
|
13528
13528
|
if (typeof cb === "undefined") {
|
|
13529
13529
|
cb = options;
|
|
13530
13530
|
options = void 0;
|
|
13531
13531
|
}
|
|
13532
|
-
const
|
|
13532
|
+
const fs8 = require("fs");
|
|
13533
13533
|
const svgTag = exports2.render(qrData, options);
|
|
13534
13534
|
const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
|
|
13535
|
-
|
|
13535
|
+
fs8.writeFile(path18, xmlStr, cb);
|
|
13536
13536
|
};
|
|
13537
13537
|
}
|
|
13538
13538
|
});
|
|
@@ -13690,8 +13690,8 @@ var require_server = __commonJS({
|
|
|
13690
13690
|
cb
|
|
13691
13691
|
};
|
|
13692
13692
|
}
|
|
13693
|
-
function getTypeFromFilename(
|
|
13694
|
-
return
|
|
13693
|
+
function getTypeFromFilename(path18) {
|
|
13694
|
+
return path18.slice((path18.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
|
|
13695
13695
|
}
|
|
13696
13696
|
function getRendererFromType(type) {
|
|
13697
13697
|
switch (type) {
|
|
@@ -13755,17 +13755,17 @@ var require_server = __commonJS({
|
|
|
13755
13755
|
const renderer = getRendererFromType(params.opts.type);
|
|
13756
13756
|
return render(renderer.renderToBuffer, text, params);
|
|
13757
13757
|
};
|
|
13758
|
-
exports2.toFile = function toFile(
|
|
13759
|
-
if (typeof
|
|
13758
|
+
exports2.toFile = function toFile(path18, text, opts, cb) {
|
|
13759
|
+
if (typeof path18 !== "string" || !(typeof text === "string" || typeof text === "object")) {
|
|
13760
13760
|
throw new Error("Invalid argument");
|
|
13761
13761
|
}
|
|
13762
13762
|
if (arguments.length < 3 && !canPromise()) {
|
|
13763
13763
|
throw new Error("Too few arguments provided");
|
|
13764
13764
|
}
|
|
13765
13765
|
const params = checkParams(text, opts, cb);
|
|
13766
|
-
const type = params.opts.type || getTypeFromFilename(
|
|
13766
|
+
const type = params.opts.type || getTypeFromFilename(path18);
|
|
13767
13767
|
const renderer = getRendererFromType(type);
|
|
13768
|
-
const renderToFile = renderer.renderToFile.bind(null,
|
|
13768
|
+
const renderToFile = renderer.renderToFile.bind(null, path18);
|
|
13769
13769
|
return render(renderToFile, text, params);
|
|
13770
13770
|
};
|
|
13771
13771
|
exports2.toFileStream = function toFileStream(stream, text, opts) {
|
|
@@ -16983,8 +16983,8 @@ var require_utils3 = __commonJS({
|
|
|
16983
16983
|
}
|
|
16984
16984
|
return ind;
|
|
16985
16985
|
}
|
|
16986
|
-
function removeDotSegments(
|
|
16987
|
-
let input =
|
|
16986
|
+
function removeDotSegments(path18) {
|
|
16987
|
+
let input = path18;
|
|
16988
16988
|
const output3 = [];
|
|
16989
16989
|
let nextSlash = -1;
|
|
16990
16990
|
let len = 0;
|
|
@@ -17236,8 +17236,8 @@ var require_schemes = __commonJS({
|
|
|
17236
17236
|
wsComponent.secure = void 0;
|
|
17237
17237
|
}
|
|
17238
17238
|
if (wsComponent.resourceName) {
|
|
17239
|
-
const [
|
|
17240
|
-
wsComponent.path =
|
|
17239
|
+
const [path18, query] = wsComponent.resourceName.split("?");
|
|
17240
|
+
wsComponent.path = path18 && path18 !== "/" ? path18 : void 0;
|
|
17241
17241
|
wsComponent.query = query;
|
|
17242
17242
|
wsComponent.resourceName = void 0;
|
|
17243
17243
|
}
|
|
@@ -20630,12 +20630,12 @@ var require_dist = __commonJS({
|
|
|
20630
20630
|
throw new Error(`Unknown format "${name}"`);
|
|
20631
20631
|
return f;
|
|
20632
20632
|
};
|
|
20633
|
-
function addFormats(ajv, list,
|
|
20633
|
+
function addFormats(ajv, list, fs8, exportName) {
|
|
20634
20634
|
var _a3;
|
|
20635
20635
|
var _b;
|
|
20636
20636
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
20637
20637
|
for (const f of list)
|
|
20638
|
-
ajv.addFormat(f,
|
|
20638
|
+
ajv.addFormat(f, fs8[f]);
|
|
20639
20639
|
}
|
|
20640
20640
|
module2.exports = exports2 = formatsPlugin;
|
|
20641
20641
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -20644,11 +20644,11 @@ var require_dist = __commonJS({
|
|
|
20644
20644
|
});
|
|
20645
20645
|
|
|
20646
20646
|
// src/bin.ts
|
|
20647
|
-
var
|
|
20647
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
20648
20648
|
var import_node_child_process13 = require("node:child_process");
|
|
20649
|
-
var
|
|
20650
|
-
var
|
|
20651
|
-
var
|
|
20649
|
+
var import_node_fs15 = require("node:fs");
|
|
20650
|
+
var import_node_os12 = require("node:os");
|
|
20651
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
20652
20652
|
|
|
20653
20653
|
// src/install-codex.ts
|
|
20654
20654
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
@@ -20656,6 +20656,109 @@ var import_node_os2 = __toESM(require("node:os"), 1);
|
|
|
20656
20656
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
20657
20657
|
var toml = __toESM(require_toml(), 1);
|
|
20658
20658
|
|
|
20659
|
+
// src/api-base-url.ts
|
|
20660
|
+
var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
|
|
20661
|
+
var STAGING_API_BASE_URL = "https://mrrlin-api-mrrlin2.vercel.app";
|
|
20662
|
+
function normalizeUrl(value) {
|
|
20663
|
+
return value.replace(/\/$/, "");
|
|
20664
|
+
}
|
|
20665
|
+
var RETIRED_API_BASE_URLS = {
|
|
20666
|
+
// Retired 2026-07-28 when staging moved to the mrrlin2 Vercel team; serves a decommissioned
|
|
20667
|
+
// Supabase project and now answers `GET /health` with 402 DEPLOYMENT_DISABLED. Added in 0.3.50.
|
|
20668
|
+
"mrrlin-api-fnnzzz-fnnzzzs-projects.vercel.app": STAGING_API_BASE_URL
|
|
20669
|
+
};
|
|
20670
|
+
function isSameApiHost(a, b) {
|
|
20671
|
+
const origin = (value) => {
|
|
20672
|
+
try {
|
|
20673
|
+
const url2 = new URL(value.trim());
|
|
20674
|
+
return `${url2.protocol}//${url2.hostname.toLowerCase()}${url2.port ? `:${url2.port}` : ""}`;
|
|
20675
|
+
} catch {
|
|
20676
|
+
return null;
|
|
20677
|
+
}
|
|
20678
|
+
};
|
|
20679
|
+
const originA = origin(a);
|
|
20680
|
+
return originA !== null && originA === origin(b);
|
|
20681
|
+
}
|
|
20682
|
+
function isStagingApiBaseUrl(input) {
|
|
20683
|
+
return isSameApiHost(input, STAGING_API_BASE_URL);
|
|
20684
|
+
}
|
|
20685
|
+
function retargetRetiredApiBaseUrl(input) {
|
|
20686
|
+
const normalized = normalizeUrl(input.trim());
|
|
20687
|
+
let hostname3;
|
|
20688
|
+
try {
|
|
20689
|
+
hostname3 = new URL(normalized).hostname.toLowerCase();
|
|
20690
|
+
} catch {
|
|
20691
|
+
return { baseUrl: normalized, retargeted: false };
|
|
20692
|
+
}
|
|
20693
|
+
const successor = RETIRED_API_BASE_URLS[hostname3];
|
|
20694
|
+
if (!successor) return { baseUrl: normalized, retargeted: false };
|
|
20695
|
+
return { baseUrl: successor, retargeted: true };
|
|
20696
|
+
}
|
|
20697
|
+
function retiredApiHostnames() {
|
|
20698
|
+
return Object.keys(RETIRED_API_BASE_URLS);
|
|
20699
|
+
}
|
|
20700
|
+
function isLoopbackUrl(input) {
|
|
20701
|
+
try {
|
|
20702
|
+
const url2 = new URL(input);
|
|
20703
|
+
if (url2.protocol !== "http:" && url2.protocol !== "https:") return false;
|
|
20704
|
+
const loopbackHosts = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]", "::1"]);
|
|
20705
|
+
return loopbackHosts.has(url2.hostname);
|
|
20706
|
+
} catch {
|
|
20707
|
+
return false;
|
|
20708
|
+
}
|
|
20709
|
+
}
|
|
20710
|
+
function readConfiguredApiBaseUrl(explicit) {
|
|
20711
|
+
const direct = explicit ?? process.env.MRRLIN_API_BASE_URL;
|
|
20712
|
+
if (direct?.trim()) return retargetRetiredApiBaseUrl(direct.trim()).baseUrl;
|
|
20713
|
+
if (process.env.MRRLIN_STAGING === "1") return STAGING_API_BASE_URL;
|
|
20714
|
+
return DEFAULT_API_BASE_URL;
|
|
20715
|
+
}
|
|
20716
|
+
function isRemoteApiAllowed(apiBaseUrl) {
|
|
20717
|
+
return isLoopbackUrl(apiBaseUrl) || isStagingApiBaseUrl(apiBaseUrl) || process.env.MRRLIN_API_ALLOW_REMOTE === "1" || process.env.MRRLIN_STAGING === "1";
|
|
20718
|
+
}
|
|
20719
|
+
function readProbeTimeoutMs(env) {
|
|
20720
|
+
const raw = Number((env.MRRLIN_API_PROBE_TIMEOUT_MS ?? "").trim());
|
|
20721
|
+
return Number.isFinite(raw) && raw > 0 ? raw : 500;
|
|
20722
|
+
}
|
|
20723
|
+
async function probeApiHealth(baseUrl, opts = {}) {
|
|
20724
|
+
return probeLocalHealth(baseUrl, opts.timeoutMs ?? 2e3, opts.fetchImpl ?? fetch);
|
|
20725
|
+
}
|
|
20726
|
+
async function probeLocalHealth(baseUrl, timeoutMs, fetchImpl) {
|
|
20727
|
+
const controller = new AbortController();
|
|
20728
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
20729
|
+
try {
|
|
20730
|
+
const res = await fetchImpl(`${baseUrl}/health`, { signal: controller.signal });
|
|
20731
|
+
return res.ok;
|
|
20732
|
+
} catch {
|
|
20733
|
+
return false;
|
|
20734
|
+
} finally {
|
|
20735
|
+
clearTimeout(timer);
|
|
20736
|
+
}
|
|
20737
|
+
}
|
|
20738
|
+
async function resolveApiBaseUrlDynamic(opts = {}) {
|
|
20739
|
+
const env = opts.env ?? process.env;
|
|
20740
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
20741
|
+
const direct = opts.explicit ?? env.MRRLIN_API_BASE_URL;
|
|
20742
|
+
if (direct?.trim()) {
|
|
20743
|
+
const { baseUrl, retargeted } = retargetRetiredApiBaseUrl(direct.trim());
|
|
20744
|
+
return { baseUrl, source: retargeted ? "retired-retarget" : "explicit" };
|
|
20745
|
+
}
|
|
20746
|
+
if ((env.MRRLIN_STAGING ?? "").trim() === "1") return { baseUrl: STAGING_API_BASE_URL, source: "staging-env" };
|
|
20747
|
+
const timeoutMs = opts.probeTimeoutMs ?? readProbeTimeoutMs(env);
|
|
20748
|
+
if (await probeLocalHealth(DEFAULT_API_BASE_URL, timeoutMs, fetchImpl)) {
|
|
20749
|
+
return { baseUrl: DEFAULT_API_BASE_URL, source: "local-probe" };
|
|
20750
|
+
}
|
|
20751
|
+
if ((env.MRRLIN_API_AUTODETECT ?? "").trim() === "1") {
|
|
20752
|
+
if (await probeLocalHealth(DEFAULT_API_BASE_URL, timeoutMs, fetchImpl)) {
|
|
20753
|
+
return { baseUrl: DEFAULT_API_BASE_URL, source: "local-probe" };
|
|
20754
|
+
}
|
|
20755
|
+
return { baseUrl: STAGING_API_BASE_URL, source: "staging-autodetect" };
|
|
20756
|
+
}
|
|
20757
|
+
throw new Error(
|
|
20758
|
+
`Local Mrrlin API not reachable at ${DEFAULT_API_BASE_URL}. Start it, or set MRRLIN_STAGING=1 to target staging (or MRRLIN_API_AUTODETECT=1 to auto-fall back to staging when local is down).`
|
|
20759
|
+
);
|
|
20760
|
+
}
|
|
20761
|
+
|
|
20659
20762
|
// src/browser-runtime.ts
|
|
20660
20763
|
var import_node_os = __toESM(require("node:os"), 1);
|
|
20661
20764
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
@@ -20739,11 +20842,12 @@ async function installBrowser(opts = {}) {
|
|
|
20739
20842
|
// src/install-codex.ts
|
|
20740
20843
|
function deriveServeEnvFromProcessEnv(env) {
|
|
20741
20844
|
const out = {};
|
|
20742
|
-
const
|
|
20743
|
-
|
|
20845
|
+
const rawApiUrl = env.MRRLIN_API_BASE_URL?.trim();
|
|
20846
|
+
const apiUrl = rawApiUrl ? retargetRetiredApiBaseUrl(rawApiUrl).baseUrl : void 0;
|
|
20847
|
+
if (apiUrl && !isStagingApiBaseUrl(apiUrl)) {
|
|
20744
20848
|
out.MRRLIN_API_BASE_URL = apiUrl;
|
|
20745
20849
|
if (env.MRRLIN_API_ALLOW_REMOTE === "1") out.MRRLIN_API_ALLOW_REMOTE = "1";
|
|
20746
|
-
} else if (env.MRRLIN_STAGING === "1") {
|
|
20850
|
+
} else if (apiUrl || env.MRRLIN_STAGING === "1") {
|
|
20747
20851
|
out.MRRLIN_STAGING = "1";
|
|
20748
20852
|
}
|
|
20749
20853
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
@@ -20886,6 +20990,20 @@ function classifyExistingBlock(actual, expected) {
|
|
|
20886
20990
|
if (!isCoherentMrrlinEnv(env)) return "conflict";
|
|
20887
20991
|
return "preserve-env-noop";
|
|
20888
20992
|
}
|
|
20993
|
+
function blockEnvHasRetiredApiUrl(actual) {
|
|
20994
|
+
if (typeof actual !== "object" || actual === null) return false;
|
|
20995
|
+
const env = actual.env;
|
|
20996
|
+
if (typeof env !== "object" || env === null) return false;
|
|
20997
|
+
const pinned = env.MRRLIN_API_BASE_URL;
|
|
20998
|
+
if (typeof pinned !== "string" || !pinned.trim()) return false;
|
|
20999
|
+
let hostname3;
|
|
21000
|
+
try {
|
|
21001
|
+
hostname3 = new URL(pinned.trim()).hostname.toLowerCase();
|
|
21002
|
+
} catch {
|
|
21003
|
+
return false;
|
|
21004
|
+
}
|
|
21005
|
+
return retiredApiHostnames().includes(hostname3);
|
|
21006
|
+
}
|
|
20889
21007
|
function renderEnvPreservedNotice(blockId, envKeys) {
|
|
20890
21008
|
const keys = [...envKeys].sort().join(", ");
|
|
20891
21009
|
return `[mrrlin-mcp install-codex] kept your existing [mcp_servers.${blockId}] env keys (${keys}) so your API target is preserved. Re-run with --force to replace or remove it.`;
|
|
@@ -20939,6 +21057,21 @@ async function installCodex(options) {
|
|
|
20939
21057
|
if (existingTable !== void 0) {
|
|
20940
21058
|
const classification = classifyExistingBlock(existingTable, block.expected);
|
|
20941
21059
|
if (classification === "equal") continue;
|
|
21060
|
+
if (blockEnvHasRetiredApiUrl(existingTable)) {
|
|
21061
|
+
const existingEnv = existingTable.env ?? {};
|
|
21062
|
+
const healedEnv = {};
|
|
21063
|
+
for (const [key, value] of Object.entries(existingEnv)) {
|
|
21064
|
+
if (key === "MRRLIN_API_BASE_URL") continue;
|
|
21065
|
+
if (typeof value === "string") healedEnv[key] = value;
|
|
21066
|
+
}
|
|
21067
|
+
healedEnv.MRRLIN_STAGING = "1";
|
|
21068
|
+
delete healedEnv.MRRLIN_API_ALLOW_REMOTE;
|
|
21069
|
+
const healed = { ...block, expected: { ...block.expected, env: healedEnv } };
|
|
21070
|
+
content = replaceBlock(content, block.blockRe, renderBlock(healed));
|
|
21071
|
+
action = "replaced";
|
|
21072
|
+
mutated = true;
|
|
21073
|
+
continue;
|
|
21074
|
+
}
|
|
20942
21075
|
if (classification === "preserve-env-noop") {
|
|
20943
21076
|
const env = existingTable.env ?? {};
|
|
20944
21077
|
preservedEnvBlocks.push({ blockId: block.id, envKeys: Object.keys(env).sort() });
|
|
@@ -21020,10 +21153,10 @@ ${block}`;
|
|
|
21020
21153
|
}
|
|
21021
21154
|
|
|
21022
21155
|
// src/director-bridge.ts
|
|
21023
|
-
var
|
|
21156
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
21024
21157
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
21025
|
-
var
|
|
21026
|
-
var
|
|
21158
|
+
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
21159
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
21027
21160
|
var import_node_child_process10 = require("node:child_process");
|
|
21028
21161
|
var import_node_crypto7 = __toESM(require("node:crypto"), 1);
|
|
21029
21162
|
|
|
@@ -22580,10 +22713,10 @@ function mergeDefs(...defs) {
|
|
|
22580
22713
|
function cloneDef(schema) {
|
|
22581
22714
|
return mergeDefs(schema._zod.def);
|
|
22582
22715
|
}
|
|
22583
|
-
function getElementAtPath(obj,
|
|
22584
|
-
if (!
|
|
22716
|
+
function getElementAtPath(obj, path18) {
|
|
22717
|
+
if (!path18)
|
|
22585
22718
|
return obj;
|
|
22586
|
-
return
|
|
22719
|
+
return path18.reduce((acc, key) => acc?.[key], obj);
|
|
22587
22720
|
}
|
|
22588
22721
|
function promiseAllObject(promisesObj) {
|
|
22589
22722
|
const keys = Object.keys(promisesObj);
|
|
@@ -22992,11 +23125,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
22992
23125
|
}
|
|
22993
23126
|
return false;
|
|
22994
23127
|
}
|
|
22995
|
-
function prefixIssues(
|
|
23128
|
+
function prefixIssues(path18, issues) {
|
|
22996
23129
|
return issues.map((iss) => {
|
|
22997
23130
|
var _a3;
|
|
22998
23131
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
22999
|
-
iss.path.unshift(
|
|
23132
|
+
iss.path.unshift(path18);
|
|
23000
23133
|
return iss;
|
|
23001
23134
|
});
|
|
23002
23135
|
}
|
|
@@ -23143,16 +23276,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23143
23276
|
}
|
|
23144
23277
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
23145
23278
|
const fieldErrors = { _errors: [] };
|
|
23146
|
-
const processError = (error52,
|
|
23279
|
+
const processError = (error52, path18 = []) => {
|
|
23147
23280
|
for (const issue2 of error52.issues) {
|
|
23148
23281
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23149
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23282
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
23150
23283
|
} else if (issue2.code === "invalid_key") {
|
|
23151
|
-
processError({ issues: issue2.issues }, [...
|
|
23284
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
23152
23285
|
} else if (issue2.code === "invalid_element") {
|
|
23153
|
-
processError({ issues: issue2.issues }, [...
|
|
23286
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
23154
23287
|
} else {
|
|
23155
|
-
const fullpath = [...
|
|
23288
|
+
const fullpath = [...path18, ...issue2.path];
|
|
23156
23289
|
if (fullpath.length === 0) {
|
|
23157
23290
|
fieldErrors._errors.push(mapper(issue2));
|
|
23158
23291
|
} else {
|
|
@@ -23179,17 +23312,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23179
23312
|
}
|
|
23180
23313
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
23181
23314
|
const result = { errors: [] };
|
|
23182
|
-
const processError = (error52,
|
|
23315
|
+
const processError = (error52, path18 = []) => {
|
|
23183
23316
|
var _a3, _b;
|
|
23184
23317
|
for (const issue2 of error52.issues) {
|
|
23185
23318
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23186
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23319
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
23187
23320
|
} else if (issue2.code === "invalid_key") {
|
|
23188
|
-
processError({ issues: issue2.issues }, [...
|
|
23321
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
23189
23322
|
} else if (issue2.code === "invalid_element") {
|
|
23190
|
-
processError({ issues: issue2.issues }, [...
|
|
23323
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
23191
23324
|
} else {
|
|
23192
|
-
const fullpath = [...
|
|
23325
|
+
const fullpath = [...path18, ...issue2.path];
|
|
23193
23326
|
if (fullpath.length === 0) {
|
|
23194
23327
|
result.errors.push(mapper(issue2));
|
|
23195
23328
|
continue;
|
|
@@ -23221,8 +23354,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23221
23354
|
}
|
|
23222
23355
|
function toDotPath(_path) {
|
|
23223
23356
|
const segs = [];
|
|
23224
|
-
const
|
|
23225
|
-
for (const seg of
|
|
23357
|
+
const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
23358
|
+
for (const seg of path18) {
|
|
23226
23359
|
if (typeof seg === "number")
|
|
23227
23360
|
segs.push(`[${seg}]`);
|
|
23228
23361
|
else if (typeof seg === "symbol")
|
|
@@ -35914,13 +36047,13 @@ function resolveRef(ref, ctx) {
|
|
|
35914
36047
|
if (!ref.startsWith("#")) {
|
|
35915
36048
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
35916
36049
|
}
|
|
35917
|
-
const
|
|
35918
|
-
if (
|
|
36050
|
+
const path18 = ref.slice(1).split("/").filter(Boolean);
|
|
36051
|
+
if (path18.length === 0) {
|
|
35919
36052
|
return ctx.rootSchema;
|
|
35920
36053
|
}
|
|
35921
36054
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
35922
|
-
if (
|
|
35923
|
-
const key =
|
|
36055
|
+
if (path18[0] === defsKey) {
|
|
36056
|
+
const key = path18[1];
|
|
35924
36057
|
if (!key || !ctx.defs[key]) {
|
|
35925
36058
|
throw new Error(`Reference not found: ${ref}`);
|
|
35926
36059
|
}
|
|
@@ -36715,10 +36848,13 @@ var mrrlinDeliverablePayloadSchema = external_exports.object({
|
|
|
36715
36848
|
contentHash: external_exports.string().min(1),
|
|
36716
36849
|
format: external_exports.enum(["markdown"])
|
|
36717
36850
|
});
|
|
36718
|
-
var
|
|
36719
|
-
|
|
36720
|
-
|
|
36721
|
-
}
|
|
36851
|
+
var SUPPORTED_EXECUTION_POLICY_BY_DOMAIN = {
|
|
36852
|
+
code: { lane: "code", supported: true },
|
|
36853
|
+
seo: { lane: "low_risk_non_code", supported: true },
|
|
36854
|
+
marketing: { lane: "low_risk_non_code", supported: true },
|
|
36855
|
+
content: { lane: "low_risk_non_code", supported: true }
|
|
36856
|
+
};
|
|
36857
|
+
var SUPPORTED_EXECUTION_DOMAINS = Object.keys(SUPPORTED_EXECUTION_POLICY_BY_DOMAIN);
|
|
36722
36858
|
var taxonomyCategorySchema = external_exports.string().min(1).regex(/^[a-z][a-z0-9-]*$/);
|
|
36723
36859
|
var taxonomySubcategorySchema = external_exports.string().min(1).regex(/^[a-z][a-z0-9-]*$/);
|
|
36724
36860
|
var mrrlinTaskAssigneeSchema = external_exports.union([external_exports.string().regex(/^@/), external_exports.string().email()]).nullable();
|
|
@@ -37539,6 +37675,13 @@ var mrrlinAutonomousStepSchema = external_exports.enum([
|
|
|
37539
37675
|
"needs_human",
|
|
37540
37676
|
"enqueue_spec_draft",
|
|
37541
37677
|
"enqueue_consensus",
|
|
37678
|
+
// Server-side auto-promotion of spec_ready when consensus is disabled (owner-policy since
|
|
37679
|
+
// 2026-08-03, item 4 of docs/superpowers/specs/2026-08-02-remaining-scheduler-blocks-design.md).
|
|
37680
|
+
// Reported here because `/scheduler/pending` mirrors the decision engine's exact enum for the
|
|
37681
|
+
// /autopilot page — but the tick RE-DERIVES on the same cycle after the CAS write, so a
|
|
37682
|
+
// /scheduler/pending observer will typically only see this step during the tiny window between
|
|
37683
|
+
// the CAS and the re-derivation (or never, if the tick coalesces both into one write).
|
|
37684
|
+
"auto_mark_spec_ready",
|
|
37542
37685
|
"auto_approve_spec_and_run",
|
|
37543
37686
|
"create_execution_run"
|
|
37544
37687
|
]);
|
|
@@ -37554,8 +37697,7 @@ var mrrlinAutonomousStepReasonSchema = external_exports.enum([
|
|
|
37554
37697
|
"awaiting_clarification",
|
|
37555
37698
|
"consensus_blocked",
|
|
37556
37699
|
"consensus_disabled_spec_not_ready",
|
|
37557
|
-
"spec_approval_pending"
|
|
37558
|
-
"non_code_execution_unsupported"
|
|
37700
|
+
"spec_approval_pending"
|
|
37559
37701
|
]);
|
|
37560
37702
|
var mrrlinAutonomousStepVerdictSchema = external_exports.object({
|
|
37561
37703
|
step: mrrlinAutonomousStepSchema,
|
|
@@ -37913,18 +38055,18 @@ function createMrrlinClient(config2) {
|
|
|
37913
38055
|
const customFetch = config2.fetch ?? globalThis.fetch;
|
|
37914
38056
|
const baseUrl = config2.baseUrl.replace(/\/$/, "");
|
|
37915
38057
|
const token = config2.token;
|
|
37916
|
-
async function request(
|
|
38058
|
+
async function request(path18, init) {
|
|
37917
38059
|
const method = init?.method ?? "GET";
|
|
37918
38060
|
const headers = new Headers(init?.headers ?? {});
|
|
37919
38061
|
if (token && !headers.has("authorization")) {
|
|
37920
38062
|
headers.set("authorization", `Bearer ${token}`);
|
|
37921
38063
|
}
|
|
37922
|
-
const response = await customFetch(`${baseUrl}${
|
|
38064
|
+
const response = await customFetch(`${baseUrl}${path18}`, { ...init, headers });
|
|
37923
38065
|
if (!response.ok) {
|
|
37924
38066
|
const body = await response.text();
|
|
37925
38067
|
let code = `HTTP_${response.status}`;
|
|
37926
38068
|
let violations = null;
|
|
37927
|
-
let message = `Mrrlin API ${method} ${
|
|
38069
|
+
let message = `Mrrlin API ${method} ${path18} failed: ${response.status}`;
|
|
37928
38070
|
try {
|
|
37929
38071
|
const parsed = JSON.parse(body);
|
|
37930
38072
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -37944,7 +38086,7 @@ function createMrrlinClient(config2) {
|
|
|
37944
38086
|
throw new MrrlinApiError({
|
|
37945
38087
|
code,
|
|
37946
38088
|
method,
|
|
37947
|
-
path:
|
|
38089
|
+
path: path18,
|
|
37948
38090
|
responseBody: body,
|
|
37949
38091
|
status: response.status,
|
|
37950
38092
|
violations,
|
|
@@ -38199,7 +38341,7 @@ function createMrrlinClient(config2) {
|
|
|
38199
38341
|
return taskEventListResponseSchema.parse(body).data;
|
|
38200
38342
|
},
|
|
38201
38343
|
async listTasks(projectSlug, filters = {}) {
|
|
38202
|
-
const
|
|
38344
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
|
|
38203
38345
|
assignee: filters.assignee,
|
|
38204
38346
|
autonomyLevel: filters.autonomyLevel,
|
|
38205
38347
|
blockedBy: filters.blockedBy,
|
|
@@ -38211,7 +38353,7 @@ function createMrrlinClient(config2) {
|
|
|
38211
38353
|
subcategory: filters.subcategory,
|
|
38212
38354
|
type: filters.type
|
|
38213
38355
|
});
|
|
38214
|
-
const body = await request(
|
|
38356
|
+
const body = await request(path18);
|
|
38215
38357
|
return taskListResponseSchema.parse(body).data;
|
|
38216
38358
|
},
|
|
38217
38359
|
async listTaxonomy(projectSlug) {
|
|
@@ -38219,22 +38361,22 @@ function createMrrlinClient(config2) {
|
|
|
38219
38361
|
return taxonomyListResponseSchema.parse(body).data;
|
|
38220
38362
|
},
|
|
38221
38363
|
async listWikiPages(projectSlug, filters = {}) {
|
|
38222
|
-
const
|
|
38364
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
|
|
38223
38365
|
folder: filters.folder,
|
|
38224
38366
|
q: filters.q,
|
|
38225
38367
|
taskId: filters.taskId
|
|
38226
38368
|
});
|
|
38227
|
-
const body = await request(
|
|
38369
|
+
const body = await request(path18);
|
|
38228
38370
|
return wikiPageListResponseSchema.parse(body).data;
|
|
38229
38371
|
},
|
|
38230
38372
|
async searchWikiPages(projectSlug, query) {
|
|
38231
|
-
const
|
|
38373
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
|
|
38232
38374
|
folder: query.folder,
|
|
38233
38375
|
limit: query.limit === void 0 ? void 0 : String(query.limit),
|
|
38234
38376
|
pathPrefix: query.pathPrefix,
|
|
38235
38377
|
q: query.q
|
|
38236
38378
|
});
|
|
38237
|
-
const body = await request(
|
|
38379
|
+
const body = await request(path18);
|
|
38238
38380
|
return wikiPageSearchResponseSchema.parse(body).data;
|
|
38239
38381
|
},
|
|
38240
38382
|
async updatePlan(projectSlug, planId, patch) {
|
|
@@ -39117,68 +39259,405 @@ function startCodexProbe(deps = {}) {
|
|
|
39117
39259
|
}
|
|
39118
39260
|
|
|
39119
39261
|
// src/_generated/version.ts
|
|
39120
|
-
var PKG_VERSION = "0.3.
|
|
39262
|
+
var PKG_VERSION = "0.3.50";
|
|
39121
39263
|
|
|
39122
|
-
// src/api-base-url.ts
|
|
39123
|
-
var
|
|
39124
|
-
var
|
|
39125
|
-
|
|
39126
|
-
|
|
39264
|
+
// src/api-base-url-migrate.ts
|
|
39265
|
+
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
39266
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
39267
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
39268
|
+
|
|
39269
|
+
// src/service-paths.ts
|
|
39270
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
39271
|
+
function isWorktreePath(p) {
|
|
39272
|
+
const norm = import_node_path4.default.normalize(p).split(import_node_path4.default.sep).join("/");
|
|
39273
|
+
return norm.includes("/.claude/worktrees/");
|
|
39127
39274
|
}
|
|
39128
|
-
function
|
|
39275
|
+
function resolveServiceCwd(opts) {
|
|
39276
|
+
const chosen = (opts.explicit?.trim() || opts.cwd).trim();
|
|
39277
|
+
if (isWorktreePath(chosen)) {
|
|
39278
|
+
return {
|
|
39279
|
+
ok: false,
|
|
39280
|
+
reason: `Refusing to install a service rooted in a disposable worktree (${chosen}). Run install-service from the canonical repo root, or set MRRLIN_DIRECTOR_BRIDGE_CODEX_CWD to a stable path.`
|
|
39281
|
+
};
|
|
39282
|
+
}
|
|
39283
|
+
return { ok: true, cwd: chosen };
|
|
39284
|
+
}
|
|
39285
|
+
var BRIDGE_APP_NAME = "mrrlin-bridge";
|
|
39286
|
+
function renderEcosystemConfig(opts) {
|
|
39287
|
+
const env = {
|
|
39288
|
+
HOME: opts.home,
|
|
39289
|
+
PATH: opts.pathEnv,
|
|
39290
|
+
MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
|
|
39291
|
+
};
|
|
39292
|
+
if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
|
|
39293
|
+
const retargeted = opts.apiBaseUrl ? retargetRetiredApiBaseUrl(opts.apiBaseUrl).baseUrl : void 0;
|
|
39294
|
+
if (opts.staging || retargeted && isStagingApiBaseUrl(retargeted)) env.MRRLIN_STAGING = "1";
|
|
39295
|
+
else if (retargeted) env.MRRLIN_API_BASE_URL = retargeted;
|
|
39296
|
+
const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
|
|
39297
|
+
return `module.exports = {
|
|
39298
|
+
apps: [{
|
|
39299
|
+
name: ${JSON.stringify(BRIDGE_APP_NAME)},
|
|
39300
|
+
script: "mrrlin-mcp",
|
|
39301
|
+
args: "director-bridge",
|
|
39302
|
+
interpreter: "none",
|
|
39303
|
+
cwd: ${JSON.stringify(opts.cwd)},
|
|
39304
|
+
autorestart: true,
|
|
39305
|
+
max_restarts: 10,
|
|
39306
|
+
restart_delay: 3000,
|
|
39307
|
+
kill_timeout: 10000,
|
|
39308
|
+
env: {
|
|
39309
|
+
${envLines}
|
|
39310
|
+
},
|
|
39311
|
+
}],
|
|
39312
|
+
};
|
|
39313
|
+
`;
|
|
39314
|
+
}
|
|
39315
|
+
|
|
39316
|
+
// src/api-base-url-migrate.ts
|
|
39317
|
+
function defaultDeps(deps) {
|
|
39318
|
+
const home = deps.home ?? process.env.HOME ?? import_node_os3.default.homedir();
|
|
39319
|
+
return {
|
|
39320
|
+
home,
|
|
39321
|
+
codexHome: deps.codexHome ?? process.env.CODEX_HOME?.trim() ?? import_node_path5.default.join(home, ".codex"),
|
|
39322
|
+
readFile: deps.readFile ?? ((p) => import_node_fs2.default.readFileSync(p, "utf8")),
|
|
39323
|
+
// Temp-file + atomic rename so a concurrent `serve` and `director-bridge` startup can never
|
|
39324
|
+
// interleave partial writes into a config the next start has to parse. Note this normalizes the
|
|
39325
|
+
// file to 0o600 — deliberate, since both files can carry a credential-bearing URL.
|
|
39326
|
+
writeFile: deps.writeFile ?? ((p, c) => {
|
|
39327
|
+
const tmp = `${p}.tmp-${process.pid}`;
|
|
39328
|
+
import_node_fs2.default.writeFileSync(tmp, c, { mode: 384 });
|
|
39329
|
+
import_node_fs2.default.renameSync(tmp, p);
|
|
39330
|
+
}),
|
|
39331
|
+
exists: deps.exists ?? ((p) => import_node_fs2.default.existsSync(p)),
|
|
39332
|
+
log: deps.log ?? ((m) => process.stderr.write(`${m}
|
|
39333
|
+
`))
|
|
39334
|
+
};
|
|
39335
|
+
}
|
|
39336
|
+
function findRetiredHost(text) {
|
|
39337
|
+
return retiredApiHostnames().find((host) => text.toLowerCase().includes(host));
|
|
39338
|
+
}
|
|
39339
|
+
function isRetiredApiUrl(value) {
|
|
39340
|
+
if (!value?.trim()) return false;
|
|
39129
39341
|
try {
|
|
39130
|
-
|
|
39131
|
-
if (url2.protocol !== "http:" && url2.protocol !== "https:") return false;
|
|
39132
|
-
const loopbackHosts = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]", "::1"]);
|
|
39133
|
-
return loopbackHosts.has(url2.hostname);
|
|
39342
|
+
return retiredApiHostnames().includes(new URL(value.trim()).hostname.toLowerCase());
|
|
39134
39343
|
} catch {
|
|
39135
39344
|
return false;
|
|
39136
39345
|
}
|
|
39137
39346
|
}
|
|
39138
|
-
function
|
|
39139
|
-
const
|
|
39140
|
-
if (
|
|
39141
|
-
|
|
39142
|
-
|
|
39347
|
+
function backupOnce(file2, text, deps) {
|
|
39348
|
+
const bak = `${file2}.bak-retired-api-url`;
|
|
39349
|
+
if (!deps.exists(bak)) deps.writeFile(bak, text);
|
|
39350
|
+
}
|
|
39351
|
+
function migrateEcosystemConfig(deps = {}) {
|
|
39352
|
+
const d = defaultDeps(deps);
|
|
39353
|
+
const file2 = import_node_path5.default.join(d.home, ".mrrlin", "ecosystem.config.cjs");
|
|
39354
|
+
if (!d.exists(file2)) return { file: file2, status: "absent" };
|
|
39355
|
+
const text = d.readFile(file2);
|
|
39356
|
+
if (!findRetiredHost(text)) return { file: file2, status: "clean" };
|
|
39357
|
+
const fields = {
|
|
39358
|
+
cwd: /cwd:\s*"((?:[^"\\]|\\.)*)"/.exec(text)?.[1],
|
|
39359
|
+
home: /HOME:\s*"((?:[^"\\]|\\.)*)"/.exec(text)?.[1],
|
|
39360
|
+
pathEnv: /PATH:\s*"((?:[^"\\]|\\.)*)"/.exec(text)?.[1],
|
|
39361
|
+
codexHome: /CODEX_HOME:\s*"((?:[^"\\]|\\.)*)"/.exec(text)?.[1]
|
|
39362
|
+
};
|
|
39363
|
+
if (fields.cwd && fields.home && fields.pathEnv) {
|
|
39364
|
+
const retiredUrl = /MRRLIN_API_BASE_URL:\s*"((?:[^"\\]|\\.)*)"/.exec(text)?.[1];
|
|
39365
|
+
const legacyShape = retiredUrl && isRetiredApiUrl(retiredUrl) ? renderEcosystemConfigLegacy({
|
|
39366
|
+
cwd: fields.cwd,
|
|
39367
|
+
home: fields.home,
|
|
39368
|
+
pathEnv: fields.pathEnv,
|
|
39369
|
+
codexHome: fields.codexHome,
|
|
39370
|
+
apiBaseUrl: retiredUrl
|
|
39371
|
+
}) : void 0;
|
|
39372
|
+
if (legacyShape && legacyShape === text) {
|
|
39373
|
+
backupOnce(file2, text, d);
|
|
39374
|
+
d.writeFile(
|
|
39375
|
+
file2,
|
|
39376
|
+
renderEcosystemConfig({
|
|
39377
|
+
cwd: fields.cwd,
|
|
39378
|
+
home: fields.home,
|
|
39379
|
+
pathEnv: fields.pathEnv,
|
|
39380
|
+
codexHome: fields.codexHome,
|
|
39381
|
+
staging: true,
|
|
39382
|
+
apiBaseUrl: void 0
|
|
39383
|
+
})
|
|
39384
|
+
);
|
|
39385
|
+
return { file: file2, status: "migrated", detail: "regenerated from the canonical template" };
|
|
39386
|
+
}
|
|
39387
|
+
}
|
|
39388
|
+
const lineRe = /^[ \t]*MRRLIN_API_BASE_URL:\s*"((?:[^"\\]|\\.)*)",?[ \t]*\r?\n/gm;
|
|
39389
|
+
const matches = (text.match(lineRe) ?? []).filter((line) => !line.trimStart().startsWith("//"));
|
|
39390
|
+
const target = matches.length === 1 ? matches[0] : void 0;
|
|
39391
|
+
if (target !== void 0 && isRetiredApiUrl(/"((?:[^"\\]|\\.)*)"/.exec(target)?.[1])) {
|
|
39392
|
+
backupOnce(file2, text, d);
|
|
39393
|
+
const indent = /^[ \t]*/.exec(target)?.[0] ?? " ";
|
|
39394
|
+
d.writeFile(file2, text.replace(target, () => `${indent}MRRLIN_STAGING: "1",
|
|
39395
|
+
`));
|
|
39396
|
+
return { file: file2, status: "migrated", detail: "replaced the pinned URL line with MRRLIN_STAGING" };
|
|
39397
|
+
}
|
|
39398
|
+
return {
|
|
39399
|
+
file: file2,
|
|
39400
|
+
status: "skipped-drifted",
|
|
39401
|
+
detail: matches.length === 0 ? "a retired host appears in the file but no MRRLIN_API_BASE_URL line was found \u2014 fix it by hand or re-run install-service" : `found ${matches.length} MRRLIN_API_BASE_URL lines; refusing to guess \u2014 fix by hand or re-run install-service`
|
|
39402
|
+
};
|
|
39143
39403
|
}
|
|
39144
|
-
function
|
|
39145
|
-
return
|
|
39404
|
+
function renderEcosystemConfigLegacy(opts) {
|
|
39405
|
+
return renderEcosystemConfigWithEnv(opts, { MRRLIN_API_BASE_URL: opts.apiBaseUrl });
|
|
39146
39406
|
}
|
|
39147
|
-
function
|
|
39148
|
-
const
|
|
39149
|
-
|
|
39407
|
+
function renderEcosystemConfigWithEnv(opts, extra) {
|
|
39408
|
+
const env = {
|
|
39409
|
+
HOME: opts.home,
|
|
39410
|
+
PATH: opts.pathEnv,
|
|
39411
|
+
MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
|
|
39412
|
+
};
|
|
39413
|
+
if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
|
|
39414
|
+
Object.assign(env, extra);
|
|
39415
|
+
const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
|
|
39416
|
+
return `module.exports = {
|
|
39417
|
+
apps: [{
|
|
39418
|
+
name: "mrrlin-bridge",
|
|
39419
|
+
script: "mrrlin-mcp",
|
|
39420
|
+
args: "director-bridge",
|
|
39421
|
+
interpreter: "none",
|
|
39422
|
+
cwd: ${JSON.stringify(opts.cwd)},
|
|
39423
|
+
autorestart: true,
|
|
39424
|
+
max_restarts: 10,
|
|
39425
|
+
restart_delay: 3000,
|
|
39426
|
+
kill_timeout: 10000,
|
|
39427
|
+
env: {
|
|
39428
|
+
${envLines}
|
|
39429
|
+
},
|
|
39430
|
+
}],
|
|
39431
|
+
};
|
|
39432
|
+
`;
|
|
39150
39433
|
}
|
|
39151
|
-
|
|
39152
|
-
const
|
|
39153
|
-
const
|
|
39434
|
+
function migrateCodexConfig(deps = {}) {
|
|
39435
|
+
const d = defaultDeps(deps);
|
|
39436
|
+
const file2 = import_node_path5.default.join(d.codexHome, "config.toml");
|
|
39437
|
+
if (!d.exists(file2)) return { file: file2, status: "absent" };
|
|
39438
|
+
const text = d.readFile(file2);
|
|
39439
|
+
const host = findRetiredHost(text);
|
|
39440
|
+
if (!host) return { file: file2, status: "clean" };
|
|
39441
|
+
const managedBlockRe = /^\[mcp_servers\.mrrlin\][^\n]*\n(?:(?!\[)[^\n]*\n?)*/gm;
|
|
39442
|
+
const blocks = text.match(managedBlockRe) ?? [];
|
|
39443
|
+
if (blocks.length === 0) {
|
|
39444
|
+
return {
|
|
39445
|
+
file: file2,
|
|
39446
|
+
status: "skipped-drifted",
|
|
39447
|
+
detail: "a retired host appears in the file but no [mcp_servers.mrrlin] block was found \u2014 left untouched"
|
|
39448
|
+
};
|
|
39449
|
+
}
|
|
39450
|
+
const assignRe = /MRRLIN_API_BASE_URL\s*=\s*"([^"]*)"/g;
|
|
39451
|
+
let out = text;
|
|
39452
|
+
let changed = 0;
|
|
39453
|
+
for (const block of blocks) {
|
|
39454
|
+
let blockChanged = false;
|
|
39455
|
+
const healedBlock = block.split("\n").map((line) => {
|
|
39456
|
+
if (line.trimStart().startsWith("#")) return line;
|
|
39457
|
+
const healedLine = line.replace(
|
|
39458
|
+
assignRe,
|
|
39459
|
+
(match, url2) => isRetiredApiUrl(url2) ? `MRRLIN_STAGING = "1"` : match
|
|
39460
|
+
);
|
|
39461
|
+
if (healedLine !== line) blockChanged = true;
|
|
39462
|
+
return healedLine;
|
|
39463
|
+
}).join("\n");
|
|
39464
|
+
if (!blockChanged) continue;
|
|
39465
|
+
const deduped = healedBlock.replace(/MRRLIN_STAGING = "1"\s*,\s*MRRLIN_STAGING = "1"/g, `MRRLIN_STAGING = "1"`);
|
|
39466
|
+
out = out.replace(block, () => deduped);
|
|
39467
|
+
changed += 1;
|
|
39468
|
+
}
|
|
39469
|
+
if (changed === 0) {
|
|
39470
|
+
return {
|
|
39471
|
+
file: file2,
|
|
39472
|
+
status: "skipped-drifted",
|
|
39473
|
+
detail: "the retired host is not pinned by a MRRLIN_API_BASE_URL value inside a managed block \u2014 left untouched"
|
|
39474
|
+
};
|
|
39475
|
+
}
|
|
39476
|
+
backupOnce(file2, text, d);
|
|
39477
|
+
d.writeFile(file2, out);
|
|
39478
|
+
return { file: file2, status: "migrated", detail: "swapped the pinned URL for MRRLIN_STAGING" };
|
|
39479
|
+
}
|
|
39480
|
+
function migrateRetiredApiBaseUrls(deps = {}) {
|
|
39481
|
+
const d = defaultDeps(deps);
|
|
39482
|
+
const results = [];
|
|
39483
|
+
const steps = [
|
|
39484
|
+
{ run: migrateEcosystemConfig, file: import_node_path5.default.join(d.home, ".mrrlin", "ecosystem.config.cjs") },
|
|
39485
|
+
{ run: migrateCodexConfig, file: import_node_path5.default.join(d.codexHome, "config.toml") }
|
|
39486
|
+
];
|
|
39487
|
+
for (const step of steps) {
|
|
39488
|
+
try {
|
|
39489
|
+
results.push(step.run(deps));
|
|
39490
|
+
} catch (error51) {
|
|
39491
|
+
const detail = error51 instanceof Error ? error51.message : String(error51);
|
|
39492
|
+
results.push({ file: step.file, status: "failed", detail });
|
|
39493
|
+
}
|
|
39494
|
+
}
|
|
39495
|
+
for (const r of results) {
|
|
39496
|
+
if (r.status === "migrated") {
|
|
39497
|
+
d.log(`[mrrlin-mcp] healed a retired API URL in ${r.file} (${r.detail}).`);
|
|
39498
|
+
} else if (r.status === "skipped-drifted" || r.status === "failed") {
|
|
39499
|
+
d.log(`[mrrlin-mcp] WARNING: could not heal ${r.file}: ${r.detail}`);
|
|
39500
|
+
}
|
|
39501
|
+
}
|
|
39502
|
+
if (results.some((r) => r.status === "migrated" && r.file.endsWith("ecosystem.config.cjs"))) {
|
|
39503
|
+
d.log(
|
|
39504
|
+
"[mrrlin-mcp] the running process is already retargeted in memory; for pm2 to pick up the healed ecosystem file run: pm2 delete mrrlin-bridge && pm2 start ~/.mrrlin/ecosystem.config.cjs && pm2 save"
|
|
39505
|
+
);
|
|
39506
|
+
}
|
|
39507
|
+
return results;
|
|
39508
|
+
}
|
|
39509
|
+
|
|
39510
|
+
// src/bridge-health.ts
|
|
39511
|
+
var import_node_fs3 = require("node:fs");
|
|
39512
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
39513
|
+
var SENTINEL_FILE_NAME = "bridge-health-circuit-breaker.json";
|
|
39514
|
+
var CRASH_WINDOW_MS = 60 * 60 * 1e3;
|
|
39515
|
+
var MAX_CRASHES_PER_WINDOW = 3;
|
|
39516
|
+
var DEFAULT_STUCK_MS = 15 * 60 * 1e3;
|
|
39517
|
+
var DEFAULT_OPERATION_TIMEOUT_MS = 3e4;
|
|
39518
|
+
function isCrashSentinel(value) {
|
|
39519
|
+
if (typeof value !== "object" || value === null) return false;
|
|
39520
|
+
const candidate = value;
|
|
39521
|
+
return typeof candidate.crashCount === "number" && Number.isInteger(candidate.crashCount) && candidate.crashCount >= 0 && typeof candidate.windowStartedAt === "string";
|
|
39522
|
+
}
|
|
39523
|
+
async function readCrashSentinel(stateDir, now = Date.now) {
|
|
39524
|
+
const sentinelPath = import_node_path6.default.join(stateDir, SENTINEL_FILE_NAME);
|
|
39154
39525
|
try {
|
|
39155
|
-
const
|
|
39156
|
-
|
|
39526
|
+
const raw = await import_node_fs3.promises.readFile(sentinelPath, "utf8");
|
|
39527
|
+
const parsed = JSON.parse(raw);
|
|
39528
|
+
if (isCrashSentinel(parsed)) return parsed;
|
|
39157
39529
|
} catch {
|
|
39158
|
-
return false;
|
|
39159
|
-
} finally {
|
|
39160
|
-
clearTimeout(timer);
|
|
39161
39530
|
}
|
|
39531
|
+
return { crashCount: 0, windowStartedAt: new Date(now()).toISOString() };
|
|
39162
39532
|
}
|
|
39163
|
-
async function
|
|
39164
|
-
|
|
39165
|
-
const
|
|
39166
|
-
const
|
|
39167
|
-
|
|
39168
|
-
|
|
39169
|
-
|
|
39170
|
-
|
|
39171
|
-
|
|
39533
|
+
async function writeCrashSentinel(stateDir, sentinel) {
|
|
39534
|
+
await import_node_fs3.promises.mkdir(stateDir, { recursive: true });
|
|
39535
|
+
const sentinelPath = import_node_path6.default.join(stateDir, SENTINEL_FILE_NAME);
|
|
39536
|
+
const tmpPath = `${sentinelPath}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
39537
|
+
await import_node_fs3.promises.writeFile(tmpPath, JSON.stringify(sentinel), "utf8");
|
|
39538
|
+
await import_node_fs3.promises.rename(tmpPath, sentinelPath);
|
|
39539
|
+
}
|
|
39540
|
+
function withTimeout(fn, ms = DEFAULT_OPERATION_TIMEOUT_MS) {
|
|
39541
|
+
const controller = new AbortController();
|
|
39542
|
+
return new Promise((resolve, reject) => {
|
|
39543
|
+
const timer = setTimeout(() => {
|
|
39544
|
+
controller.abort();
|
|
39545
|
+
const timeoutError = new Error(`operation timed out after ${ms}ms`);
|
|
39546
|
+
timeoutError.code = "BRIDGE_HEALTH_TIMEOUT";
|
|
39547
|
+
reject(timeoutError);
|
|
39548
|
+
}, ms);
|
|
39549
|
+
fn(controller.signal).then(
|
|
39550
|
+
(value) => {
|
|
39551
|
+
clearTimeout(timer);
|
|
39552
|
+
resolve(value);
|
|
39553
|
+
},
|
|
39554
|
+
(error51) => {
|
|
39555
|
+
clearTimeout(timer);
|
|
39556
|
+
reject(error51);
|
|
39557
|
+
}
|
|
39558
|
+
);
|
|
39559
|
+
});
|
|
39560
|
+
}
|
|
39561
|
+
var defaultLogger = {
|
|
39562
|
+
critical(message) {
|
|
39563
|
+
process.stderr.write(`[mrrlin-mcp director-bridge] ${message}
|
|
39564
|
+
`);
|
|
39172
39565
|
}
|
|
39173
|
-
|
|
39174
|
-
|
|
39175
|
-
|
|
39566
|
+
};
|
|
39567
|
+
var BridgeHealthTracker = class {
|
|
39568
|
+
stateDir;
|
|
39569
|
+
stuckMs;
|
|
39570
|
+
now;
|
|
39571
|
+
processExit;
|
|
39572
|
+
logger;
|
|
39573
|
+
// Initialized to construction time, NOT 0/undefined: a freshly (re)started process — including
|
|
39574
|
+
// one that just restarted BECAUSE this breaker tripped — must not treat its own startup instant
|
|
39575
|
+
// as "ages ago that nothing succeeded." Without this, the very first tracked failure after any
|
|
39576
|
+
// restart would evaluate as instantly stuck, exhausting the crash-loop guard's 3 attempts within
|
|
39577
|
+
// seconds and inverting this mechanism into the outage it exists to prevent.
|
|
39578
|
+
lastSuccessAt;
|
|
39579
|
+
disabled = false;
|
|
39580
|
+
knownCrashCount = null;
|
|
39581
|
+
lastErrorByOperation = /* @__PURE__ */ new Map();
|
|
39582
|
+
constructor(opts) {
|
|
39583
|
+
this.stateDir = opts.stateDir;
|
|
39584
|
+
this.stuckMs = opts.stuckMs ?? readStuckMsFromEnv() ?? DEFAULT_STUCK_MS;
|
|
39585
|
+
this.now = opts.now ?? Date.now;
|
|
39586
|
+
this.processExit = opts.processExit ?? ((code) => process.exit(code));
|
|
39587
|
+
this.logger = opts.logger ?? defaultLogger;
|
|
39588
|
+
this.lastSuccessAt = this.now();
|
|
39589
|
+
}
|
|
39590
|
+
/** Wraps a tracked operation: applies the hard timeout, records the outcome, and re-throws or
|
|
39591
|
+
* returns exactly what `fn` produced so the caller's own existing error handling is untouched. */
|
|
39592
|
+
async track(id, fn) {
|
|
39593
|
+
try {
|
|
39594
|
+
const result = await withTimeout(fn);
|
|
39595
|
+
await this.recordSuccess();
|
|
39596
|
+
return result;
|
|
39597
|
+
} catch (error51) {
|
|
39598
|
+
this.recordFailure(id, error51);
|
|
39599
|
+
throw error51;
|
|
39176
39600
|
}
|
|
39177
|
-
return { baseUrl: STAGING_API_BASE_URL, source: "staging-autodetect" };
|
|
39178
39601
|
}
|
|
39179
|
-
|
|
39180
|
-
|
|
39181
|
-
|
|
39602
|
+
async recordSuccess() {
|
|
39603
|
+
this.lastSuccessAt = this.now();
|
|
39604
|
+
if (this.knownCrashCount === null) {
|
|
39605
|
+
await this.reconcileCrashCountOnFirstSuccess();
|
|
39606
|
+
}
|
|
39607
|
+
}
|
|
39608
|
+
recordFailure(id, error51) {
|
|
39609
|
+
this.lastErrorByOperation.set(id, error51 instanceof Error ? error51.message : String(error51));
|
|
39610
|
+
}
|
|
39611
|
+
/** True when no tracked operation has succeeded within `stuckMs`. */
|
|
39612
|
+
isStuck() {
|
|
39613
|
+
return this.now() - this.lastSuccessAt >= this.stuckMs;
|
|
39614
|
+
}
|
|
39615
|
+
/** Call after `track()` settles a failure. Exits the process (up to 3 times per rolling hour)
|
|
39616
|
+
* once stuck; a no-op once the breaker has disabled itself for this process's lifetime. */
|
|
39617
|
+
async maybeCrash() {
|
|
39618
|
+
if (this.disabled) return;
|
|
39619
|
+
if (!this.isStuck()) return;
|
|
39620
|
+
const decision = await this.decideExitOrDisable();
|
|
39621
|
+
if (decision.exit) {
|
|
39622
|
+
this.logger.critical(
|
|
39623
|
+
`bridge health: stuck ${Math.round((this.now() - this.lastSuccessAt) / 1e3)}s (threshold ${Math.round(this.stuckMs / 1e3)}s) \u2014 crashing so pm2 restarts clean. Last errors: ${this.formatLastErrors()}`
|
|
39624
|
+
);
|
|
39625
|
+
this.processExit(1);
|
|
39626
|
+
} else {
|
|
39627
|
+
this.disabled = true;
|
|
39628
|
+
this.logger.critical(
|
|
39629
|
+
"bridge health: circuit breaker disabled after 3 restarts in the last hour \u2014 this looks like a persistent outage, not a stuck process."
|
|
39630
|
+
);
|
|
39631
|
+
}
|
|
39632
|
+
}
|
|
39633
|
+
async decideExitOrDisable() {
|
|
39634
|
+
const nowMs = this.now();
|
|
39635
|
+
let sentinel = await readCrashSentinel(this.stateDir, this.now);
|
|
39636
|
+
const windowStartedMs = Date.parse(sentinel.windowStartedAt);
|
|
39637
|
+
if (!Number.isFinite(windowStartedMs) || nowMs - windowStartedMs > CRASH_WINDOW_MS) {
|
|
39638
|
+
sentinel = { crashCount: 0, windowStartedAt: new Date(nowMs).toISOString() };
|
|
39639
|
+
}
|
|
39640
|
+
sentinel = { ...sentinel, crashCount: sentinel.crashCount + 1 };
|
|
39641
|
+
await writeCrashSentinel(this.stateDir, sentinel);
|
|
39642
|
+
return { exit: sentinel.crashCount <= MAX_CRASHES_PER_WINDOW };
|
|
39643
|
+
}
|
|
39644
|
+
async reconcileCrashCountOnFirstSuccess() {
|
|
39645
|
+
const sentinel = await readCrashSentinel(this.stateDir, this.now);
|
|
39646
|
+
this.knownCrashCount = sentinel.crashCount;
|
|
39647
|
+
if (sentinel.crashCount > 0) {
|
|
39648
|
+
await writeCrashSentinel(this.stateDir, { ...sentinel, crashCount: 0 });
|
|
39649
|
+
this.knownCrashCount = 0;
|
|
39650
|
+
}
|
|
39651
|
+
}
|
|
39652
|
+
formatLastErrors() {
|
|
39653
|
+
if (this.lastErrorByOperation.size === 0) return "none recorded";
|
|
39654
|
+
return Array.from(this.lastErrorByOperation.entries()).map(([id, message]) => `${id}=${message}`).join(", ");
|
|
39655
|
+
}
|
|
39656
|
+
};
|
|
39657
|
+
function readStuckMsFromEnv(env = process.env) {
|
|
39658
|
+
const raw = (env.MRRLIN_BRIDGE_HEALTH_STUCK_MS ?? "").trim();
|
|
39659
|
+
const parsed = Number.parseInt(raw, 10);
|
|
39660
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
39182
39661
|
}
|
|
39183
39662
|
|
|
39184
39663
|
// src/scheduler-tick.ts
|
|
@@ -39219,17 +39698,30 @@ function dispatchTickWork(deps, results) {
|
|
|
39219
39698
|
}
|
|
39220
39699
|
}
|
|
39221
39700
|
async function fireSchedulerTick(deps) {
|
|
39701
|
+
const bridgeHealth = deps.bridgeHealth;
|
|
39702
|
+
const { nextWakeAt, failed } = await attemptSchedulerTick(deps);
|
|
39703
|
+
if (failed) await bridgeHealth?.maybeCrash();
|
|
39704
|
+
return { nextWakeAt };
|
|
39705
|
+
}
|
|
39706
|
+
async function attemptSchedulerTick(deps) {
|
|
39222
39707
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
39708
|
+
const bridgeHealth = deps.bridgeHealth;
|
|
39223
39709
|
try {
|
|
39224
|
-
const
|
|
39710
|
+
const parseTick = async (signal) => {
|
|
39711
|
+
const response2 = await fetchImpl(`${deps.apiBaseUrl}/internal/scheduler/run`, { method: "POST", signal });
|
|
39712
|
+
const parsedBody2 = response2.ok ? await response2.json() : null;
|
|
39713
|
+
return { response: response2, parsedBody: parsedBody2 };
|
|
39714
|
+
};
|
|
39715
|
+
const { response, parsedBody } = bridgeHealth ? await withTimeout(parseTick) : await parseTick(new AbortController().signal);
|
|
39225
39716
|
if (!response.ok) {
|
|
39226
39717
|
process.stderr.write(
|
|
39227
39718
|
`[mrrlin-mcp director-bridge] scheduler tick failed: HTTP ${response.status} from /internal/scheduler/run
|
|
39228
39719
|
`
|
|
39229
39720
|
);
|
|
39230
|
-
|
|
39721
|
+
bridgeHealth?.recordFailure("schedulerTick", new Error(`HTTP ${response.status}`));
|
|
39722
|
+
return { nextWakeAt: null, failed: true };
|
|
39231
39723
|
}
|
|
39232
|
-
const body =
|
|
39724
|
+
const body = parsedBody;
|
|
39233
39725
|
const data = body?.data ?? {};
|
|
39234
39726
|
const results = Array.isArray(data.results) ? data.results : [];
|
|
39235
39727
|
deps.logger.logOut({
|
|
@@ -39263,13 +39755,15 @@ async function fireSchedulerTick(deps) {
|
|
|
39263
39755
|
}
|
|
39264
39756
|
});
|
|
39265
39757
|
dispatchTickWork(deps, results);
|
|
39266
|
-
|
|
39758
|
+
await bridgeHealth?.recordSuccess();
|
|
39759
|
+
return { nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null, failed: false };
|
|
39267
39760
|
} catch (error51) {
|
|
39268
39761
|
process.stderr.write(
|
|
39269
39762
|
`[mrrlin-mcp director-bridge] scheduler tick failed: ${error51 instanceof Error ? error51.message : String(error51)}
|
|
39270
39763
|
`
|
|
39271
39764
|
);
|
|
39272
|
-
|
|
39765
|
+
bridgeHealth?.recordFailure("schedulerTick", error51);
|
|
39766
|
+
return { nextWakeAt: null, failed: true };
|
|
39273
39767
|
}
|
|
39274
39768
|
}
|
|
39275
39769
|
function startSchedulerTickLoop(deps) {
|
|
@@ -39505,7 +39999,7 @@ function startAgentPoolLoop(deps) {
|
|
|
39505
39999
|
// src/execution-consumer.ts
|
|
39506
40000
|
var import_node_child_process9 = require("node:child_process");
|
|
39507
40001
|
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
39508
|
-
var
|
|
40002
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
39509
40003
|
var import_node_util = require("node:util");
|
|
39510
40004
|
|
|
39511
40005
|
// src/consensus/heads.ts
|
|
@@ -39514,8 +40008,8 @@ var DOMAINS = ["code", "seo", "marketing", "content"];
|
|
|
39514
40008
|
var HEADS_BY_DOMAIN = {
|
|
39515
40009
|
code: ["plan-reviewer", "architect", "security-analyst", "scope-analyst"],
|
|
39516
40010
|
seo: ["plan-reviewer", "scope-analyst", "seo-analyst"],
|
|
39517
|
-
marketing: ["plan-reviewer", "scope-analyst", "content-editor"],
|
|
39518
|
-
content: ["plan-reviewer", "scope-analyst", "content-editor"]
|
|
40011
|
+
marketing: ["plan-reviewer", "scope-analyst", "content-editor", "compliance-reviewer"],
|
|
40012
|
+
content: ["plan-reviewer", "scope-analyst", "content-editor", "compliance-reviewer"]
|
|
39519
40013
|
};
|
|
39520
40014
|
var SPEC_HEADS = HEADS_BY_DOMAIN.code;
|
|
39521
40015
|
function normalizeDomain(value) {
|
|
@@ -39542,8 +40036,8 @@ function resolveProducerPersona(domain2) {
|
|
|
39542
40036
|
|
|
39543
40037
|
// src/consensus/wiring.ts
|
|
39544
40038
|
var import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
39545
|
-
var
|
|
39546
|
-
var
|
|
40039
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
40040
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
39547
40041
|
var import_node_url2 = require("node:url");
|
|
39548
40042
|
|
|
39549
40043
|
// src/consensus/codex-exec.ts
|
|
@@ -39962,15 +40456,15 @@ ${res.stdout}${res.stderr}`);
|
|
|
39962
40456
|
var import_meta2 = {};
|
|
39963
40457
|
function getPersonasDir() {
|
|
39964
40458
|
if (typeof __dirname !== "undefined") {
|
|
39965
|
-
return
|
|
40459
|
+
return import_node_path7.default.join(__dirname, "consensus", "personas");
|
|
39966
40460
|
}
|
|
39967
|
-
return
|
|
40461
|
+
return import_node_path7.default.join(import_node_path7.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)), "personas");
|
|
39968
40462
|
}
|
|
39969
40463
|
var personaCache = /* @__PURE__ */ new Map();
|
|
39970
40464
|
function loadPersona(name) {
|
|
39971
40465
|
const cached2 = personaCache.get(name);
|
|
39972
40466
|
if (cached2 !== void 0) return cached2;
|
|
39973
|
-
const content =
|
|
40467
|
+
const content = import_node_fs4.default.readFileSync(import_node_path7.default.join(getPersonasDir(), `${name}.md`), "utf8");
|
|
39974
40468
|
personaCache.set(name, content);
|
|
39975
40469
|
return content;
|
|
39976
40470
|
}
|
|
@@ -41097,7 +41591,7 @@ function isDeployGateRunStatus(status) {
|
|
|
41097
41591
|
|
|
41098
41592
|
// src/turn-deadline.ts
|
|
41099
41593
|
var DEFAULT_TURN_INTERRUPT_TIMEOUT_MS = 5e3;
|
|
41100
|
-
function
|
|
41594
|
+
function withTimeout2(promise2, ms, message) {
|
|
41101
41595
|
let timer = null;
|
|
41102
41596
|
const timeout = new Promise((_, reject) => {
|
|
41103
41597
|
timer = setTimeout(() => reject(new Error(message)), ms);
|
|
@@ -41145,7 +41639,7 @@ async function awaitTurnWithDeadline(opts) {
|
|
|
41145
41639
|
const isDeadline = message === opts.timeoutMessage || hasIdle && message === opts.idleTimeoutMessage;
|
|
41146
41640
|
if (isDeadline) {
|
|
41147
41641
|
try {
|
|
41148
|
-
await
|
|
41642
|
+
await withTimeout2(
|
|
41149
41643
|
opts.interrupt(),
|
|
41150
41644
|
opts.interruptTimeoutMs ?? DEFAULT_TURN_INTERRUPT_TIMEOUT_MS,
|
|
41151
41645
|
"turn.interrupt timed out"
|
|
@@ -41161,18 +41655,18 @@ async function awaitTurnWithDeadline(opts) {
|
|
|
41161
41655
|
|
|
41162
41656
|
// src/worktree.ts
|
|
41163
41657
|
var import_node_child_process8 = require("node:child_process");
|
|
41164
|
-
var
|
|
41165
|
-
var
|
|
41166
|
-
var
|
|
41658
|
+
var import_node_fs6 = require("node:fs");
|
|
41659
|
+
var import_node_os4 = require("node:os");
|
|
41660
|
+
var import_node_path9 = require("node:path");
|
|
41167
41661
|
|
|
41168
41662
|
// src/checkout-lock.ts
|
|
41169
|
-
var
|
|
41170
|
-
var
|
|
41663
|
+
var import_node_fs5 = require("node:fs");
|
|
41664
|
+
var import_node_path8 = require("node:path");
|
|
41171
41665
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
41172
41666
|
async function withCheckoutLock(locksDir, slug, fn) {
|
|
41173
|
-
(0,
|
|
41174
|
-
const target = (0,
|
|
41175
|
-
if (!(0,
|
|
41667
|
+
(0, import_node_fs5.mkdirSync)(locksDir, { recursive: true });
|
|
41668
|
+
const target = (0, import_node_path8.join)(locksDir, `${slug}.lock`);
|
|
41669
|
+
if (!(0, import_node_fs5.existsSync)(target)) (0, import_node_fs5.writeFileSync)(target, "");
|
|
41176
41670
|
const release = await import_proper_lockfile.default.lock(target, {
|
|
41177
41671
|
retries: { retries: 600, factor: 1, minTimeout: 100, maxTimeout: 100 },
|
|
41178
41672
|
stale: 5 * 6e4
|
|
@@ -41197,12 +41691,12 @@ function git(checkout, args) {
|
|
|
41197
41691
|
});
|
|
41198
41692
|
}
|
|
41199
41693
|
async function createRunWorktree(opts) {
|
|
41200
|
-
const worktreePath = (0,
|
|
41694
|
+
const worktreePath = (0, import_node_path9.join)(opts.worktreeRoot, opts.slug, opts.runId);
|
|
41201
41695
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
41202
|
-
(0,
|
|
41696
|
+
(0, import_node_fs6.mkdirSync)(opts.worktreeRoot, { recursive: true });
|
|
41203
41697
|
try {
|
|
41204
41698
|
git(opts.checkout, ["fetch", "origin", opts.defaultBranch]);
|
|
41205
|
-
if (!(0,
|
|
41699
|
+
if (!(0, import_node_fs6.existsSync)(worktreePath)) {
|
|
41206
41700
|
git(opts.checkout, [
|
|
41207
41701
|
"worktree",
|
|
41208
41702
|
"add",
|
|
@@ -41260,15 +41754,15 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
41260
41754
|
if (localConfig.trim()) {
|
|
41261
41755
|
throw new Error(`push aborted: agent-controlled git config present in worktree: ${localConfig.trim().split("\n")[0]}`);
|
|
41262
41756
|
}
|
|
41263
|
-
const dir = (0,
|
|
41264
|
-
const askpass = (0,
|
|
41757
|
+
const dir = (0, import_node_fs6.mkdtempSync)((0, import_node_path9.join)((0, import_node_os4.tmpdir)(), "mrrlin-push-"));
|
|
41758
|
+
const askpass = (0, import_node_path9.join)(dir, "askpass");
|
|
41265
41759
|
try {
|
|
41266
|
-
(0,
|
|
41760
|
+
(0, import_node_fs6.writeFileSync)(
|
|
41267
41761
|
askpass,
|
|
41268
41762
|
'#!/bin/sh\ncase "$1" in *[Uu]sername*) printf %s "x-access-token" ;; *) printf %s "$MRRLIN_PUSH_TOKEN" ;; esac\n',
|
|
41269
41763
|
{ mode: 320 }
|
|
41270
41764
|
);
|
|
41271
|
-
(0,
|
|
41765
|
+
(0, import_node_fs6.chmodSync)(askpass, 320);
|
|
41272
41766
|
execGit(
|
|
41273
41767
|
[
|
|
41274
41768
|
"-C",
|
|
@@ -41287,18 +41781,18 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
41287
41781
|
);
|
|
41288
41782
|
return { pushedSha: localSha };
|
|
41289
41783
|
} finally {
|
|
41290
|
-
(0,
|
|
41784
|
+
(0, import_node_fs6.rmSync)(dir, { recursive: true, force: true });
|
|
41291
41785
|
}
|
|
41292
41786
|
}
|
|
41293
41787
|
async function sweepOrphanWorktrees(opts) {
|
|
41294
41788
|
const reaped = [];
|
|
41295
41789
|
const ownedPrefix = (() => {
|
|
41296
41790
|
try {
|
|
41297
|
-
return (0,
|
|
41791
|
+
return (0, import_node_fs6.realpathSync)(opts.worktreeRoot);
|
|
41298
41792
|
} catch {
|
|
41299
41793
|
return opts.worktreeRoot;
|
|
41300
41794
|
}
|
|
41301
|
-
})() +
|
|
41795
|
+
})() + import_node_path9.sep + opts.slug + import_node_path9.sep;
|
|
41302
41796
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
41303
41797
|
const listing = git(opts.checkout, ["worktree", "list", "--porcelain"]);
|
|
41304
41798
|
for (const block of listing.split("\n\n")) {
|
|
@@ -41559,8 +42053,8 @@ function newArtifactId() {
|
|
|
41559
42053
|
return `EA-${import_node_crypto4.default.randomUUID()}`;
|
|
41560
42054
|
}
|
|
41561
42055
|
var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
|
|
41562
|
-
function isBlastRadiusFloorPath(
|
|
41563
|
-
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(
|
|
42056
|
+
function isBlastRadiusFloorPath(path18) {
|
|
42057
|
+
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path18));
|
|
41564
42058
|
}
|
|
41565
42059
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process9.execFile);
|
|
41566
42060
|
async function defaultListRunDiffPaths(opts) {
|
|
@@ -42185,17 +42679,6 @@ async function writeDeliverablePage(client, projectSlug, task, markdown) {
|
|
|
42185
42679
|
throw new Error(`could not allocate a deliverable page id for ${task.id} (last conflict: ${lastConflict})`);
|
|
42186
42680
|
}
|
|
42187
42681
|
async function driveNonCodeRun(deps, projectSlug, runId, leaseId, task, domain2) {
|
|
42188
|
-
if (!isExecutionDomainSupported(domain2)) {
|
|
42189
|
-
await failRun(
|
|
42190
|
-
deps,
|
|
42191
|
-
projectSlug,
|
|
42192
|
-
task,
|
|
42193
|
-
runId,
|
|
42194
|
-
leaseId,
|
|
42195
|
-
`non_code_execution_unsupported: task ${task.id} domain "${domain2}" is not in the execution whitelist.`
|
|
42196
|
-
);
|
|
42197
|
-
return;
|
|
42198
|
-
}
|
|
42199
42682
|
const personaName = resolveProducerPersona(domain2);
|
|
42200
42683
|
if (!personaName) {
|
|
42201
42684
|
await failRun(
|
|
@@ -42522,8 +43005,8 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
|
|
|
42522
43005
|
function isRunRecoverableByThisBridge(run3, worktreeRoot) {
|
|
42523
43006
|
if (!worktreeRoot) return true;
|
|
42524
43007
|
if (!run3.worktreeId) return false;
|
|
42525
|
-
const relative =
|
|
42526
|
-
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !
|
|
43008
|
+
const relative = import_node_path10.default.relative(import_node_path10.default.resolve(worktreeRoot), import_node_path10.default.resolve(run3.worktreeId));
|
|
43009
|
+
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !import_node_path10.default.isAbsolute(relative);
|
|
42527
43010
|
}
|
|
42528
43011
|
async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId) {
|
|
42529
43012
|
await deps.client.updateExecutionRun(projectSlug, runId, { status: "failed", finishedAt: (/* @__PURE__ */ new Date()).toISOString(), leaseId: leaseId ?? void 0 }).catch(() => {
|
|
@@ -42987,19 +43470,19 @@ function codexIdleMs() {
|
|
|
42987
43470
|
}
|
|
42988
43471
|
|
|
42989
43472
|
// src/operator-token.ts
|
|
42990
|
-
var
|
|
42991
|
-
var
|
|
42992
|
-
var
|
|
43473
|
+
var import_node_fs7 = require("node:fs");
|
|
43474
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
43475
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
42993
43476
|
function operatorDir() {
|
|
42994
|
-
const base = process.env.CODEX_HOME ?
|
|
43477
|
+
const base = process.env.CODEX_HOME ? import_node_path11.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path11.default.join(import_node_os5.default.homedir(), ".mrrlin");
|
|
42995
43478
|
return base;
|
|
42996
43479
|
}
|
|
42997
43480
|
function operatorTokenPath() {
|
|
42998
|
-
return
|
|
43481
|
+
return import_node_path11.default.join(operatorDir(), "operator-token");
|
|
42999
43482
|
}
|
|
43000
43483
|
function readOperatorToken() {
|
|
43001
43484
|
try {
|
|
43002
|
-
const token = (0,
|
|
43485
|
+
const token = (0, import_node_fs7.readFileSync)(operatorTokenPath(), "utf8").trim();
|
|
43003
43486
|
return token.length > 0 ? token : null;
|
|
43004
43487
|
} catch {
|
|
43005
43488
|
return null;
|
|
@@ -43007,24 +43490,24 @@ function readOperatorToken() {
|
|
|
43007
43490
|
}
|
|
43008
43491
|
function persistOperatorToken(token) {
|
|
43009
43492
|
const dir = operatorDir();
|
|
43010
|
-
(0,
|
|
43011
|
-
(0,
|
|
43493
|
+
(0, import_node_fs7.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43494
|
+
(0, import_node_fs7.writeFileSync)(operatorTokenPath(), `${token.trim()}
|
|
43012
43495
|
`, { encoding: "utf8", mode: 384 });
|
|
43013
43496
|
}
|
|
43014
43497
|
function agentCredentialPath() {
|
|
43015
|
-
return
|
|
43498
|
+
return import_node_path11.default.join(operatorDir(), "agent-credential");
|
|
43016
43499
|
}
|
|
43017
43500
|
function persistAgentSecret(secret) {
|
|
43018
43501
|
const dir = operatorDir();
|
|
43019
|
-
(0,
|
|
43020
|
-
(0,
|
|
43502
|
+
(0, import_node_fs7.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43503
|
+
(0, import_node_fs7.writeFileSync)(agentCredentialPath(), `${secret.trim()}
|
|
43021
43504
|
`, { encoding: "utf8", mode: 384 });
|
|
43022
43505
|
}
|
|
43023
43506
|
function readAgentSecret() {
|
|
43024
43507
|
const fromEnv = process.env.MRRLIN_AGENT_SECRET?.trim();
|
|
43025
43508
|
if (fromEnv) return fromEnv;
|
|
43026
43509
|
try {
|
|
43027
|
-
const raw = (0,
|
|
43510
|
+
const raw = (0, import_node_fs7.readFileSync)(agentCredentialPath(), "utf8").trim();
|
|
43028
43511
|
return raw || void 0;
|
|
43029
43512
|
} catch {
|
|
43030
43513
|
return void 0;
|
|
@@ -43032,16 +43515,16 @@ function readAgentSecret() {
|
|
|
43032
43515
|
}
|
|
43033
43516
|
|
|
43034
43517
|
// src/thread-index.ts
|
|
43035
|
-
var
|
|
43036
|
-
var
|
|
43518
|
+
var import_node_fs8 = require("node:fs");
|
|
43519
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
43037
43520
|
function threadIndexPath(stateDir) {
|
|
43038
|
-
return
|
|
43521
|
+
return import_node_path12.default.join(stateDir, "threads.json");
|
|
43039
43522
|
}
|
|
43040
43523
|
function loadThreadIndex(stateDir, ttlMs, now) {
|
|
43041
43524
|
const result = /* @__PURE__ */ new Map();
|
|
43042
43525
|
let parsed;
|
|
43043
43526
|
try {
|
|
43044
|
-
parsed = JSON.parse((0,
|
|
43527
|
+
parsed = JSON.parse((0, import_node_fs8.readFileSync)(threadIndexPath(stateDir), "utf8"));
|
|
43045
43528
|
} catch {
|
|
43046
43529
|
return result;
|
|
43047
43530
|
}
|
|
@@ -43063,8 +43546,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
|
|
|
43063
43546
|
return result;
|
|
43064
43547
|
}
|
|
43065
43548
|
function saveThreadIndex(stateDir, entries) {
|
|
43066
|
-
(0,
|
|
43067
|
-
(0,
|
|
43549
|
+
(0, import_node_fs8.mkdirSync)(stateDir, { recursive: true, mode: 448 });
|
|
43550
|
+
(0, import_node_fs8.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
|
|
43068
43551
|
`, {
|
|
43069
43552
|
encoding: "utf8",
|
|
43070
43553
|
mode: 384
|
|
@@ -43150,9 +43633,9 @@ function chatTurnMaxMs() {
|
|
|
43150
43633
|
|
|
43151
43634
|
// src/worker-token.ts
|
|
43152
43635
|
var import_node_crypto6 = require("node:crypto");
|
|
43153
|
-
var
|
|
43154
|
-
var
|
|
43155
|
-
var
|
|
43636
|
+
var import_node_fs9 = require("node:fs");
|
|
43637
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
43638
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
43156
43639
|
var DEFAULT_WORKER_PORT = 8792;
|
|
43157
43640
|
function workerPort() {
|
|
43158
43641
|
const raw = process.env.MRRLIN_WORKER_PORT;
|
|
@@ -43161,15 +43644,15 @@ function workerPort() {
|
|
|
43161
43644
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
|
|
43162
43645
|
}
|
|
43163
43646
|
function workerDir() {
|
|
43164
|
-
const base = process.env.CODEX_HOME ?
|
|
43165
|
-
return
|
|
43647
|
+
const base = process.env.CODEX_HOME ? import_node_path13.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path13.default.join(import_node_os6.default.homedir(), ".mrrlin");
|
|
43648
|
+
return import_node_path13.default.join(base, "worker");
|
|
43166
43649
|
}
|
|
43167
43650
|
function workerTokenPath() {
|
|
43168
|
-
return
|
|
43651
|
+
return import_node_path13.default.join(workerDir(), "token");
|
|
43169
43652
|
}
|
|
43170
43653
|
function readWorkerToken() {
|
|
43171
43654
|
try {
|
|
43172
|
-
const token = (0,
|
|
43655
|
+
const token = (0, import_node_fs9.readFileSync)(workerTokenPath(), "utf8").trim();
|
|
43173
43656
|
return token.length > 0 ? token : null;
|
|
43174
43657
|
} catch {
|
|
43175
43658
|
return null;
|
|
@@ -43179,18 +43662,18 @@ function readOrCreateWorkerToken() {
|
|
|
43179
43662
|
const existing = readWorkerToken();
|
|
43180
43663
|
if (existing) return existing;
|
|
43181
43664
|
const dir = workerDir();
|
|
43182
|
-
(0,
|
|
43665
|
+
(0, import_node_fs9.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43183
43666
|
const token = (0, import_node_crypto6.randomBytes)(32).toString("hex");
|
|
43184
|
-
(0,
|
|
43667
|
+
(0, import_node_fs9.writeFileSync)(workerTokenPath(), `${token}
|
|
43185
43668
|
`, { encoding: "utf8", mode: 384 });
|
|
43186
43669
|
return token;
|
|
43187
43670
|
}
|
|
43188
43671
|
|
|
43189
43672
|
// src/remote-phone-relay.ts
|
|
43190
43673
|
var import_node_events2 = require("node:events");
|
|
43191
|
-
var
|
|
43192
|
-
var
|
|
43193
|
-
var
|
|
43674
|
+
var import_node_fs10 = require("node:fs");
|
|
43675
|
+
var import_node_os7 = require("node:os");
|
|
43676
|
+
var import_node_path14 = require("node:path");
|
|
43194
43677
|
|
|
43195
43678
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
43196
43679
|
var nc = __toESM(require("node:crypto"), 1);
|
|
@@ -46761,9 +47244,9 @@ var DirectorRelay = class {
|
|
|
46761
47244
|
|
|
46762
47245
|
// src/remote-phone-relay.ts
|
|
46763
47246
|
function loadOrCreateAgentDeviceKey() {
|
|
46764
|
-
const
|
|
47247
|
+
const path18 = (0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin", "agent-device-key");
|
|
46765
47248
|
try {
|
|
46766
|
-
const raw = JSON.parse((0,
|
|
47249
|
+
const raw = JSON.parse((0, import_node_fs10.readFileSync)(path18, "utf8"));
|
|
46767
47250
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
46768
47251
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
46769
47252
|
}
|
|
@@ -46771,9 +47254,9 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46771
47254
|
}
|
|
46772
47255
|
const kp = generateIdentityKeyPair();
|
|
46773
47256
|
try {
|
|
46774
|
-
(0,
|
|
46775
|
-
(0,
|
|
46776
|
-
|
|
47257
|
+
(0, import_node_fs10.mkdirSync)((0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin"), { recursive: true });
|
|
47258
|
+
(0, import_node_fs10.writeFileSync)(
|
|
47259
|
+
path18,
|
|
46777
47260
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
46778
47261
|
{ mode: 384 }
|
|
46779
47262
|
);
|
|
@@ -46781,10 +47264,10 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46781
47264
|
}
|
|
46782
47265
|
return kp;
|
|
46783
47266
|
}
|
|
46784
|
-
var AGENT_PAIRING_PATH = (0,
|
|
47267
|
+
var AGENT_PAIRING_PATH = (0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
46785
47268
|
function loadAgentPairing() {
|
|
46786
47269
|
try {
|
|
46787
|
-
const raw = JSON.parse((0,
|
|
47270
|
+
const raw = JSON.parse((0, import_node_fs10.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
46788
47271
|
if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
|
|
46789
47272
|
return {
|
|
46790
47273
|
channelId: raw.channelId,
|
|
@@ -46799,8 +47282,8 @@ function loadAgentPairing() {
|
|
|
46799
47282
|
}
|
|
46800
47283
|
function saveAgentPairing(record2) {
|
|
46801
47284
|
try {
|
|
46802
|
-
(0,
|
|
46803
|
-
(0,
|
|
47285
|
+
(0, import_node_fs10.mkdirSync)((0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin"), { recursive: true });
|
|
47286
|
+
(0, import_node_fs10.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
46804
47287
|
} catch {
|
|
46805
47288
|
}
|
|
46806
47289
|
}
|
|
@@ -46977,18 +47460,18 @@ async function renderPairingQrSvg(payload) {
|
|
|
46977
47460
|
}
|
|
46978
47461
|
|
|
46979
47462
|
// src/checkout-registry.ts
|
|
46980
|
-
var
|
|
46981
|
-
var
|
|
47463
|
+
var import_node_fs11 = require("node:fs");
|
|
47464
|
+
var import_node_path15 = require("node:path");
|
|
46982
47465
|
var CheckoutRegistry = class {
|
|
46983
47466
|
file;
|
|
46984
47467
|
constructor(stateDir) {
|
|
46985
|
-
this.file = (0,
|
|
46986
|
-
(0,
|
|
47468
|
+
this.file = (0, import_node_path15.join)(stateDir, "checkouts.json");
|
|
47469
|
+
(0, import_node_fs11.mkdirSync)(stateDir, { recursive: true });
|
|
46987
47470
|
}
|
|
46988
47471
|
read() {
|
|
46989
|
-
if (!(0,
|
|
47472
|
+
if (!(0, import_node_fs11.existsSync)(this.file)) return {};
|
|
46990
47473
|
try {
|
|
46991
|
-
return JSON.parse((0,
|
|
47474
|
+
return JSON.parse((0, import_node_fs11.readFileSync)(this.file, "utf8"));
|
|
46992
47475
|
} catch {
|
|
46993
47476
|
return {};
|
|
46994
47477
|
}
|
|
@@ -46996,10 +47479,10 @@ var CheckoutRegistry = class {
|
|
|
46996
47479
|
get(slug) {
|
|
46997
47480
|
return this.read()[slug] ?? null;
|
|
46998
47481
|
}
|
|
46999
|
-
confirm(slug,
|
|
47482
|
+
confirm(slug, path18, now) {
|
|
47000
47483
|
const all = this.read();
|
|
47001
|
-
all[slug] = { path:
|
|
47002
|
-
(0,
|
|
47484
|
+
all[slug] = { path: path18, confirmedAt: now };
|
|
47485
|
+
(0, import_node_fs11.writeFileSync)(this.file, JSON.stringify(all, null, 2));
|
|
47003
47486
|
}
|
|
47004
47487
|
};
|
|
47005
47488
|
|
|
@@ -47210,8 +47693,8 @@ function extractVerificationSection(markdown) {
|
|
|
47210
47693
|
}
|
|
47211
47694
|
|
|
47212
47695
|
// src/bridge-log.ts
|
|
47213
|
-
var
|
|
47214
|
-
var
|
|
47696
|
+
var import_node_fs12 = require("node:fs");
|
|
47697
|
+
var import_node_path16 = require("node:path");
|
|
47215
47698
|
|
|
47216
47699
|
// src/redact.ts
|
|
47217
47700
|
var REDACTED = "[REDACTED]";
|
|
@@ -47296,14 +47779,14 @@ function resolvePromptsEnabled(env) {
|
|
|
47296
47779
|
}
|
|
47297
47780
|
function createBridgeLogger(stateDir, env = process.env) {
|
|
47298
47781
|
if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
|
|
47299
|
-
const logsDir = (0,
|
|
47782
|
+
const logsDir = (0, import_node_path16.join)(stateDir, "logs");
|
|
47300
47783
|
try {
|
|
47301
|
-
(0,
|
|
47784
|
+
(0, import_node_fs12.mkdirSync)(logsDir, { recursive: true });
|
|
47302
47785
|
} catch {
|
|
47303
47786
|
return NOOP_LOGGER;
|
|
47304
47787
|
}
|
|
47305
47788
|
const includePrompts = resolvePromptsEnabled(env);
|
|
47306
|
-
const fileFor = () => (0,
|
|
47789
|
+
const fileFor = () => (0, import_node_path16.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
|
|
47307
47790
|
const write = (dir, rec) => {
|
|
47308
47791
|
try {
|
|
47309
47792
|
const line = JSON.stringify({
|
|
@@ -47315,7 +47798,7 @@ function createBridgeLogger(stateDir, env = process.env) {
|
|
|
47315
47798
|
...rec.ms !== void 0 ? { ms: rec.ms } : {},
|
|
47316
47799
|
payload: redactMessage(rec.payload, { includePrompts })
|
|
47317
47800
|
}) + "\n";
|
|
47318
|
-
(0,
|
|
47801
|
+
(0, import_node_fs12.appendFileSync)(fileFor(), line);
|
|
47319
47802
|
} catch {
|
|
47320
47803
|
}
|
|
47321
47804
|
};
|
|
@@ -47333,10 +47816,9 @@ var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
|
47333
47816
|
"http://localhost:*",
|
|
47334
47817
|
"http://127.0.0.1:*",
|
|
47335
47818
|
"http://[::1]:*",
|
|
47336
|
-
// Staging Vercel team migrated 2026-07-28 (see docs/reference/deployments.md)
|
|
47337
|
-
// fnnzzz-fnnzzzs-projects alias
|
|
47819
|
+
// Staging Vercel team migrated 2026-07-28 (see docs/reference/deployments.md). The prior
|
|
47820
|
+
// fnnzzz-fnnzzzs-projects web alias was dropped once no operator was left on an old build.
|
|
47338
47821
|
"https://mrrlin-web-mrrlin2.vercel.app",
|
|
47339
|
-
"https://mrrlin-web-fnnzzz-fnnzzzs-projects.vercel.app",
|
|
47340
47822
|
"https://app.mrrlin.dev",
|
|
47341
47823
|
"https://mrrlin-web.vercel.app"
|
|
47342
47824
|
];
|
|
@@ -47385,7 +47867,7 @@ function addBridgeModel(target, model) {
|
|
|
47385
47867
|
}
|
|
47386
47868
|
function readTextIfExists(filePath) {
|
|
47387
47869
|
try {
|
|
47388
|
-
return
|
|
47870
|
+
return import_node_fs13.default.readFileSync(filePath, "utf8");
|
|
47389
47871
|
} catch {
|
|
47390
47872
|
return null;
|
|
47391
47873
|
}
|
|
@@ -47396,9 +47878,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
47396
47878
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
47397
47879
|
}
|
|
47398
47880
|
function readCodexFallbackModels() {
|
|
47399
|
-
const codexHome = process.env.CODEX_HOME?.trim() ||
|
|
47881
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path17.default.join(import_node_os8.default.homedir(), ".codex");
|
|
47400
47882
|
const models = /* @__PURE__ */ new Map();
|
|
47401
|
-
const cachePath =
|
|
47883
|
+
const cachePath = import_node_path17.default.join(codexHome, "models_cache.json");
|
|
47402
47884
|
const cacheRaw = readTextIfExists(cachePath);
|
|
47403
47885
|
if (cacheRaw) {
|
|
47404
47886
|
try {
|
|
@@ -47448,7 +47930,7 @@ function readCodexFallbackModels() {
|
|
|
47448
47930
|
);
|
|
47449
47931
|
}
|
|
47450
47932
|
}
|
|
47451
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47933
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path17.default.join(codexHome, "config.toml"))) {
|
|
47452
47934
|
addBridgeModel(
|
|
47453
47935
|
models,
|
|
47454
47936
|
mapBridgeModel({
|
|
@@ -47462,11 +47944,11 @@ function readCodexFallbackModels() {
|
|
|
47462
47944
|
})
|
|
47463
47945
|
);
|
|
47464
47946
|
}
|
|
47465
|
-
const automationsDir =
|
|
47947
|
+
const automationsDir = import_node_path17.default.join(codexHome, "automations");
|
|
47466
47948
|
try {
|
|
47467
|
-
for (const entry of
|
|
47949
|
+
for (const entry of import_node_fs13.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
47468
47950
|
if (!entry.isDirectory()) continue;
|
|
47469
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47951
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path17.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
47470
47952
|
addBridgeModel(
|
|
47471
47953
|
models,
|
|
47472
47954
|
mapBridgeModel({
|
|
@@ -47486,9 +47968,9 @@ function readCodexFallbackModels() {
|
|
|
47486
47968
|
return [...models.values()];
|
|
47487
47969
|
}
|
|
47488
47970
|
function neutralCheckoutCwd(stateDir) {
|
|
47489
|
-
const dir =
|
|
47971
|
+
const dir = import_node_path17.default.join(stateDir, "no-checkout");
|
|
47490
47972
|
try {
|
|
47491
|
-
|
|
47973
|
+
import_node_fs13.default.mkdirSync(dir, { recursive: true });
|
|
47492
47974
|
} catch {
|
|
47493
47975
|
}
|
|
47494
47976
|
return dir;
|
|
@@ -47538,7 +48020,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
|
|
|
47538
48020
|
" bullets (`- AND ...` as needed). Scenarios make the spec verifiable.",
|
|
47539
48021
|
"- Keep behavior contracts in the spec; implementation details belong in `## Implementation Plan`.",
|
|
47540
48022
|
"- Apply this format ONLY to Specs/{id} pages; do not retro-fit it onto other wiki page types.",
|
|
47541
|
-
"- Spec consensus runs ASYNCHRONOUSLY. Call `run_spec_consensus` for a `Specs/{id}` page; it returns IMMEDIATELY. On `already_converged`, the spec is already marked ready \u2014 proceed straight to `create_execution_run`; do NOT call `mark_spec_ready` and do NOT re-run consensus. On `queued` or `already_running`, tell the user it was launched and END your turn \u2014 do NOT poll or call it again; the result arrives in the inbox (an `info` item on CONVERGED, a `handoff` item if it was blocked/failed). When a consensus `info` item says CONVERGED, proceed to `create_execution_run`. When a `handoff` says it was blocked, address the recorded issues in the spec (any edit re-arms the gate) and call `run_spec_consensus` once more. For a NON-code task (domain seo/marketing/content, ADR 0020):
|
|
48023
|
+
"- Spec consensus runs ASYNCHRONOUSLY. Call `run_spec_consensus` for a `Specs/{id}` page; it returns IMMEDIATELY. On `already_converged`, the spec is already marked ready \u2014 proceed straight to `create_execution_run`; do NOT call `mark_spec_ready` and do NOT re-run consensus. On `queued` or `already_running`, tell the user it was launched and END your turn \u2014 do NOT poll or call it again; the result arrives in the inbox (an `info` item on CONVERGED, a `handoff` item if it was blocked/failed). When a consensus `info` item says CONVERGED, proceed to `create_execution_run`. When a `handoff` says it was blocked, address the recorded issues in the spec (any edit re-arms the gate) and call `run_spec_consensus` once more. For a NON-code task (domain seo/marketing/content, ADR 0020): the low-risk lanes `seo`, `marketing`, and `content` proceed to `create_execution_run` after consensus converges, using the same flow as code tasks. Report the spec's review outcome to the operator.",
|
|
47542
48024
|
'- When a task needs a browser (login flows, UI verification/clicks, scraping), pass `prerequisites:[{mcp:"mrrlin-browser",reason:"..."}]` to `create_execution_run`. If that run later fails into a handoff, the operator gets a one-click "Launch browser & resume" that brings up the dedicated browser as the turn starts.',
|
|
47543
48025
|
"- When you actually drive a browser (calling `browser_navigate`, `browser_click`, `browser_snapshot`, `browser_type`, etc.), invoke those tools from the **`mrrlin-browser`** MCP server ONLY. Do NOT use tools from any other browser MCP (`playwright`, `chrome-devtools`, `puppeteer`, etc.) even if they are also connected on this operator's box \u2014 those use a shared/default Playwright profile that is fragile across runs. Only `mrrlin-browser` uses this project's dedicated Chromium + persistent operator profile (`~/.mrrlin/browser/profile`). If your host exposes multiple browser MCPs with overlapping tool names, prefer the `mrrlin-browser` server unconditionally.",
|
|
47544
48026
|
"",
|
|
@@ -47804,7 +48286,7 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47804
48286
|
const cutoff = Date.now() - worktreeRetentionMs();
|
|
47805
48287
|
const isReapable = (worktreePath) => {
|
|
47806
48288
|
try {
|
|
47807
|
-
return
|
|
48289
|
+
return import_node_fs13.default.statSync(worktreePath).mtimeMs < cutoff;
|
|
47808
48290
|
} catch {
|
|
47809
48291
|
return false;
|
|
47810
48292
|
}
|
|
@@ -47842,8 +48324,8 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47842
48324
|
}
|
|
47843
48325
|
}
|
|
47844
48326
|
function readStateDir() {
|
|
47845
|
-
if (process.env.CODEX_HOME) return
|
|
47846
|
-
return
|
|
48327
|
+
if (process.env.CODEX_HOME) return import_node_path17.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
|
|
48328
|
+
return import_node_path17.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
|
|
47847
48329
|
}
|
|
47848
48330
|
function readAllowedOrigins() {
|
|
47849
48331
|
const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
|
|
@@ -48378,7 +48860,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
48378
48860
|
}
|
|
48379
48861
|
}
|
|
48380
48862
|
takenOver.cancel?.();
|
|
48381
|
-
void
|
|
48863
|
+
void withTimeout2(
|
|
48382
48864
|
codexClient.turn.interrupt({ threadId: takenOver.threadId }),
|
|
48383
48865
|
DEFAULT_TURN_INTERRUPT_TIMEOUT_MS,
|
|
48384
48866
|
"interrupt timed out"
|
|
@@ -48580,7 +49062,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
48580
49062
|
reason === "idle" ? `Director turn stalled \u2014 no activity for ${Math.round(idleMs / 1e3)}s. Stopping; try again.` : `Director turn exceeded the ${Math.round(maxMs / 1e3)}s ceiling. Stopping; try again.`
|
|
48581
49063
|
)
|
|
48582
49064
|
);
|
|
48583
|
-
void
|
|
49065
|
+
void withTimeout2(codexClient.turn.interrupt({ threadId }), DEFAULT_TURN_INTERRUPT_TIMEOUT_MS, "interrupt timed out").catch(
|
|
48584
49066
|
() => {
|
|
48585
49067
|
if (deps.threads.get(directorSessionId) === thread) {
|
|
48586
49068
|
deps.threads.delete(directorSessionId);
|
|
@@ -48791,6 +49273,10 @@ async function startDirectorBridge() {
|
|
|
48791
49273
|
const codexProbeHandle = startCodexProbe();
|
|
48792
49274
|
const consumerState = { inFlightRunId: null, lastClaimAt: null };
|
|
48793
49275
|
const health = createServiceHealth();
|
|
49276
|
+
try {
|
|
49277
|
+
migrateRetiredApiBaseUrls();
|
|
49278
|
+
} catch {
|
|
49279
|
+
}
|
|
48794
49280
|
const apiBaseUrl = readConfiguredApiBaseUrl();
|
|
48795
49281
|
if (!isRemoteApiAllowed(apiBaseUrl)) {
|
|
48796
49282
|
throw new Error(
|
|
@@ -48870,8 +49356,8 @@ async function startDirectorBridge() {
|
|
|
48870
49356
|
codexCwd: config2.codexCwd,
|
|
48871
49357
|
codexExecutable: config2.codexExecutable,
|
|
48872
49358
|
checkoutRegistry,
|
|
48873
|
-
worktreeRoot:
|
|
48874
|
-
locksDir:
|
|
49359
|
+
worktreeRoot: import_node_path17.default.join(config2.stateDir, "worktrees"),
|
|
49360
|
+
locksDir: import_node_path17.default.join(config2.stateDir, "locks"),
|
|
48875
49361
|
// Wire the executor server for code-execution runs. Each run gets its own app-server
|
|
48876
49362
|
// process at the run worktree, running UNRESTRICTED from the real ~/.codex (owner
|
|
48877
49363
|
// no-sandbox decision — auth + mrrlin MCP come from the operator config).
|
|
@@ -48907,13 +49393,13 @@ async function startDirectorBridge() {
|
|
|
48907
49393
|
// egressDomains is retained in the seam signature (verification-turn.ts still computes the
|
|
48908
49394
|
// env host) but no longer constrains anything — the executor is unrestricted.
|
|
48909
49395
|
startSandbox: async (_egressDomains) => {
|
|
48910
|
-
const cwd =
|
|
49396
|
+
const cwd = import_node_fs13.default.mkdtempSync(import_node_path17.default.join(import_node_os8.default.tmpdir(), "mrrlin-verify-"));
|
|
48911
49397
|
let handle;
|
|
48912
49398
|
try {
|
|
48913
49399
|
handle = await startExecutorServer({ worktree: cwd });
|
|
48914
49400
|
} catch (error51) {
|
|
48915
49401
|
try {
|
|
48916
|
-
|
|
49402
|
+
import_node_fs13.default.rmSync(cwd, { recursive: true, force: true });
|
|
48917
49403
|
} catch {
|
|
48918
49404
|
}
|
|
48919
49405
|
throw error51;
|
|
@@ -48924,7 +49410,7 @@ async function startDirectorBridge() {
|
|
|
48924
49410
|
dispose: () => {
|
|
48925
49411
|
handle.dispose();
|
|
48926
49412
|
try {
|
|
48927
|
-
|
|
49413
|
+
import_node_fs13.default.rmSync(cwd, { recursive: true, force: true });
|
|
48928
49414
|
} catch {
|
|
48929
49415
|
}
|
|
48930
49416
|
}
|
|
@@ -49132,7 +49618,7 @@ async function startDirectorBridge() {
|
|
|
49132
49618
|
const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
|
|
49133
49619
|
let bridgeBinShaShort = "unknown00000";
|
|
49134
49620
|
try {
|
|
49135
|
-
bridgeBinShaShort = import_node_crypto7.default.createHash("sha256").update(
|
|
49621
|
+
bridgeBinShaShort = import_node_crypto7.default.createHash("sha256").update(import_node_fs13.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
|
|
49136
49622
|
} catch {
|
|
49137
49623
|
}
|
|
49138
49624
|
attachBridgeWss(server, {
|
|
@@ -49219,34 +49705,50 @@ async function startDirectorBridge() {
|
|
|
49219
49705
|
dispatchServer.on("error", reject);
|
|
49220
49706
|
dispatchServer.listen(workerPort(), "127.0.0.1", () => resolve());
|
|
49221
49707
|
});
|
|
49708
|
+
const bridgeHealth = new BridgeHealthTracker({ stateDir: config2.stateDir });
|
|
49709
|
+
const runTrackedSweep = async (id, label, fn) => {
|
|
49710
|
+
try {
|
|
49711
|
+
await fn();
|
|
49712
|
+
await bridgeHealth.recordSuccess();
|
|
49713
|
+
} catch (error51) {
|
|
49714
|
+
process.stderr.write(
|
|
49715
|
+
`[mrrlin-mcp director-bridge] ${label} failed: ${error51 instanceof Error ? error51.message : String(error51)}
|
|
49716
|
+
`
|
|
49717
|
+
);
|
|
49718
|
+
bridgeHealth.recordFailure(id, error51);
|
|
49719
|
+
await bridgeHealth.maybeCrash();
|
|
49720
|
+
}
|
|
49721
|
+
};
|
|
49222
49722
|
let claimLoopStopped = false;
|
|
49223
49723
|
let claimTimer = null;
|
|
49224
49724
|
const scheduleClaimLoop = () => {
|
|
49225
49725
|
if (claimLoopStopped) return;
|
|
49226
49726
|
claimTimer = setTimeout(() => {
|
|
49227
49727
|
enqueueRun(
|
|
49228
|
-
() =>
|
|
49229
|
-
|
|
49230
|
-
|
|
49231
|
-
|
|
49232
|
-
|
|
49233
|
-
|
|
49234
|
-
|
|
49728
|
+
() => runTrackedSweep(
|
|
49729
|
+
"claimSweep",
|
|
49730
|
+
"claim sweep",
|
|
49731
|
+
() => runBackstopSweep(consumerDeps, (slug, runId) => {
|
|
49732
|
+
driveTracked(slug, runId);
|
|
49733
|
+
return Promise.resolve();
|
|
49734
|
+
})
|
|
49735
|
+
)
|
|
49235
49736
|
);
|
|
49236
49737
|
enqueueRun(
|
|
49237
|
-
() =>
|
|
49238
|
-
|
|
49239
|
-
|
|
49240
|
-
|
|
49241
|
-
|
|
49242
|
-
|
|
49243
|
-
|
|
49738
|
+
() => runTrackedSweep(
|
|
49739
|
+
"asyncSweep",
|
|
49740
|
+
"async sweep",
|
|
49741
|
+
() => runAsyncBackstopSweep(asyncConsumerDeps, (slug, jobId) => {
|
|
49742
|
+
driveAsyncTracked(slug, jobId);
|
|
49743
|
+
return Promise.resolve();
|
|
49744
|
+
})
|
|
49745
|
+
)
|
|
49244
49746
|
);
|
|
49245
49747
|
enqueueRun(
|
|
49246
49748
|
() => runOrphanWorktreeSweep(client, {
|
|
49247
49749
|
checkoutRegistry,
|
|
49248
|
-
worktreeRoot:
|
|
49249
|
-
locksDir:
|
|
49750
|
+
worktreeRoot: import_node_path17.default.join(config2.stateDir, "worktrees"),
|
|
49751
|
+
locksDir: import_node_path17.default.join(config2.stateDir, "locks")
|
|
49250
49752
|
})
|
|
49251
49753
|
);
|
|
49252
49754
|
enqueueRun(async () => {
|
|
@@ -49307,6 +49809,7 @@ async function startDirectorBridge() {
|
|
|
49307
49809
|
apiBaseUrl,
|
|
49308
49810
|
fetchImpl: authedFetch,
|
|
49309
49811
|
logger: bridgeLogger,
|
|
49812
|
+
bridgeHealth,
|
|
49310
49813
|
dispatchEnqueued: (projectSlug, work) => {
|
|
49311
49814
|
if (work.kind === "execution_run") driveRunNow(projectSlug, work.runId);
|
|
49312
49815
|
else driveAsyncNow(projectSlug, work.jobId);
|
|
@@ -49507,15 +50010,15 @@ function readDispatchBody(req) {
|
|
|
49507
50010
|
function readOrCreateBridgeToken(stateDir) {
|
|
49508
50011
|
const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
|
|
49509
50012
|
if (explicit) return explicit;
|
|
49510
|
-
const tokenPath =
|
|
50013
|
+
const tokenPath = import_node_path17.default.join(stateDir, "token.txt");
|
|
49511
50014
|
try {
|
|
49512
|
-
const existing =
|
|
50015
|
+
const existing = import_node_fs13.default.readFileSync(tokenPath, "utf8").trim();
|
|
49513
50016
|
if (existing) return existing;
|
|
49514
50017
|
} catch {
|
|
49515
50018
|
}
|
|
49516
|
-
|
|
50019
|
+
import_node_fs13.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
49517
50020
|
const token = import_node_crypto7.default.randomBytes(32).toString("base64url");
|
|
49518
|
-
|
|
50021
|
+
import_node_fs13.default.writeFileSync(tokenPath, `${token}
|
|
49519
50022
|
`, { mode: 384 });
|
|
49520
50023
|
return token;
|
|
49521
50024
|
}
|
|
@@ -52899,17 +53402,17 @@ var StdioServerTransport = class {
|
|
|
52899
53402
|
// src/tools.ts
|
|
52900
53403
|
var import_node_crypto10 = require("node:crypto");
|
|
52901
53404
|
var import_promises3 = require("node:fs/promises");
|
|
52902
|
-
var
|
|
52903
|
-
var
|
|
52904
|
-
var
|
|
53405
|
+
var import_node_fs14 = require("node:fs");
|
|
53406
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
53407
|
+
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
52905
53408
|
var import_node_child_process12 = require("node:child_process");
|
|
52906
53409
|
|
|
52907
53410
|
// ../../packages/wiki/dist/index.js
|
|
52908
53411
|
var import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
52909
|
-
var
|
|
53412
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
52910
53413
|
var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
|
|
52911
53414
|
function toPosixPath(input) {
|
|
52912
|
-
return input.split(
|
|
53415
|
+
return input.split(import_node_path18.default.sep).join("/");
|
|
52913
53416
|
}
|
|
52914
53417
|
function slugifyWikiSegment(input) {
|
|
52915
53418
|
return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -52923,12 +53426,12 @@ async function pathExists2(input) {
|
|
|
52923
53426
|
}
|
|
52924
53427
|
}
|
|
52925
53428
|
async function findWorkspaceRoot(start = process.cwd()) {
|
|
52926
|
-
let current =
|
|
53429
|
+
let current = import_node_path18.default.resolve(start);
|
|
52927
53430
|
while (true) {
|
|
52928
|
-
if (await pathExists2(
|
|
53431
|
+
if (await pathExists2(import_node_path18.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path18.default.join(current, "docs"))) {
|
|
52929
53432
|
return current;
|
|
52930
53433
|
}
|
|
52931
|
-
const parent =
|
|
53434
|
+
const parent = import_node_path18.default.dirname(current);
|
|
52932
53435
|
if (parent === current) {
|
|
52933
53436
|
throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
|
|
52934
53437
|
}
|
|
@@ -52937,28 +53440,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
|
|
|
52937
53440
|
}
|
|
52938
53441
|
async function resolveDocsRoot(input) {
|
|
52939
53442
|
if (input) {
|
|
52940
|
-
return
|
|
53443
|
+
return import_node_path18.default.resolve(input);
|
|
52941
53444
|
}
|
|
52942
53445
|
if (process.env.MRRLIN_DOCS_ROOT) {
|
|
52943
|
-
return
|
|
53446
|
+
return import_node_path18.default.resolve(process.env.MRRLIN_DOCS_ROOT);
|
|
52944
53447
|
}
|
|
52945
|
-
return
|
|
53448
|
+
return import_node_path18.default.join(await findWorkspaceRoot(), "docs");
|
|
52946
53449
|
}
|
|
52947
53450
|
async function resolveIndexPath(input) {
|
|
52948
53451
|
if (input) {
|
|
52949
|
-
return
|
|
53452
|
+
return import_node_path18.default.resolve(input);
|
|
52950
53453
|
}
|
|
52951
53454
|
if (process.env.MRRLIN_WIKI_INDEX_PATH) {
|
|
52952
|
-
return
|
|
53455
|
+
return import_node_path18.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
52953
53456
|
}
|
|
52954
53457
|
const workspaceRoot = await findWorkspaceRoot();
|
|
52955
|
-
return
|
|
53458
|
+
return import_node_path18.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
52956
53459
|
}
|
|
52957
53460
|
async function walkMarkdownFiles(root, dir = root) {
|
|
52958
53461
|
const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
|
|
52959
53462
|
const files = [];
|
|
52960
53463
|
for (const entry of entries) {
|
|
52961
|
-
const absolute =
|
|
53464
|
+
const absolute = import_node_path18.default.join(dir, entry.name);
|
|
52962
53465
|
if (entry.isDirectory()) {
|
|
52963
53466
|
files.push(...await walkMarkdownFiles(root, absolute));
|
|
52964
53467
|
continue;
|
|
@@ -52977,7 +53480,7 @@ function parseTitle(markdown, sourcePath) {
|
|
|
52977
53480
|
return title;
|
|
52978
53481
|
}
|
|
52979
53482
|
function documentFromFile(docsRoot, absolutePath, markdown) {
|
|
52980
|
-
const relativePath = toPosixPath(
|
|
53483
|
+
const relativePath = toPosixPath(import_node_path18.default.relative(docsRoot, absolutePath));
|
|
52981
53484
|
const [section, fileName] = relativePath.split("/");
|
|
52982
53485
|
if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
|
|
52983
53486
|
return null;
|
|
@@ -54875,7 +55378,7 @@ var mcpToolDescriptions = {
|
|
|
54875
55378
|
[mcpToolNames.resetDirectorThread]: "Clear a task's persisted Director execution thread handle so the next execution run starts a fresh provider thread. Records a director_thread_reset task event.",
|
|
54876
55379
|
[mcpToolNames.updateWikiPage]: "Update a markdown Wiki page.",
|
|
54877
55380
|
[mcpToolNames.markSpecReady]: "Mark a wiki page (folder=Specs) as ready (or not) for execution-run gating. The Director sets this true after validating the spec; any edit to the page's markdown auto-resets it to false.",
|
|
54878
|
-
[mcpToolNames.runSpecConsensus]: 'Enqueue the consensus review gate over a Specs/{id} page. Returns IMMEDIATELY with one of: already_converged (a CONVERGED review already exists for the current content \u2014 proceed straight to create_execution_run, do NOT call mark_spec_ready, it is already set), already_reviewed (a terminal CONSENSUS_BLOCKED for this content), already_running (a consensus job is in flight), or queued (a new job was launched). The review runs in the background; its result/blocker arrives in the inbox (info on CONVERGED, handoff on failure) and is surfaced into the open chat. Do NOT call again for the same spec and do NOT poll. On queued/already_running, tell the user it was launched and end the turn. Pass extraHeads: ["researcher"] for specs referencing external libraries/APIs, or ["debugger"] for root-cause/investigation specs to add opt-in specialist reviewers on top of the fixed four. For a NON-code task (domain seo/marketing/content, ADR 0020):
|
|
55381
|
+
[mcpToolNames.runSpecConsensus]: 'Enqueue the consensus review gate over a Specs/{id} page. Returns IMMEDIATELY with one of: already_converged (a CONVERGED review already exists for the current content \u2014 proceed straight to create_execution_run, do NOT call mark_spec_ready, it is already set), already_reviewed (a terminal CONSENSUS_BLOCKED for this content), already_running (a consensus job is in flight), or queued (a new job was launched). The review runs in the background; its result/blocker arrives in the inbox (info on CONVERGED, handoff on failure) and is surfaced into the open chat. Do NOT call again for the same spec and do NOT poll. On queued/already_running, tell the user it was launched and end the turn. Pass extraHeads: ["researcher"] for specs referencing external libraries/APIs, or ["debugger"] for root-cause/investigation specs to add opt-in specialist reviewers on top of the fixed four. For a NON-code task (domain seo/marketing/content, ADR 0020): the low-risk lanes `seo`, `marketing`, and `content` proceed to `create_execution_run` after consensus, using the same flow as code tasks. Report the spec\'s review outcome to the operator.',
|
|
54879
55382
|
[mcpToolNames.runCodeReviewerGate]: `Review the current branch's code diff (vs baseRef) with a Code Reviewer gate \u2014 independent reviewers iterate review\u2192fix\u2192re-check (checkpoint, scope-limited reviser edits, typecheck/build fast-gate, rollback) until the diff converges or is blocked. Run before opening a PR. Pass extraHeads: ["security-analyst"] for sensitive diffs (auth, secrets, input handling, new endpoints).`,
|
|
54880
55383
|
[mcpToolNames.appendExecutionArtifact]: "Append a durable artifact (plan, checkpoint, command output, test result, diff summary, self-review, error, deploy attempt, or handoff judgement) to an execution run.",
|
|
54881
55384
|
[mcpToolNames.recordProducedUrl]: 'Call this after publishing each web page produced by the task, so the UI link opens the page itself instead of the deployed site root. Pass the page\'s full https URL (for external pages, e.g. "https://dev.to/<slug>") OR a path starting with "/" for the deploy environment (e.g. "/blog/<slug>") \u2014 paths are resolved against the run\'s deployed env URL at render time. Optional `label` (\u226440 chars) is shown next to the link; omit and the UI defaults to the page title. Call once per page; multiple calls dedupe by resolved URL in the UI.',
|
|
@@ -55325,7 +55828,7 @@ function createMrrlinTools(options) {
|
|
|
55325
55828
|
if (!config2.consensusEnabled) {
|
|
55326
55829
|
throw new McpToolCodedError(
|
|
55327
55830
|
"SPEC_CONSENSUS_REQUIRED",
|
|
55328
|
-
`Spec ${pageId} cannot be marked ready by the Director while consensus is disabled for this project \u2014 an operator must approve it (web wiki / markSpecReady route).
|
|
55831
|
+
`Spec ${pageId} cannot be marked ready by the Director-LLM while consensus is disabled for this project \u2014 an operator must approve it (web wiki / markSpecReady route). The scheduler tick may auto-promote server-side under the consensus-off policy; that is a different code path with different trust assumptions.`
|
|
55329
55832
|
);
|
|
55330
55833
|
}
|
|
55331
55834
|
const page = await c.getWikiPage(projectSlug, pageId);
|
|
@@ -55532,7 +56035,7 @@ function createMrrlinTools(options) {
|
|
|
55532
56035
|
"ARTIFACT_FILE_UPLOAD_FAILED",
|
|
55533
56036
|
"Unable to upload artifact file.",
|
|
55534
56037
|
async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
|
|
55535
|
-
const extension2 =
|
|
56038
|
+
const extension2 = import_node_path19.default.extname(filePath).toLowerCase();
|
|
55536
56039
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
55537
56040
|
if (!contentType) {
|
|
55538
56041
|
throw new McpToolCodedError(
|
|
@@ -55560,7 +56063,7 @@ function createMrrlinTools(options) {
|
|
|
55560
56063
|
"Artifact exceeds 5MB; split or summarize instead."
|
|
55561
56064
|
);
|
|
55562
56065
|
}
|
|
55563
|
-
const filename =
|
|
56066
|
+
const filename = import_node_path19.default.basename(filePath);
|
|
55564
56067
|
const created = await c.createArtifactFile(projectSlug, {
|
|
55565
56068
|
class: artifactClass,
|
|
55566
56069
|
contentType,
|
|
@@ -55643,7 +56146,7 @@ function createMrrlinTools(options) {
|
|
|
55643
56146
|
"Unable to register local checkout.",
|
|
55644
56147
|
async (_c, { projectSlug, path: checkoutPath, repo }) => {
|
|
55645
56148
|
const trimmedPath = checkoutPath.trim();
|
|
55646
|
-
if (!
|
|
56149
|
+
if (!import_node_path19.default.isAbsolute(trimmedPath)) {
|
|
55647
56150
|
throw new McpToolCodedError(
|
|
55648
56151
|
"LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
|
|
55649
56152
|
`Path must be absolute, got: ${trimmedPath}`
|
|
@@ -55651,7 +56154,7 @@ function createMrrlinTools(options) {
|
|
|
55651
56154
|
}
|
|
55652
56155
|
let resolvedPath;
|
|
55653
56156
|
try {
|
|
55654
|
-
resolvedPath = (0,
|
|
56157
|
+
resolvedPath = (0, import_node_fs14.realpathSync)(trimmedPath);
|
|
55655
56158
|
} catch {
|
|
55656
56159
|
throw new McpToolCodedError(
|
|
55657
56160
|
"LOCAL_CHECKOUT_PATH_NOT_FOUND",
|
|
@@ -55678,7 +56181,7 @@ function createMrrlinTools(options) {
|
|
|
55678
56181
|
`Origin remote ${remoteUrl} does not match repo ${repo}.`
|
|
55679
56182
|
);
|
|
55680
56183
|
}
|
|
55681
|
-
const stateDir = process.env.CODEX_HOME ?
|
|
56184
|
+
const stateDir = process.env.CODEX_HOME ? import_node_path19.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path19.default.join(import_node_os9.default.homedir(), ".mrrlin", "director-bridge");
|
|
55682
56185
|
const registry3 = new CheckoutRegistry(stateDir);
|
|
55683
56186
|
const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
55684
56187
|
registry3.confirm(projectSlug, resolvedPath, confirmedAt);
|
|
@@ -55853,14 +56356,29 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
55853
56356
|
async function startStdioServer(options = {}) {
|
|
55854
56357
|
let effective = options;
|
|
55855
56358
|
if (!options.apiBaseUrl) {
|
|
56359
|
+
try {
|
|
56360
|
+
migrateRetiredApiBaseUrls();
|
|
56361
|
+
} catch {
|
|
56362
|
+
}
|
|
55856
56363
|
const { baseUrl, source } = await resolveApiBaseUrlDynamic();
|
|
55857
56364
|
effective = {
|
|
55858
56365
|
...options,
|
|
55859
56366
|
apiBaseUrl: baseUrl,
|
|
55860
|
-
allowRemoteApi: source === "staging-env" || source === "staging-autodetect"
|
|
56367
|
+
allowRemoteApi: source === "staging-env" || source === "staging-autodetect" || source === "retired-retarget"
|
|
55861
56368
|
};
|
|
55862
56369
|
process.stderr.write(`[mrrlin-mcp] API resolved: ${redactUrlForLog(baseUrl)} (source=${source})
|
|
55863
56370
|
`);
|
|
56371
|
+
if (source === "retired-retarget") {
|
|
56372
|
+
process.stderr.write(
|
|
56373
|
+
"[mrrlin-mcp] your configured API URL names a RETIRED host; retargeted to the current staging target for this process. Re-run install-service/install-codex to persist the fix.\n"
|
|
56374
|
+
);
|
|
56375
|
+
}
|
|
56376
|
+
if (!await probeApiHealth(baseUrl)) {
|
|
56377
|
+
process.stderr.write(
|
|
56378
|
+
`[mrrlin-mcp] WARNING: ${redactUrlForLog(baseUrl)}/health did not answer OK (source=${source}). If source=explicit, the URL comes from MRRLIN_API_BASE_URL in ~/.mrrlin/ecosystem.config.cjs or the [mcp_servers.mrrlin] env in ~/.codex/config.toml.
|
|
56379
|
+
`
|
|
56380
|
+
);
|
|
56381
|
+
}
|
|
55864
56382
|
}
|
|
55865
56383
|
const { resolved, server } = createMrrlinMcpServer(effective);
|
|
55866
56384
|
const transport = new StdioServerTransport();
|
|
@@ -55885,56 +56403,8 @@ function runSetCredential(args) {
|
|
|
55885
56403
|
}
|
|
55886
56404
|
|
|
55887
56405
|
// src/install-service.ts
|
|
55888
|
-
var
|
|
55889
|
-
var
|
|
55890
|
-
|
|
55891
|
-
// src/service-paths.ts
|
|
55892
|
-
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
55893
|
-
function isWorktreePath(p) {
|
|
55894
|
-
const norm = import_node_path17.default.normalize(p).split(import_node_path17.default.sep).join("/");
|
|
55895
|
-
return norm.includes("/.claude/worktrees/");
|
|
55896
|
-
}
|
|
55897
|
-
function resolveServiceCwd(opts) {
|
|
55898
|
-
const chosen = (opts.explicit?.trim() || opts.cwd).trim();
|
|
55899
|
-
if (isWorktreePath(chosen)) {
|
|
55900
|
-
return {
|
|
55901
|
-
ok: false,
|
|
55902
|
-
reason: `Refusing to install a service rooted in a disposable worktree (${chosen}). Run install-service from the canonical repo root, or set MRRLIN_DIRECTOR_BRIDGE_CODEX_CWD to a stable path.`
|
|
55903
|
-
};
|
|
55904
|
-
}
|
|
55905
|
-
return { ok: true, cwd: chosen };
|
|
55906
|
-
}
|
|
55907
|
-
var BRIDGE_APP_NAME = "mrrlin-bridge";
|
|
55908
|
-
function renderEcosystemConfig(opts) {
|
|
55909
|
-
const env = {
|
|
55910
|
-
HOME: opts.home,
|
|
55911
|
-
PATH: opts.pathEnv,
|
|
55912
|
-
MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
|
|
55913
|
-
};
|
|
55914
|
-
if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
|
|
55915
|
-
if (opts.staging) env.MRRLIN_STAGING = "1";
|
|
55916
|
-
else if (opts.apiBaseUrl) env.MRRLIN_API_BASE_URL = opts.apiBaseUrl;
|
|
55917
|
-
const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
|
|
55918
|
-
return `module.exports = {
|
|
55919
|
-
apps: [{
|
|
55920
|
-
name: ${JSON.stringify(BRIDGE_APP_NAME)},
|
|
55921
|
-
script: "mrrlin-mcp",
|
|
55922
|
-
args: "director-bridge",
|
|
55923
|
-
interpreter: "none",
|
|
55924
|
-
cwd: ${JSON.stringify(opts.cwd)},
|
|
55925
|
-
autorestart: true,
|
|
55926
|
-
max_restarts: 10,
|
|
55927
|
-
restart_delay: 3000,
|
|
55928
|
-
kill_timeout: 10000,
|
|
55929
|
-
env: {
|
|
55930
|
-
${envLines}
|
|
55931
|
-
},
|
|
55932
|
-
}],
|
|
55933
|
-
};
|
|
55934
|
-
`;
|
|
55935
|
-
}
|
|
55936
|
-
|
|
55937
|
-
// src/install-service.ts
|
|
56406
|
+
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
56407
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
55938
56408
|
function installService(deps) {
|
|
55939
56409
|
if (!deps.hasSecret()) {
|
|
55940
56410
|
deps.log("No agent credential found. Issue one in Settings, then run: mrrlin-mcp set-credential '<secret>'.");
|
|
@@ -55945,7 +56415,7 @@ function installService(deps) {
|
|
|
55945
56415
|
deps.log(resolved.reason);
|
|
55946
56416
|
return { ok: false };
|
|
55947
56417
|
}
|
|
55948
|
-
const home = deps.env.HOME ??
|
|
56418
|
+
const home = deps.env.HOME ?? import_node_os10.default.homedir();
|
|
55949
56419
|
const bins = ["node", "codex", "mrrlin-mcp"].map((b) => deps.which(b));
|
|
55950
56420
|
if (bins.some((b) => !b)) {
|
|
55951
56421
|
deps.log("Could not resolve absolute paths for node/codex/mrrlin-mcp on PATH. Install them or fix PATH.");
|
|
@@ -55956,7 +56426,7 @@ function installService(deps) {
|
|
|
55956
56426
|
return { ok: false };
|
|
55957
56427
|
}
|
|
55958
56428
|
const resolvedBins = bins.filter((b) => b !== null);
|
|
55959
|
-
const pathEnv = Array.from(new Set(resolvedBins.map((b) =>
|
|
56429
|
+
const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path20.default.dirname(b)))).join(":");
|
|
55960
56430
|
const text = renderEcosystemConfig({
|
|
55961
56431
|
cwd: resolved.cwd,
|
|
55962
56432
|
home,
|
|
@@ -55965,7 +56435,7 @@ function installService(deps) {
|
|
|
55965
56435
|
staging: deps.env.MRRLIN_STAGING === "1",
|
|
55966
56436
|
apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
|
|
55967
56437
|
});
|
|
55968
|
-
const ecoPath =
|
|
56438
|
+
const ecoPath = import_node_path20.default.join(home, ".mrrlin", "ecosystem.config.cjs");
|
|
55969
56439
|
deps.writeFile(ecoPath, text);
|
|
55970
56440
|
const start = deps.runPm2(["startOrReload", ecoPath]);
|
|
55971
56441
|
if (start.code !== 0) {
|
|
@@ -55996,13 +56466,13 @@ function uninstallService(deps) {
|
|
|
55996
56466
|
|
|
55997
56467
|
// src/uninstall-codex.ts
|
|
55998
56468
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
55999
|
-
var
|
|
56000
|
-
var
|
|
56469
|
+
var import_node_os11 = __toESM(require("node:os"), 1);
|
|
56470
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
56001
56471
|
var toml2 = __toESM(require_toml(), 1);
|
|
56002
56472
|
function resolveCodexHome2(options) {
|
|
56003
56473
|
if (options.codexHome) return options.codexHome;
|
|
56004
56474
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
56005
|
-
return
|
|
56475
|
+
return import_node_path21.default.join(options.homeDir ?? import_node_os11.default.homedir(), ".codex");
|
|
56006
56476
|
}
|
|
56007
56477
|
async function pathExists3(target) {
|
|
56008
56478
|
try {
|
|
@@ -56015,7 +56485,7 @@ async function pathExists3(target) {
|
|
|
56015
56485
|
var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
|
|
56016
56486
|
async function uninstallCodex(options = {}) {
|
|
56017
56487
|
const codexHome = resolveCodexHome2(options);
|
|
56018
|
-
const configPath =
|
|
56488
|
+
const configPath = import_node_path21.default.join(codexHome, "config.toml");
|
|
56019
56489
|
const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
|
|
56020
56490
|
if (!await pathExists3(configPath)) {
|
|
56021
56491
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
@@ -56043,10 +56513,10 @@ async function uninstallCodex(options = {}) {
|
|
|
56043
56513
|
}
|
|
56044
56514
|
async function uninstallPrompts(codexHome, names) {
|
|
56045
56515
|
if (names.length === 0) return [];
|
|
56046
|
-
const promptsDir =
|
|
56516
|
+
const promptsDir = import_node_path21.default.join(codexHome, "prompts");
|
|
56047
56517
|
const out = [];
|
|
56048
56518
|
for (const name of names) {
|
|
56049
|
-
const promptPath =
|
|
56519
|
+
const promptPath = import_node_path21.default.join(promptsDir, `${name}.md`);
|
|
56050
56520
|
try {
|
|
56051
56521
|
await import_promises4.default.unlink(promptPath);
|
|
56052
56522
|
out.push({ name, action: "removed", promptPath });
|
|
@@ -56299,8 +56769,8 @@ async function main() {
|
|
|
56299
56769
|
}
|
|
56300
56770
|
}
|
|
56301
56771
|
try {
|
|
56302
|
-
const codexHome = process.env.CODEX_HOME ??
|
|
56303
|
-
(0,
|
|
56772
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path23.default.join(process.env.HOME ?? (0, import_node_os12.homedir)(), ".codex");
|
|
56773
|
+
(0, import_node_fs15.rmSync)(import_node_path23.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
56304
56774
|
} catch {
|
|
56305
56775
|
}
|
|
56306
56776
|
return;
|
|
@@ -56330,8 +56800,8 @@ async function main() {
|
|
|
56330
56800
|
env: process.env,
|
|
56331
56801
|
cwd: process.cwd(),
|
|
56332
56802
|
writeFile: (p, c) => {
|
|
56333
|
-
(0,
|
|
56334
|
-
(0,
|
|
56803
|
+
(0, import_node_fs15.mkdirSync)(import_node_path23.default.dirname(p), { recursive: true, mode: 448 });
|
|
56804
|
+
(0, import_node_fs15.writeFileSync)(p, c, { mode: 384 });
|
|
56335
56805
|
},
|
|
56336
56806
|
runPm2: pm2Runner,
|
|
56337
56807
|
which: whichBin,
|
|
@@ -56348,35 +56818,35 @@ async function main() {
|
|
|
56348
56818
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
56349
56819
|
removeFile: (p) => {
|
|
56350
56820
|
try {
|
|
56351
|
-
(0,
|
|
56821
|
+
(0, import_node_fs15.rmSync)(p, { force: true });
|
|
56352
56822
|
} catch {
|
|
56353
56823
|
}
|
|
56354
56824
|
},
|
|
56355
56825
|
purgeSecret: purge,
|
|
56356
56826
|
secretPath: agentCredentialPath(),
|
|
56357
56827
|
tokenPath: operatorTokenPath(),
|
|
56358
|
-
ecoPath:
|
|
56828
|
+
ecoPath: import_node_path23.default.join(process.env.HOME ?? (0, import_node_os12.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
56359
56829
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
56360
56830
|
`)
|
|
56361
56831
|
});
|
|
56362
56832
|
return;
|
|
56363
56833
|
}
|
|
56364
56834
|
case "uninstall": {
|
|
56365
|
-
const home = process.env.HOME ?? (0,
|
|
56835
|
+
const home = process.env.HOME ?? (0, import_node_os12.homedir)();
|
|
56366
56836
|
const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
|
|
56367
56837
|
`);
|
|
56368
56838
|
uninstallService({
|
|
56369
56839
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
56370
56840
|
removeFile: (p) => {
|
|
56371
56841
|
try {
|
|
56372
|
-
(0,
|
|
56842
|
+
(0, import_node_fs15.rmSync)(p, { force: true });
|
|
56373
56843
|
} catch {
|
|
56374
56844
|
}
|
|
56375
56845
|
},
|
|
56376
56846
|
purgeSecret: true,
|
|
56377
56847
|
secretPath: agentCredentialPath(),
|
|
56378
56848
|
tokenPath: operatorTokenPath(),
|
|
56379
|
-
ecoPath:
|
|
56849
|
+
ecoPath: import_node_path23.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
|
|
56380
56850
|
log
|
|
56381
56851
|
});
|
|
56382
56852
|
let codexOk = true;
|
|
@@ -56396,7 +56866,7 @@ async function main() {
|
|
|
56396
56866
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
56397
56867
|
}
|
|
56398
56868
|
try {
|
|
56399
|
-
(0,
|
|
56869
|
+
(0, import_node_fs15.rmSync)(import_node_path23.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
56400
56870
|
} catch {
|
|
56401
56871
|
}
|
|
56402
56872
|
log("removed ~/.mrrlin");
|
|
@@ -56437,7 +56907,7 @@ ${HELP_TEXT}`);
|
|
|
56437
56907
|
}
|
|
56438
56908
|
}
|
|
56439
56909
|
function resolveSelfBinPath() {
|
|
56440
|
-
return
|
|
56910
|
+
return import_node_path22.default.resolve(process.argv[1] ?? process.execPath);
|
|
56441
56911
|
}
|
|
56442
56912
|
main().catch((error51) => {
|
|
56443
56913
|
process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
|