@mrrlin-dev/mcp 0.3.48 → 0.3.51
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 +826 -556
- package/package.json +3 -3
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 import_node_path21 = __toESM(require("node:path"), 1);
|
|
20648
|
-
var import_node_child_process13 = require("node:child_process");
|
|
20649
|
-
var import_node_fs14 = require("node:fs");
|
|
20650
|
-
var import_node_os11 = require("node:os");
|
|
20651
20647
|
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
20648
|
+
var import_node_child_process13 = require("node:child_process");
|
|
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
|
}
|
|
@@ -36722,15 +36855,6 @@ var SUPPORTED_EXECUTION_POLICY_BY_DOMAIN = {
|
|
|
36722
36855
|
content: { lane: "low_risk_non_code", supported: true }
|
|
36723
36856
|
};
|
|
36724
36857
|
var SUPPORTED_EXECUTION_DOMAINS = Object.keys(SUPPORTED_EXECUTION_POLICY_BY_DOMAIN);
|
|
36725
|
-
function resolveExecutionDomainPolicy(domain2) {
|
|
36726
|
-
return SUPPORTED_EXECUTION_POLICY_BY_DOMAIN[domain2] ?? {
|
|
36727
|
-
lane: "unsupported",
|
|
36728
|
-
supported: false
|
|
36729
|
-
};
|
|
36730
|
-
}
|
|
36731
|
-
function isExecutionDomainSupported(domain2) {
|
|
36732
|
-
return resolveExecutionDomainPolicy(domain2).supported;
|
|
36733
|
-
}
|
|
36734
36858
|
var taxonomyCategorySchema = external_exports.string().min(1).regex(/^[a-z][a-z0-9-]*$/);
|
|
36735
36859
|
var taxonomySubcategorySchema = external_exports.string().min(1).regex(/^[a-z][a-z0-9-]*$/);
|
|
36736
36860
|
var mrrlinTaskAssigneeSchema = external_exports.union([external_exports.string().regex(/^@/), external_exports.string().email()]).nullable();
|
|
@@ -37551,6 +37675,13 @@ var mrrlinAutonomousStepSchema = external_exports.enum([
|
|
|
37551
37675
|
"needs_human",
|
|
37552
37676
|
"enqueue_spec_draft",
|
|
37553
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",
|
|
37554
37685
|
"auto_approve_spec_and_run",
|
|
37555
37686
|
"create_execution_run"
|
|
37556
37687
|
]);
|
|
@@ -37566,8 +37697,7 @@ var mrrlinAutonomousStepReasonSchema = external_exports.enum([
|
|
|
37566
37697
|
"awaiting_clarification",
|
|
37567
37698
|
"consensus_blocked",
|
|
37568
37699
|
"consensus_disabled_spec_not_ready",
|
|
37569
|
-
"spec_approval_pending"
|
|
37570
|
-
"non_code_execution_unsupported"
|
|
37700
|
+
"spec_approval_pending"
|
|
37571
37701
|
]);
|
|
37572
37702
|
var mrrlinAutonomousStepVerdictSchema = external_exports.object({
|
|
37573
37703
|
step: mrrlinAutonomousStepSchema,
|
|
@@ -37925,18 +38055,18 @@ function createMrrlinClient(config2) {
|
|
|
37925
38055
|
const customFetch = config2.fetch ?? globalThis.fetch;
|
|
37926
38056
|
const baseUrl = config2.baseUrl.replace(/\/$/, "");
|
|
37927
38057
|
const token = config2.token;
|
|
37928
|
-
async function request(
|
|
38058
|
+
async function request(path18, init) {
|
|
37929
38059
|
const method = init?.method ?? "GET";
|
|
37930
38060
|
const headers = new Headers(init?.headers ?? {});
|
|
37931
38061
|
if (token && !headers.has("authorization")) {
|
|
37932
38062
|
headers.set("authorization", `Bearer ${token}`);
|
|
37933
38063
|
}
|
|
37934
|
-
const response = await customFetch(`${baseUrl}${
|
|
38064
|
+
const response = await customFetch(`${baseUrl}${path18}`, { ...init, headers });
|
|
37935
38065
|
if (!response.ok) {
|
|
37936
38066
|
const body = await response.text();
|
|
37937
38067
|
let code = `HTTP_${response.status}`;
|
|
37938
38068
|
let violations = null;
|
|
37939
|
-
let message = `Mrrlin API ${method} ${
|
|
38069
|
+
let message = `Mrrlin API ${method} ${path18} failed: ${response.status}`;
|
|
37940
38070
|
try {
|
|
37941
38071
|
const parsed = JSON.parse(body);
|
|
37942
38072
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -37956,7 +38086,7 @@ function createMrrlinClient(config2) {
|
|
|
37956
38086
|
throw new MrrlinApiError({
|
|
37957
38087
|
code,
|
|
37958
38088
|
method,
|
|
37959
|
-
path:
|
|
38089
|
+
path: path18,
|
|
37960
38090
|
responseBody: body,
|
|
37961
38091
|
status: response.status,
|
|
37962
38092
|
violations,
|
|
@@ -38211,7 +38341,7 @@ function createMrrlinClient(config2) {
|
|
|
38211
38341
|
return taskEventListResponseSchema.parse(body).data;
|
|
38212
38342
|
},
|
|
38213
38343
|
async listTasks(projectSlug, filters = {}) {
|
|
38214
|
-
const
|
|
38344
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
|
|
38215
38345
|
assignee: filters.assignee,
|
|
38216
38346
|
autonomyLevel: filters.autonomyLevel,
|
|
38217
38347
|
blockedBy: filters.blockedBy,
|
|
@@ -38223,7 +38353,7 @@ function createMrrlinClient(config2) {
|
|
|
38223
38353
|
subcategory: filters.subcategory,
|
|
38224
38354
|
type: filters.type
|
|
38225
38355
|
});
|
|
38226
|
-
const body = await request(
|
|
38356
|
+
const body = await request(path18);
|
|
38227
38357
|
return taskListResponseSchema.parse(body).data;
|
|
38228
38358
|
},
|
|
38229
38359
|
async listTaxonomy(projectSlug) {
|
|
@@ -38231,22 +38361,22 @@ function createMrrlinClient(config2) {
|
|
|
38231
38361
|
return taxonomyListResponseSchema.parse(body).data;
|
|
38232
38362
|
},
|
|
38233
38363
|
async listWikiPages(projectSlug, filters = {}) {
|
|
38234
|
-
const
|
|
38364
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
|
|
38235
38365
|
folder: filters.folder,
|
|
38236
38366
|
q: filters.q,
|
|
38237
38367
|
taskId: filters.taskId
|
|
38238
38368
|
});
|
|
38239
|
-
const body = await request(
|
|
38369
|
+
const body = await request(path18);
|
|
38240
38370
|
return wikiPageListResponseSchema.parse(body).data;
|
|
38241
38371
|
},
|
|
38242
38372
|
async searchWikiPages(projectSlug, query) {
|
|
38243
|
-
const
|
|
38373
|
+
const path18 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
|
|
38244
38374
|
folder: query.folder,
|
|
38245
38375
|
limit: query.limit === void 0 ? void 0 : String(query.limit),
|
|
38246
38376
|
pathPrefix: query.pathPrefix,
|
|
38247
38377
|
q: query.q
|
|
38248
38378
|
});
|
|
38249
|
-
const body = await request(
|
|
38379
|
+
const body = await request(path18);
|
|
38250
38380
|
return wikiPageSearchResponseSchema.parse(body).data;
|
|
38251
38381
|
},
|
|
38252
38382
|
async updatePlan(projectSlug, planId, patch) {
|
|
@@ -39129,73 +39259,257 @@ function startCodexProbe(deps = {}) {
|
|
|
39129
39259
|
}
|
|
39130
39260
|
|
|
39131
39261
|
// src/_generated/version.ts
|
|
39132
|
-
var PKG_VERSION = "0.3.
|
|
39262
|
+
var PKG_VERSION = "0.3.51";
|
|
39133
39263
|
|
|
39134
|
-
// src/api-base-url.ts
|
|
39135
|
-
var
|
|
39136
|
-
var
|
|
39137
|
-
|
|
39138
|
-
|
|
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/");
|
|
39139
39274
|
}
|
|
39140
|
-
function
|
|
39141
|
-
|
|
39142
|
-
|
|
39143
|
-
|
|
39144
|
-
|
|
39145
|
-
|
|
39146
|
-
|
|
39147
|
-
return false;
|
|
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
|
+
};
|
|
39148
39282
|
}
|
|
39283
|
+
return { ok: true, cwd: chosen };
|
|
39149
39284
|
}
|
|
39150
|
-
|
|
39151
|
-
|
|
39152
|
-
|
|
39153
|
-
|
|
39154
|
-
|
|
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
|
+
`;
|
|
39155
39314
|
}
|
|
39156
|
-
|
|
39157
|
-
|
|
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
|
+
};
|
|
39158
39335
|
}
|
|
39159
|
-
function
|
|
39160
|
-
|
|
39161
|
-
return Number.isFinite(raw) && raw > 0 ? raw : 500;
|
|
39336
|
+
function findRetiredHost(text) {
|
|
39337
|
+
return retiredApiHostnames().find((host) => text.toLowerCase().includes(host));
|
|
39162
39338
|
}
|
|
39163
|
-
|
|
39164
|
-
|
|
39165
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
39339
|
+
function isRetiredApiUrl(value) {
|
|
39340
|
+
if (!value?.trim()) return false;
|
|
39166
39341
|
try {
|
|
39167
|
-
|
|
39168
|
-
return res.ok;
|
|
39342
|
+
return retiredApiHostnames().includes(new URL(value.trim()).hostname.toLowerCase());
|
|
39169
39343
|
} catch {
|
|
39170
39344
|
return false;
|
|
39171
|
-
} finally {
|
|
39172
|
-
clearTimeout(timer);
|
|
39173
39345
|
}
|
|
39174
39346
|
}
|
|
39175
|
-
|
|
39176
|
-
const
|
|
39177
|
-
|
|
39178
|
-
|
|
39179
|
-
|
|
39180
|
-
|
|
39181
|
-
const
|
|
39182
|
-
if (
|
|
39183
|
-
|
|
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
|
+
}
|
|
39184
39387
|
}
|
|
39185
|
-
|
|
39186
|
-
|
|
39187
|
-
|
|
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
|
+
};
|
|
39403
|
+
}
|
|
39404
|
+
function renderEcosystemConfigLegacy(opts) {
|
|
39405
|
+
return renderEcosystemConfigWithEnv(opts, { MRRLIN_API_BASE_URL: opts.apiBaseUrl });
|
|
39406
|
+
}
|
|
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
|
+
`;
|
|
39433
|
+
}
|
|
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 });
|
|
39188
39493
|
}
|
|
39189
|
-
return { baseUrl: STAGING_API_BASE_URL, source: "staging-autodetect" };
|
|
39190
39494
|
}
|
|
39191
|
-
|
|
39192
|
-
|
|
39193
|
-
|
|
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;
|
|
39194
39508
|
}
|
|
39195
39509
|
|
|
39196
39510
|
// src/bridge-health.ts
|
|
39197
|
-
var
|
|
39198
|
-
var
|
|
39511
|
+
var import_node_fs3 = require("node:fs");
|
|
39512
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
39199
39513
|
var SENTINEL_FILE_NAME = "bridge-health-circuit-breaker.json";
|
|
39200
39514
|
var CRASH_WINDOW_MS = 60 * 60 * 1e3;
|
|
39201
39515
|
var MAX_CRASHES_PER_WINDOW = 3;
|
|
@@ -39207,9 +39521,9 @@ function isCrashSentinel(value) {
|
|
|
39207
39521
|
return typeof candidate.crashCount === "number" && Number.isInteger(candidate.crashCount) && candidate.crashCount >= 0 && typeof candidate.windowStartedAt === "string";
|
|
39208
39522
|
}
|
|
39209
39523
|
async function readCrashSentinel(stateDir, now = Date.now) {
|
|
39210
|
-
const sentinelPath =
|
|
39524
|
+
const sentinelPath = import_node_path6.default.join(stateDir, SENTINEL_FILE_NAME);
|
|
39211
39525
|
try {
|
|
39212
|
-
const raw = await
|
|
39526
|
+
const raw = await import_node_fs3.promises.readFile(sentinelPath, "utf8");
|
|
39213
39527
|
const parsed = JSON.parse(raw);
|
|
39214
39528
|
if (isCrashSentinel(parsed)) return parsed;
|
|
39215
39529
|
} catch {
|
|
@@ -39217,11 +39531,11 @@ async function readCrashSentinel(stateDir, now = Date.now) {
|
|
|
39217
39531
|
return { crashCount: 0, windowStartedAt: new Date(now()).toISOString() };
|
|
39218
39532
|
}
|
|
39219
39533
|
async function writeCrashSentinel(stateDir, sentinel) {
|
|
39220
|
-
await
|
|
39221
|
-
const sentinelPath =
|
|
39534
|
+
await import_node_fs3.promises.mkdir(stateDir, { recursive: true });
|
|
39535
|
+
const sentinelPath = import_node_path6.default.join(stateDir, SENTINEL_FILE_NAME);
|
|
39222
39536
|
const tmpPath = `${sentinelPath}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
39223
|
-
await
|
|
39224
|
-
await
|
|
39537
|
+
await import_node_fs3.promises.writeFile(tmpPath, JSON.stringify(sentinel), "utf8");
|
|
39538
|
+
await import_node_fs3.promises.rename(tmpPath, sentinelPath);
|
|
39225
39539
|
}
|
|
39226
39540
|
function withTimeout(fn, ms = DEFAULT_OPERATION_TIMEOUT_MS) {
|
|
39227
39541
|
const controller = new AbortController();
|
|
@@ -39685,7 +39999,7 @@ function startAgentPoolLoop(deps) {
|
|
|
39685
39999
|
// src/execution-consumer.ts
|
|
39686
40000
|
var import_node_child_process9 = require("node:child_process");
|
|
39687
40001
|
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
39688
|
-
var
|
|
40002
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
39689
40003
|
var import_node_util = require("node:util");
|
|
39690
40004
|
|
|
39691
40005
|
// src/consensus/heads.ts
|
|
@@ -39706,9 +40020,6 @@ function normalizeDomain(value) {
|
|
|
39706
40020
|
function resolveHeads(domain2) {
|
|
39707
40021
|
return [...HEADS_BY_DOMAIN[normalizeDomain(domain2)]];
|
|
39708
40022
|
}
|
|
39709
|
-
function allReviewHeads() {
|
|
39710
|
-
return [...new Set(Object.values(HEADS_BY_DOMAIN).flat())];
|
|
39711
|
-
}
|
|
39712
40023
|
var PERSONAS_BY_DOMAIN = {
|
|
39713
40024
|
seo: "seo-writer",
|
|
39714
40025
|
content: "content-author",
|
|
@@ -39722,8 +40033,8 @@ function resolveProducerPersona(domain2) {
|
|
|
39722
40033
|
|
|
39723
40034
|
// src/consensus/wiring.ts
|
|
39724
40035
|
var import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
39725
|
-
var
|
|
39726
|
-
var
|
|
40036
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
40037
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
39727
40038
|
var import_node_url2 = require("node:url");
|
|
39728
40039
|
|
|
39729
40040
|
// src/consensus/codex-exec.ts
|
|
@@ -40142,15 +40453,15 @@ ${res.stdout}${res.stderr}`);
|
|
|
40142
40453
|
var import_meta2 = {};
|
|
40143
40454
|
function getPersonasDir() {
|
|
40144
40455
|
if (typeof __dirname !== "undefined") {
|
|
40145
|
-
return
|
|
40456
|
+
return import_node_path7.default.join(__dirname, "consensus", "personas");
|
|
40146
40457
|
}
|
|
40147
|
-
return
|
|
40458
|
+
return import_node_path7.default.join(import_node_path7.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)), "personas");
|
|
40148
40459
|
}
|
|
40149
40460
|
var personaCache = /* @__PURE__ */ new Map();
|
|
40150
40461
|
function loadPersona(name) {
|
|
40151
40462
|
const cached2 = personaCache.get(name);
|
|
40152
40463
|
if (cached2 !== void 0) return cached2;
|
|
40153
|
-
const content =
|
|
40464
|
+
const content = import_node_fs4.default.readFileSync(import_node_path7.default.join(getPersonasDir(), `${name}.md`), "utf8");
|
|
40154
40465
|
personaCache.set(name, content);
|
|
40155
40466
|
return content;
|
|
40156
40467
|
}
|
|
@@ -41341,18 +41652,18 @@ async function awaitTurnWithDeadline(opts) {
|
|
|
41341
41652
|
|
|
41342
41653
|
// src/worktree.ts
|
|
41343
41654
|
var import_node_child_process8 = require("node:child_process");
|
|
41344
|
-
var
|
|
41345
|
-
var
|
|
41346
|
-
var
|
|
41655
|
+
var import_node_fs6 = require("node:fs");
|
|
41656
|
+
var import_node_os4 = require("node:os");
|
|
41657
|
+
var import_node_path9 = require("node:path");
|
|
41347
41658
|
|
|
41348
41659
|
// src/checkout-lock.ts
|
|
41349
|
-
var
|
|
41350
|
-
var
|
|
41660
|
+
var import_node_fs5 = require("node:fs");
|
|
41661
|
+
var import_node_path8 = require("node:path");
|
|
41351
41662
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
41352
41663
|
async function withCheckoutLock(locksDir, slug, fn) {
|
|
41353
|
-
(0,
|
|
41354
|
-
const target = (0,
|
|
41355
|
-
if (!(0,
|
|
41664
|
+
(0, import_node_fs5.mkdirSync)(locksDir, { recursive: true });
|
|
41665
|
+
const target = (0, import_node_path8.join)(locksDir, `${slug}.lock`);
|
|
41666
|
+
if (!(0, import_node_fs5.existsSync)(target)) (0, import_node_fs5.writeFileSync)(target, "");
|
|
41356
41667
|
const release = await import_proper_lockfile.default.lock(target, {
|
|
41357
41668
|
retries: { retries: 600, factor: 1, minTimeout: 100, maxTimeout: 100 },
|
|
41358
41669
|
stale: 5 * 6e4
|
|
@@ -41377,12 +41688,12 @@ function git(checkout, args) {
|
|
|
41377
41688
|
});
|
|
41378
41689
|
}
|
|
41379
41690
|
async function createRunWorktree(opts) {
|
|
41380
|
-
const worktreePath = (0,
|
|
41691
|
+
const worktreePath = (0, import_node_path9.join)(opts.worktreeRoot, opts.slug, opts.runId);
|
|
41381
41692
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
41382
|
-
(0,
|
|
41693
|
+
(0, import_node_fs6.mkdirSync)(opts.worktreeRoot, { recursive: true });
|
|
41383
41694
|
try {
|
|
41384
41695
|
git(opts.checkout, ["fetch", "origin", opts.defaultBranch]);
|
|
41385
|
-
if (!(0,
|
|
41696
|
+
if (!(0, import_node_fs6.existsSync)(worktreePath)) {
|
|
41386
41697
|
git(opts.checkout, [
|
|
41387
41698
|
"worktree",
|
|
41388
41699
|
"add",
|
|
@@ -41440,15 +41751,15 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
41440
41751
|
if (localConfig.trim()) {
|
|
41441
41752
|
throw new Error(`push aborted: agent-controlled git config present in worktree: ${localConfig.trim().split("\n")[0]}`);
|
|
41442
41753
|
}
|
|
41443
|
-
const dir = (0,
|
|
41444
|
-
const askpass = (0,
|
|
41754
|
+
const dir = (0, import_node_fs6.mkdtempSync)((0, import_node_path9.join)((0, import_node_os4.tmpdir)(), "mrrlin-push-"));
|
|
41755
|
+
const askpass = (0, import_node_path9.join)(dir, "askpass");
|
|
41445
41756
|
try {
|
|
41446
|
-
(0,
|
|
41757
|
+
(0, import_node_fs6.writeFileSync)(
|
|
41447
41758
|
askpass,
|
|
41448
41759
|
'#!/bin/sh\ncase "$1" in *[Uu]sername*) printf %s "x-access-token" ;; *) printf %s "$MRRLIN_PUSH_TOKEN" ;; esac\n',
|
|
41449
41760
|
{ mode: 320 }
|
|
41450
41761
|
);
|
|
41451
|
-
(0,
|
|
41762
|
+
(0, import_node_fs6.chmodSync)(askpass, 320);
|
|
41452
41763
|
execGit(
|
|
41453
41764
|
[
|
|
41454
41765
|
"-C",
|
|
@@ -41467,18 +41778,18 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
41467
41778
|
);
|
|
41468
41779
|
return { pushedSha: localSha };
|
|
41469
41780
|
} finally {
|
|
41470
|
-
(0,
|
|
41781
|
+
(0, import_node_fs6.rmSync)(dir, { recursive: true, force: true });
|
|
41471
41782
|
}
|
|
41472
41783
|
}
|
|
41473
41784
|
async function sweepOrphanWorktrees(opts) {
|
|
41474
41785
|
const reaped = [];
|
|
41475
41786
|
const ownedPrefix = (() => {
|
|
41476
41787
|
try {
|
|
41477
|
-
return (0,
|
|
41788
|
+
return (0, import_node_fs6.realpathSync)(opts.worktreeRoot);
|
|
41478
41789
|
} catch {
|
|
41479
41790
|
return opts.worktreeRoot;
|
|
41480
41791
|
}
|
|
41481
|
-
})() +
|
|
41792
|
+
})() + import_node_path9.sep + opts.slug + import_node_path9.sep;
|
|
41482
41793
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
41483
41794
|
const listing = git(opts.checkout, ["worktree", "list", "--porcelain"]);
|
|
41484
41795
|
for (const block of listing.split("\n\n")) {
|
|
@@ -41739,8 +42050,8 @@ function newArtifactId() {
|
|
|
41739
42050
|
return `EA-${import_node_crypto4.default.randomUUID()}`;
|
|
41740
42051
|
}
|
|
41741
42052
|
var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
|
|
41742
|
-
function isBlastRadiusFloorPath(
|
|
41743
|
-
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(
|
|
42053
|
+
function isBlastRadiusFloorPath(path18) {
|
|
42054
|
+
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path18));
|
|
41744
42055
|
}
|
|
41745
42056
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process9.execFile);
|
|
41746
42057
|
async function defaultListRunDiffPaths(opts) {
|
|
@@ -42365,17 +42676,6 @@ async function writeDeliverablePage(client, projectSlug, task, markdown) {
|
|
|
42365
42676
|
throw new Error(`could not allocate a deliverable page id for ${task.id} (last conflict: ${lastConflict})`);
|
|
42366
42677
|
}
|
|
42367
42678
|
async function driveNonCodeRun(deps, projectSlug, runId, leaseId, task, domain2) {
|
|
42368
|
-
if (!isExecutionDomainSupported(domain2)) {
|
|
42369
|
-
await failRun(
|
|
42370
|
-
deps,
|
|
42371
|
-
projectSlug,
|
|
42372
|
-
task,
|
|
42373
|
-
runId,
|
|
42374
|
-
leaseId,
|
|
42375
|
-
`non_code_execution_unsupported: task ${task.id} domain "${domain2}" is not approved by the autonomous execution policy.`
|
|
42376
|
-
);
|
|
42377
|
-
return;
|
|
42378
|
-
}
|
|
42379
42679
|
const personaName = resolveProducerPersona(domain2);
|
|
42380
42680
|
if (!personaName) {
|
|
42381
42681
|
await failRun(
|
|
@@ -42702,8 +43002,8 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
|
|
|
42702
43002
|
function isRunRecoverableByThisBridge(run3, worktreeRoot) {
|
|
42703
43003
|
if (!worktreeRoot) return true;
|
|
42704
43004
|
if (!run3.worktreeId) return false;
|
|
42705
|
-
const relative =
|
|
42706
|
-
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !
|
|
43005
|
+
const relative = import_node_path10.default.relative(import_node_path10.default.resolve(worktreeRoot), import_node_path10.default.resolve(run3.worktreeId));
|
|
43006
|
+
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !import_node_path10.default.isAbsolute(relative);
|
|
42707
43007
|
}
|
|
42708
43008
|
async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId) {
|
|
42709
43009
|
await deps.client.updateExecutionRun(projectSlug, runId, { status: "failed", finishedAt: (/* @__PURE__ */ new Date()).toISOString(), leaseId: leaseId ?? void 0 }).catch(() => {
|
|
@@ -43167,19 +43467,19 @@ function codexIdleMs() {
|
|
|
43167
43467
|
}
|
|
43168
43468
|
|
|
43169
43469
|
// src/operator-token.ts
|
|
43170
|
-
var
|
|
43171
|
-
var
|
|
43172
|
-
var
|
|
43470
|
+
var import_node_fs7 = require("node:fs");
|
|
43471
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
43472
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
43173
43473
|
function operatorDir() {
|
|
43174
|
-
const base = process.env.CODEX_HOME ?
|
|
43474
|
+
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");
|
|
43175
43475
|
return base;
|
|
43176
43476
|
}
|
|
43177
43477
|
function operatorTokenPath() {
|
|
43178
|
-
return
|
|
43478
|
+
return import_node_path11.default.join(operatorDir(), "operator-token");
|
|
43179
43479
|
}
|
|
43180
43480
|
function readOperatorToken() {
|
|
43181
43481
|
try {
|
|
43182
|
-
const token = (0,
|
|
43482
|
+
const token = (0, import_node_fs7.readFileSync)(operatorTokenPath(), "utf8").trim();
|
|
43183
43483
|
return token.length > 0 ? token : null;
|
|
43184
43484
|
} catch {
|
|
43185
43485
|
return null;
|
|
@@ -43187,24 +43487,24 @@ function readOperatorToken() {
|
|
|
43187
43487
|
}
|
|
43188
43488
|
function persistOperatorToken(token) {
|
|
43189
43489
|
const dir = operatorDir();
|
|
43190
|
-
(0,
|
|
43191
|
-
(0,
|
|
43490
|
+
(0, import_node_fs7.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43491
|
+
(0, import_node_fs7.writeFileSync)(operatorTokenPath(), `${token.trim()}
|
|
43192
43492
|
`, { encoding: "utf8", mode: 384 });
|
|
43193
43493
|
}
|
|
43194
43494
|
function agentCredentialPath() {
|
|
43195
|
-
return
|
|
43495
|
+
return import_node_path11.default.join(operatorDir(), "agent-credential");
|
|
43196
43496
|
}
|
|
43197
43497
|
function persistAgentSecret(secret) {
|
|
43198
43498
|
const dir = operatorDir();
|
|
43199
|
-
(0,
|
|
43200
|
-
(0,
|
|
43499
|
+
(0, import_node_fs7.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43500
|
+
(0, import_node_fs7.writeFileSync)(agentCredentialPath(), `${secret.trim()}
|
|
43201
43501
|
`, { encoding: "utf8", mode: 384 });
|
|
43202
43502
|
}
|
|
43203
43503
|
function readAgentSecret() {
|
|
43204
43504
|
const fromEnv = process.env.MRRLIN_AGENT_SECRET?.trim();
|
|
43205
43505
|
if (fromEnv) return fromEnv;
|
|
43206
43506
|
try {
|
|
43207
|
-
const raw = (0,
|
|
43507
|
+
const raw = (0, import_node_fs7.readFileSync)(agentCredentialPath(), "utf8").trim();
|
|
43208
43508
|
return raw || void 0;
|
|
43209
43509
|
} catch {
|
|
43210
43510
|
return void 0;
|
|
@@ -43212,16 +43512,16 @@ function readAgentSecret() {
|
|
|
43212
43512
|
}
|
|
43213
43513
|
|
|
43214
43514
|
// src/thread-index.ts
|
|
43215
|
-
var
|
|
43216
|
-
var
|
|
43515
|
+
var import_node_fs8 = require("node:fs");
|
|
43516
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
43217
43517
|
function threadIndexPath(stateDir) {
|
|
43218
|
-
return
|
|
43518
|
+
return import_node_path12.default.join(stateDir, "threads.json");
|
|
43219
43519
|
}
|
|
43220
43520
|
function loadThreadIndex(stateDir, ttlMs, now) {
|
|
43221
43521
|
const result = /* @__PURE__ */ new Map();
|
|
43222
43522
|
let parsed;
|
|
43223
43523
|
try {
|
|
43224
|
-
parsed = JSON.parse((0,
|
|
43524
|
+
parsed = JSON.parse((0, import_node_fs8.readFileSync)(threadIndexPath(stateDir), "utf8"));
|
|
43225
43525
|
} catch {
|
|
43226
43526
|
return result;
|
|
43227
43527
|
}
|
|
@@ -43243,8 +43543,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
|
|
|
43243
43543
|
return result;
|
|
43244
43544
|
}
|
|
43245
43545
|
function saveThreadIndex(stateDir, entries) {
|
|
43246
|
-
(0,
|
|
43247
|
-
(0,
|
|
43546
|
+
(0, import_node_fs8.mkdirSync)(stateDir, { recursive: true, mode: 448 });
|
|
43547
|
+
(0, import_node_fs8.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
|
|
43248
43548
|
`, {
|
|
43249
43549
|
encoding: "utf8",
|
|
43250
43550
|
mode: 384
|
|
@@ -43330,9 +43630,9 @@ function chatTurnMaxMs() {
|
|
|
43330
43630
|
|
|
43331
43631
|
// src/worker-token.ts
|
|
43332
43632
|
var import_node_crypto6 = require("node:crypto");
|
|
43333
|
-
var
|
|
43334
|
-
var
|
|
43335
|
-
var
|
|
43633
|
+
var import_node_fs9 = require("node:fs");
|
|
43634
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
43635
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
43336
43636
|
var DEFAULT_WORKER_PORT = 8792;
|
|
43337
43637
|
function workerPort() {
|
|
43338
43638
|
const raw = process.env.MRRLIN_WORKER_PORT;
|
|
@@ -43341,15 +43641,15 @@ function workerPort() {
|
|
|
43341
43641
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
|
|
43342
43642
|
}
|
|
43343
43643
|
function workerDir() {
|
|
43344
|
-
const base = process.env.CODEX_HOME ?
|
|
43345
|
-
return
|
|
43644
|
+
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");
|
|
43645
|
+
return import_node_path13.default.join(base, "worker");
|
|
43346
43646
|
}
|
|
43347
43647
|
function workerTokenPath() {
|
|
43348
|
-
return
|
|
43648
|
+
return import_node_path13.default.join(workerDir(), "token");
|
|
43349
43649
|
}
|
|
43350
43650
|
function readWorkerToken() {
|
|
43351
43651
|
try {
|
|
43352
|
-
const token = (0,
|
|
43652
|
+
const token = (0, import_node_fs9.readFileSync)(workerTokenPath(), "utf8").trim();
|
|
43353
43653
|
return token.length > 0 ? token : null;
|
|
43354
43654
|
} catch {
|
|
43355
43655
|
return null;
|
|
@@ -43359,18 +43659,18 @@ function readOrCreateWorkerToken() {
|
|
|
43359
43659
|
const existing = readWorkerToken();
|
|
43360
43660
|
if (existing) return existing;
|
|
43361
43661
|
const dir = workerDir();
|
|
43362
|
-
(0,
|
|
43662
|
+
(0, import_node_fs9.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
43363
43663
|
const token = (0, import_node_crypto6.randomBytes)(32).toString("hex");
|
|
43364
|
-
(0,
|
|
43664
|
+
(0, import_node_fs9.writeFileSync)(workerTokenPath(), `${token}
|
|
43365
43665
|
`, { encoding: "utf8", mode: 384 });
|
|
43366
43666
|
return token;
|
|
43367
43667
|
}
|
|
43368
43668
|
|
|
43369
43669
|
// src/remote-phone-relay.ts
|
|
43370
43670
|
var import_node_events2 = require("node:events");
|
|
43371
|
-
var
|
|
43372
|
-
var
|
|
43373
|
-
var
|
|
43671
|
+
var import_node_fs10 = require("node:fs");
|
|
43672
|
+
var import_node_os7 = require("node:os");
|
|
43673
|
+
var import_node_path14 = require("node:path");
|
|
43374
43674
|
|
|
43375
43675
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
43376
43676
|
var nc = __toESM(require("node:crypto"), 1);
|
|
@@ -46941,9 +47241,9 @@ var DirectorRelay = class {
|
|
|
46941
47241
|
|
|
46942
47242
|
// src/remote-phone-relay.ts
|
|
46943
47243
|
function loadOrCreateAgentDeviceKey() {
|
|
46944
|
-
const
|
|
47244
|
+
const path18 = (0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin", "agent-device-key");
|
|
46945
47245
|
try {
|
|
46946
|
-
const raw = JSON.parse((0,
|
|
47246
|
+
const raw = JSON.parse((0, import_node_fs10.readFileSync)(path18, "utf8"));
|
|
46947
47247
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
46948
47248
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
46949
47249
|
}
|
|
@@ -46951,9 +47251,9 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46951
47251
|
}
|
|
46952
47252
|
const kp = generateIdentityKeyPair();
|
|
46953
47253
|
try {
|
|
46954
|
-
(0,
|
|
46955
|
-
(0,
|
|
46956
|
-
|
|
47254
|
+
(0, import_node_fs10.mkdirSync)((0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin"), { recursive: true });
|
|
47255
|
+
(0, import_node_fs10.writeFileSync)(
|
|
47256
|
+
path18,
|
|
46957
47257
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
46958
47258
|
{ mode: 384 }
|
|
46959
47259
|
);
|
|
@@ -46961,10 +47261,10 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46961
47261
|
}
|
|
46962
47262
|
return kp;
|
|
46963
47263
|
}
|
|
46964
|
-
var AGENT_PAIRING_PATH = (0,
|
|
47264
|
+
var AGENT_PAIRING_PATH = (0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
46965
47265
|
function loadAgentPairing() {
|
|
46966
47266
|
try {
|
|
46967
|
-
const raw = JSON.parse((0,
|
|
47267
|
+
const raw = JSON.parse((0, import_node_fs10.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
46968
47268
|
if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
|
|
46969
47269
|
return {
|
|
46970
47270
|
channelId: raw.channelId,
|
|
@@ -46979,8 +47279,8 @@ function loadAgentPairing() {
|
|
|
46979
47279
|
}
|
|
46980
47280
|
function saveAgentPairing(record2) {
|
|
46981
47281
|
try {
|
|
46982
|
-
(0,
|
|
46983
|
-
(0,
|
|
47282
|
+
(0, import_node_fs10.mkdirSync)((0, import_node_path14.join)((0, import_node_os7.homedir)(), ".mrrlin"), { recursive: true });
|
|
47283
|
+
(0, import_node_fs10.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
46984
47284
|
} catch {
|
|
46985
47285
|
}
|
|
46986
47286
|
}
|
|
@@ -47157,18 +47457,18 @@ async function renderPairingQrSvg(payload) {
|
|
|
47157
47457
|
}
|
|
47158
47458
|
|
|
47159
47459
|
// src/checkout-registry.ts
|
|
47160
|
-
var
|
|
47161
|
-
var
|
|
47460
|
+
var import_node_fs11 = require("node:fs");
|
|
47461
|
+
var import_node_path15 = require("node:path");
|
|
47162
47462
|
var CheckoutRegistry = class {
|
|
47163
47463
|
file;
|
|
47164
47464
|
constructor(stateDir) {
|
|
47165
|
-
this.file = (0,
|
|
47166
|
-
(0,
|
|
47465
|
+
this.file = (0, import_node_path15.join)(stateDir, "checkouts.json");
|
|
47466
|
+
(0, import_node_fs11.mkdirSync)(stateDir, { recursive: true });
|
|
47167
47467
|
}
|
|
47168
47468
|
read() {
|
|
47169
|
-
if (!(0,
|
|
47469
|
+
if (!(0, import_node_fs11.existsSync)(this.file)) return {};
|
|
47170
47470
|
try {
|
|
47171
|
-
return JSON.parse((0,
|
|
47471
|
+
return JSON.parse((0, import_node_fs11.readFileSync)(this.file, "utf8"));
|
|
47172
47472
|
} catch {
|
|
47173
47473
|
return {};
|
|
47174
47474
|
}
|
|
@@ -47176,10 +47476,10 @@ var CheckoutRegistry = class {
|
|
|
47176
47476
|
get(slug) {
|
|
47177
47477
|
return this.read()[slug] ?? null;
|
|
47178
47478
|
}
|
|
47179
|
-
confirm(slug,
|
|
47479
|
+
confirm(slug, path18, now) {
|
|
47180
47480
|
const all = this.read();
|
|
47181
|
-
all[slug] = { path:
|
|
47182
|
-
(0,
|
|
47481
|
+
all[slug] = { path: path18, confirmedAt: now };
|
|
47482
|
+
(0, import_node_fs11.writeFileSync)(this.file, JSON.stringify(all, null, 2));
|
|
47183
47483
|
}
|
|
47184
47484
|
};
|
|
47185
47485
|
|
|
@@ -47390,8 +47690,8 @@ function extractVerificationSection(markdown) {
|
|
|
47390
47690
|
}
|
|
47391
47691
|
|
|
47392
47692
|
// src/bridge-log.ts
|
|
47393
|
-
var
|
|
47394
|
-
var
|
|
47693
|
+
var import_node_fs12 = require("node:fs");
|
|
47694
|
+
var import_node_path16 = require("node:path");
|
|
47395
47695
|
|
|
47396
47696
|
// src/redact.ts
|
|
47397
47697
|
var REDACTED = "[REDACTED]";
|
|
@@ -47476,14 +47776,14 @@ function resolvePromptsEnabled(env) {
|
|
|
47476
47776
|
}
|
|
47477
47777
|
function createBridgeLogger(stateDir, env = process.env) {
|
|
47478
47778
|
if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
|
|
47479
|
-
const logsDir = (0,
|
|
47779
|
+
const logsDir = (0, import_node_path16.join)(stateDir, "logs");
|
|
47480
47780
|
try {
|
|
47481
|
-
(0,
|
|
47781
|
+
(0, import_node_fs12.mkdirSync)(logsDir, { recursive: true });
|
|
47482
47782
|
} catch {
|
|
47483
47783
|
return NOOP_LOGGER;
|
|
47484
47784
|
}
|
|
47485
47785
|
const includePrompts = resolvePromptsEnabled(env);
|
|
47486
|
-
const fileFor = () => (0,
|
|
47786
|
+
const fileFor = () => (0, import_node_path16.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
|
|
47487
47787
|
const write = (dir, rec) => {
|
|
47488
47788
|
try {
|
|
47489
47789
|
const line = JSON.stringify({
|
|
@@ -47495,7 +47795,7 @@ function createBridgeLogger(stateDir, env = process.env) {
|
|
|
47495
47795
|
...rec.ms !== void 0 ? { ms: rec.ms } : {},
|
|
47496
47796
|
payload: redactMessage(rec.payload, { includePrompts })
|
|
47497
47797
|
}) + "\n";
|
|
47498
|
-
(0,
|
|
47798
|
+
(0, import_node_fs12.appendFileSync)(fileFor(), line);
|
|
47499
47799
|
} catch {
|
|
47500
47800
|
}
|
|
47501
47801
|
};
|
|
@@ -47513,10 +47813,9 @@ var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
|
47513
47813
|
"http://localhost:*",
|
|
47514
47814
|
"http://127.0.0.1:*",
|
|
47515
47815
|
"http://[::1]:*",
|
|
47516
|
-
// Staging Vercel team migrated 2026-07-28 (see docs/reference/deployments.md)
|
|
47517
|
-
// fnnzzz-fnnzzzs-projects alias
|
|
47816
|
+
// Staging Vercel team migrated 2026-07-28 (see docs/reference/deployments.md). The prior
|
|
47817
|
+
// fnnzzz-fnnzzzs-projects web alias was dropped once no operator was left on an old build.
|
|
47518
47818
|
"https://mrrlin-web-mrrlin2.vercel.app",
|
|
47519
|
-
"https://mrrlin-web-fnnzzz-fnnzzzs-projects.vercel.app",
|
|
47520
47819
|
"https://app.mrrlin.dev",
|
|
47521
47820
|
"https://mrrlin-web.vercel.app"
|
|
47522
47821
|
];
|
|
@@ -47565,7 +47864,7 @@ function addBridgeModel(target, model) {
|
|
|
47565
47864
|
}
|
|
47566
47865
|
function readTextIfExists(filePath) {
|
|
47567
47866
|
try {
|
|
47568
|
-
return
|
|
47867
|
+
return import_node_fs13.default.readFileSync(filePath, "utf8");
|
|
47569
47868
|
} catch {
|
|
47570
47869
|
return null;
|
|
47571
47870
|
}
|
|
@@ -47576,9 +47875,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
47576
47875
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
47577
47876
|
}
|
|
47578
47877
|
function readCodexFallbackModels() {
|
|
47579
|
-
const codexHome = process.env.CODEX_HOME?.trim() ||
|
|
47878
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path17.default.join(import_node_os8.default.homedir(), ".codex");
|
|
47580
47879
|
const models = /* @__PURE__ */ new Map();
|
|
47581
|
-
const cachePath =
|
|
47880
|
+
const cachePath = import_node_path17.default.join(codexHome, "models_cache.json");
|
|
47582
47881
|
const cacheRaw = readTextIfExists(cachePath);
|
|
47583
47882
|
if (cacheRaw) {
|
|
47584
47883
|
try {
|
|
@@ -47628,7 +47927,7 @@ function readCodexFallbackModels() {
|
|
|
47628
47927
|
);
|
|
47629
47928
|
}
|
|
47630
47929
|
}
|
|
47631
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47930
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path17.default.join(codexHome, "config.toml"))) {
|
|
47632
47931
|
addBridgeModel(
|
|
47633
47932
|
models,
|
|
47634
47933
|
mapBridgeModel({
|
|
@@ -47642,11 +47941,11 @@ function readCodexFallbackModels() {
|
|
|
47642
47941
|
})
|
|
47643
47942
|
);
|
|
47644
47943
|
}
|
|
47645
|
-
const automationsDir =
|
|
47944
|
+
const automationsDir = import_node_path17.default.join(codexHome, "automations");
|
|
47646
47945
|
try {
|
|
47647
|
-
for (const entry of
|
|
47946
|
+
for (const entry of import_node_fs13.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
47648
47947
|
if (!entry.isDirectory()) continue;
|
|
47649
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47948
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path17.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
47650
47949
|
addBridgeModel(
|
|
47651
47950
|
models,
|
|
47652
47951
|
mapBridgeModel({
|
|
@@ -47666,9 +47965,9 @@ function readCodexFallbackModels() {
|
|
|
47666
47965
|
return [...models.values()];
|
|
47667
47966
|
}
|
|
47668
47967
|
function neutralCheckoutCwd(stateDir) {
|
|
47669
|
-
const dir =
|
|
47968
|
+
const dir = import_node_path17.default.join(stateDir, "no-checkout");
|
|
47670
47969
|
try {
|
|
47671
|
-
|
|
47970
|
+
import_node_fs13.default.mkdirSync(dir, { recursive: true });
|
|
47672
47971
|
} catch {
|
|
47673
47972
|
}
|
|
47674
47973
|
return dir;
|
|
@@ -47718,7 +48017,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
|
|
|
47718
48017
|
" bullets (`- AND ...` as needed). Scenarios make the spec verifiable.",
|
|
47719
48018
|
"- Keep behavior contracts in the spec; implementation details belong in `## Implementation Plan`.",
|
|
47720
48019
|
"- Apply this format ONLY to Specs/{id} pages; do not retro-fit it onto other wiki page types.",
|
|
47721
|
-
"- 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):
|
|
48020
|
+
"- 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.",
|
|
47722
48021
|
'- 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.',
|
|
47723
48022
|
"- 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.",
|
|
47724
48023
|
"",
|
|
@@ -47984,7 +48283,7 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47984
48283
|
const cutoff = Date.now() - worktreeRetentionMs();
|
|
47985
48284
|
const isReapable = (worktreePath) => {
|
|
47986
48285
|
try {
|
|
47987
|
-
return
|
|
48286
|
+
return import_node_fs13.default.statSync(worktreePath).mtimeMs < cutoff;
|
|
47988
48287
|
} catch {
|
|
47989
48288
|
return false;
|
|
47990
48289
|
}
|
|
@@ -48022,8 +48321,8 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
48022
48321
|
}
|
|
48023
48322
|
}
|
|
48024
48323
|
function readStateDir() {
|
|
48025
|
-
if (process.env.CODEX_HOME) return
|
|
48026
|
-
return
|
|
48324
|
+
if (process.env.CODEX_HOME) return import_node_path17.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
|
|
48325
|
+
return import_node_path17.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
|
|
48027
48326
|
}
|
|
48028
48327
|
function readAllowedOrigins() {
|
|
48029
48328
|
const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
|
|
@@ -48971,6 +49270,10 @@ async function startDirectorBridge() {
|
|
|
48971
49270
|
const codexProbeHandle = startCodexProbe();
|
|
48972
49271
|
const consumerState = { inFlightRunId: null, lastClaimAt: null };
|
|
48973
49272
|
const health = createServiceHealth();
|
|
49273
|
+
try {
|
|
49274
|
+
migrateRetiredApiBaseUrls();
|
|
49275
|
+
} catch {
|
|
49276
|
+
}
|
|
48974
49277
|
const apiBaseUrl = readConfiguredApiBaseUrl();
|
|
48975
49278
|
if (!isRemoteApiAllowed(apiBaseUrl)) {
|
|
48976
49279
|
throw new Error(
|
|
@@ -49050,8 +49353,8 @@ async function startDirectorBridge() {
|
|
|
49050
49353
|
codexCwd: config2.codexCwd,
|
|
49051
49354
|
codexExecutable: config2.codexExecutable,
|
|
49052
49355
|
checkoutRegistry,
|
|
49053
|
-
worktreeRoot:
|
|
49054
|
-
locksDir:
|
|
49356
|
+
worktreeRoot: import_node_path17.default.join(config2.stateDir, "worktrees"),
|
|
49357
|
+
locksDir: import_node_path17.default.join(config2.stateDir, "locks"),
|
|
49055
49358
|
// Wire the executor server for code-execution runs. Each run gets its own app-server
|
|
49056
49359
|
// process at the run worktree, running UNRESTRICTED from the real ~/.codex (owner
|
|
49057
49360
|
// no-sandbox decision — auth + mrrlin MCP come from the operator config).
|
|
@@ -49087,13 +49390,13 @@ async function startDirectorBridge() {
|
|
|
49087
49390
|
// egressDomains is retained in the seam signature (verification-turn.ts still computes the
|
|
49088
49391
|
// env host) but no longer constrains anything — the executor is unrestricted.
|
|
49089
49392
|
startSandbox: async (_egressDomains) => {
|
|
49090
|
-
const cwd =
|
|
49393
|
+
const cwd = import_node_fs13.default.mkdtempSync(import_node_path17.default.join(import_node_os8.default.tmpdir(), "mrrlin-verify-"));
|
|
49091
49394
|
let handle;
|
|
49092
49395
|
try {
|
|
49093
49396
|
handle = await startExecutorServer({ worktree: cwd });
|
|
49094
49397
|
} catch (error51) {
|
|
49095
49398
|
try {
|
|
49096
|
-
|
|
49399
|
+
import_node_fs13.default.rmSync(cwd, { recursive: true, force: true });
|
|
49097
49400
|
} catch {
|
|
49098
49401
|
}
|
|
49099
49402
|
throw error51;
|
|
@@ -49104,7 +49407,7 @@ async function startDirectorBridge() {
|
|
|
49104
49407
|
dispose: () => {
|
|
49105
49408
|
handle.dispose();
|
|
49106
49409
|
try {
|
|
49107
|
-
|
|
49410
|
+
import_node_fs13.default.rmSync(cwd, { recursive: true, force: true });
|
|
49108
49411
|
} catch {
|
|
49109
49412
|
}
|
|
49110
49413
|
}
|
|
@@ -49312,7 +49615,7 @@ async function startDirectorBridge() {
|
|
|
49312
49615
|
const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
|
|
49313
49616
|
let bridgeBinShaShort = "unknown00000";
|
|
49314
49617
|
try {
|
|
49315
|
-
bridgeBinShaShort = import_node_crypto7.default.createHash("sha256").update(
|
|
49618
|
+
bridgeBinShaShort = import_node_crypto7.default.createHash("sha256").update(import_node_fs13.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
|
|
49316
49619
|
} catch {
|
|
49317
49620
|
}
|
|
49318
49621
|
attachBridgeWss(server, {
|
|
@@ -49441,8 +49744,8 @@ async function startDirectorBridge() {
|
|
|
49441
49744
|
enqueueRun(
|
|
49442
49745
|
() => runOrphanWorktreeSweep(client, {
|
|
49443
49746
|
checkoutRegistry,
|
|
49444
|
-
worktreeRoot:
|
|
49445
|
-
locksDir:
|
|
49747
|
+
worktreeRoot: import_node_path17.default.join(config2.stateDir, "worktrees"),
|
|
49748
|
+
locksDir: import_node_path17.default.join(config2.stateDir, "locks")
|
|
49446
49749
|
})
|
|
49447
49750
|
);
|
|
49448
49751
|
enqueueRun(async () => {
|
|
@@ -49704,15 +50007,15 @@ function readDispatchBody(req) {
|
|
|
49704
50007
|
function readOrCreateBridgeToken(stateDir) {
|
|
49705
50008
|
const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
|
|
49706
50009
|
if (explicit) return explicit;
|
|
49707
|
-
const tokenPath =
|
|
50010
|
+
const tokenPath = import_node_path17.default.join(stateDir, "token.txt");
|
|
49708
50011
|
try {
|
|
49709
|
-
const existing =
|
|
50012
|
+
const existing = import_node_fs13.default.readFileSync(tokenPath, "utf8").trim();
|
|
49710
50013
|
if (existing) return existing;
|
|
49711
50014
|
} catch {
|
|
49712
50015
|
}
|
|
49713
|
-
|
|
50016
|
+
import_node_fs13.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
49714
50017
|
const token = import_node_crypto7.default.randomBytes(32).toString("base64url");
|
|
49715
|
-
|
|
50018
|
+
import_node_fs13.default.writeFileSync(tokenPath, `${token}
|
|
49716
50019
|
`, { mode: 384 });
|
|
49717
50020
|
return token;
|
|
49718
50021
|
}
|
|
@@ -53096,17 +53399,17 @@ var StdioServerTransport = class {
|
|
|
53096
53399
|
// src/tools.ts
|
|
53097
53400
|
var import_node_crypto10 = require("node:crypto");
|
|
53098
53401
|
var import_promises3 = require("node:fs/promises");
|
|
53099
|
-
var
|
|
53100
|
-
var
|
|
53101
|
-
var
|
|
53402
|
+
var import_node_fs14 = require("node:fs");
|
|
53403
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
53404
|
+
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
53102
53405
|
var import_node_child_process12 = require("node:child_process");
|
|
53103
53406
|
|
|
53104
53407
|
// ../../packages/wiki/dist/index.js
|
|
53105
53408
|
var import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
53106
|
-
var
|
|
53409
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
53107
53410
|
var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
|
|
53108
53411
|
function toPosixPath(input) {
|
|
53109
|
-
return input.split(
|
|
53412
|
+
return input.split(import_node_path18.default.sep).join("/");
|
|
53110
53413
|
}
|
|
53111
53414
|
function slugifyWikiSegment(input) {
|
|
53112
53415
|
return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -53120,12 +53423,12 @@ async function pathExists2(input) {
|
|
|
53120
53423
|
}
|
|
53121
53424
|
}
|
|
53122
53425
|
async function findWorkspaceRoot(start = process.cwd()) {
|
|
53123
|
-
let current =
|
|
53426
|
+
let current = import_node_path18.default.resolve(start);
|
|
53124
53427
|
while (true) {
|
|
53125
|
-
if (await pathExists2(
|
|
53428
|
+
if (await pathExists2(import_node_path18.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path18.default.join(current, "docs"))) {
|
|
53126
53429
|
return current;
|
|
53127
53430
|
}
|
|
53128
|
-
const parent =
|
|
53431
|
+
const parent = import_node_path18.default.dirname(current);
|
|
53129
53432
|
if (parent === current) {
|
|
53130
53433
|
throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
|
|
53131
53434
|
}
|
|
@@ -53134,28 +53437,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
|
|
|
53134
53437
|
}
|
|
53135
53438
|
async function resolveDocsRoot(input) {
|
|
53136
53439
|
if (input) {
|
|
53137
|
-
return
|
|
53440
|
+
return import_node_path18.default.resolve(input);
|
|
53138
53441
|
}
|
|
53139
53442
|
if (process.env.MRRLIN_DOCS_ROOT) {
|
|
53140
|
-
return
|
|
53443
|
+
return import_node_path18.default.resolve(process.env.MRRLIN_DOCS_ROOT);
|
|
53141
53444
|
}
|
|
53142
|
-
return
|
|
53445
|
+
return import_node_path18.default.join(await findWorkspaceRoot(), "docs");
|
|
53143
53446
|
}
|
|
53144
53447
|
async function resolveIndexPath(input) {
|
|
53145
53448
|
if (input) {
|
|
53146
|
-
return
|
|
53449
|
+
return import_node_path18.default.resolve(input);
|
|
53147
53450
|
}
|
|
53148
53451
|
if (process.env.MRRLIN_WIKI_INDEX_PATH) {
|
|
53149
|
-
return
|
|
53452
|
+
return import_node_path18.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
53150
53453
|
}
|
|
53151
53454
|
const workspaceRoot = await findWorkspaceRoot();
|
|
53152
|
-
return
|
|
53455
|
+
return import_node_path18.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
53153
53456
|
}
|
|
53154
53457
|
async function walkMarkdownFiles(root, dir = root) {
|
|
53155
53458
|
const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
|
|
53156
53459
|
const files = [];
|
|
53157
53460
|
for (const entry of entries) {
|
|
53158
|
-
const absolute =
|
|
53461
|
+
const absolute = import_node_path18.default.join(dir, entry.name);
|
|
53159
53462
|
if (entry.isDirectory()) {
|
|
53160
53463
|
files.push(...await walkMarkdownFiles(root, absolute));
|
|
53161
53464
|
continue;
|
|
@@ -53174,7 +53477,7 @@ function parseTitle(markdown, sourcePath) {
|
|
|
53174
53477
|
return title;
|
|
53175
53478
|
}
|
|
53176
53479
|
function documentFromFile(docsRoot, absolutePath, markdown) {
|
|
53177
|
-
const relativePath = toPosixPath(
|
|
53480
|
+
const relativePath = toPosixPath(import_node_path18.default.relative(docsRoot, absolutePath));
|
|
53178
53481
|
const [section, fileName] = relativePath.split("/");
|
|
53179
53482
|
if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
|
|
53180
53483
|
return null;
|
|
@@ -53884,6 +54187,22 @@ function buildGateQuestionOptions(question, category) {
|
|
|
53884
54187
|
}
|
|
53885
54188
|
];
|
|
53886
54189
|
}
|
|
54190
|
+
var defaultNativeSpecGateBuilders = { buildSpecGateDeps, runSpecGate };
|
|
54191
|
+
async function runNativeSpecGate(ctx, input, builders = defaultNativeSpecGateBuilders) {
|
|
54192
|
+
const deps = builders.buildSpecGateDeps({
|
|
54193
|
+
client: ctx.client,
|
|
54194
|
+
projectSlug: input.projectSlug,
|
|
54195
|
+
specPageId: input.pageId,
|
|
54196
|
+
cwd: ctx.cwd,
|
|
54197
|
+
codexExecutable: ctx.codexExecutable,
|
|
54198
|
+
extraHeadCount: input.extraHeads?.length ?? 0
|
|
54199
|
+
});
|
|
54200
|
+
return builders.runSpecGate(
|
|
54201
|
+
{ projectSlug: input.projectSlug, specPageId: input.pageId },
|
|
54202
|
+
deps,
|
|
54203
|
+
input.extraHeads && input.extraHeads.length > 0 ? { extraHeads: input.extraHeads } : void 0
|
|
54204
|
+
);
|
|
54205
|
+
}
|
|
53887
54206
|
async function cachedResult(client, input) {
|
|
53888
54207
|
const page = await client.getWikiPage(input.projectSlug, input.pageId);
|
|
53889
54208
|
if (!page) return null;
|
|
@@ -53909,23 +54228,7 @@ async function cachedResult(client, input) {
|
|
|
53909
54228
|
return null;
|
|
53910
54229
|
}
|
|
53911
54230
|
async function run(ctx, input) {
|
|
53912
|
-
const
|
|
53913
|
-
client: ctx.client,
|
|
53914
|
-
projectSlug: input.projectSlug,
|
|
53915
|
-
specPageId: input.pageId,
|
|
53916
|
-
cwd: ctx.cwd,
|
|
53917
|
-
codexExecutable: ctx.codexExecutable,
|
|
53918
|
-
extraHeadCount: input.extraHeads?.length ?? 0
|
|
53919
|
-
});
|
|
53920
|
-
const activeRunHead = await resolveActiveRunHead({
|
|
53921
|
-
heads: [...allReviewHeads(), ...input.extraHeads ?? []]
|
|
53922
|
-
});
|
|
53923
|
-
if (activeRunHead) deps.runHead = activeRunHead;
|
|
53924
|
-
const result = await runSpecGate(
|
|
53925
|
-
{ projectSlug: input.projectSlug, specPageId: input.pageId },
|
|
53926
|
-
deps,
|
|
53927
|
-
input.extraHeads && input.extraHeads.length > 0 ? { extraHeads: input.extraHeads } : void 0
|
|
53928
|
-
);
|
|
54231
|
+
const result = await runNativeSpecGate(ctx, input);
|
|
53929
54232
|
if (process.env[SHADOW_ENV_FLAG]) {
|
|
53930
54233
|
try {
|
|
53931
54234
|
const specPage = await ctx.client.getWikiPage(input.projectSlug, input.pageId);
|
|
@@ -55072,7 +55375,7 @@ var mcpToolDescriptions = {
|
|
|
55072
55375
|
[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.",
|
|
55073
55376
|
[mcpToolNames.updateWikiPage]: "Update a markdown Wiki page.",
|
|
55074
55377
|
[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.",
|
|
55075
|
-
[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):
|
|
55378
|
+
[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.',
|
|
55076
55379
|
[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).`,
|
|
55077
55380
|
[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.",
|
|
55078
55381
|
[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.',
|
|
@@ -55522,7 +55825,7 @@ function createMrrlinTools(options) {
|
|
|
55522
55825
|
if (!config2.consensusEnabled) {
|
|
55523
55826
|
throw new McpToolCodedError(
|
|
55524
55827
|
"SPEC_CONSENSUS_REQUIRED",
|
|
55525
|
-
`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).
|
|
55828
|
+
`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.`
|
|
55526
55829
|
);
|
|
55527
55830
|
}
|
|
55528
55831
|
const page = await c.getWikiPage(projectSlug, pageId);
|
|
@@ -55729,7 +56032,7 @@ function createMrrlinTools(options) {
|
|
|
55729
56032
|
"ARTIFACT_FILE_UPLOAD_FAILED",
|
|
55730
56033
|
"Unable to upload artifact file.",
|
|
55731
56034
|
async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
|
|
55732
|
-
const extension2 =
|
|
56035
|
+
const extension2 = import_node_path19.default.extname(filePath).toLowerCase();
|
|
55733
56036
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
55734
56037
|
if (!contentType) {
|
|
55735
56038
|
throw new McpToolCodedError(
|
|
@@ -55757,7 +56060,7 @@ function createMrrlinTools(options) {
|
|
|
55757
56060
|
"Artifact exceeds 5MB; split or summarize instead."
|
|
55758
56061
|
);
|
|
55759
56062
|
}
|
|
55760
|
-
const filename =
|
|
56063
|
+
const filename = import_node_path19.default.basename(filePath);
|
|
55761
56064
|
const created = await c.createArtifactFile(projectSlug, {
|
|
55762
56065
|
class: artifactClass,
|
|
55763
56066
|
contentType,
|
|
@@ -55840,7 +56143,7 @@ function createMrrlinTools(options) {
|
|
|
55840
56143
|
"Unable to register local checkout.",
|
|
55841
56144
|
async (_c, { projectSlug, path: checkoutPath, repo }) => {
|
|
55842
56145
|
const trimmedPath = checkoutPath.trim();
|
|
55843
|
-
if (!
|
|
56146
|
+
if (!import_node_path19.default.isAbsolute(trimmedPath)) {
|
|
55844
56147
|
throw new McpToolCodedError(
|
|
55845
56148
|
"LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
|
|
55846
56149
|
`Path must be absolute, got: ${trimmedPath}`
|
|
@@ -55848,7 +56151,7 @@ function createMrrlinTools(options) {
|
|
|
55848
56151
|
}
|
|
55849
56152
|
let resolvedPath;
|
|
55850
56153
|
try {
|
|
55851
|
-
resolvedPath = (0,
|
|
56154
|
+
resolvedPath = (0, import_node_fs14.realpathSync)(trimmedPath);
|
|
55852
56155
|
} catch {
|
|
55853
56156
|
throw new McpToolCodedError(
|
|
55854
56157
|
"LOCAL_CHECKOUT_PATH_NOT_FOUND",
|
|
@@ -55875,7 +56178,7 @@ function createMrrlinTools(options) {
|
|
|
55875
56178
|
`Origin remote ${remoteUrl} does not match repo ${repo}.`
|
|
55876
56179
|
);
|
|
55877
56180
|
}
|
|
55878
|
-
const stateDir = process.env.CODEX_HOME ?
|
|
56181
|
+
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");
|
|
55879
56182
|
const registry3 = new CheckoutRegistry(stateDir);
|
|
55880
56183
|
const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
55881
56184
|
registry3.confirm(projectSlug, resolvedPath, confirmedAt);
|
|
@@ -56050,14 +56353,29 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
56050
56353
|
async function startStdioServer(options = {}) {
|
|
56051
56354
|
let effective = options;
|
|
56052
56355
|
if (!options.apiBaseUrl) {
|
|
56356
|
+
try {
|
|
56357
|
+
migrateRetiredApiBaseUrls();
|
|
56358
|
+
} catch {
|
|
56359
|
+
}
|
|
56053
56360
|
const { baseUrl, source } = await resolveApiBaseUrlDynamic();
|
|
56054
56361
|
effective = {
|
|
56055
56362
|
...options,
|
|
56056
56363
|
apiBaseUrl: baseUrl,
|
|
56057
|
-
allowRemoteApi: source === "staging-env" || source === "staging-autodetect"
|
|
56364
|
+
allowRemoteApi: source === "staging-env" || source === "staging-autodetect" || source === "retired-retarget"
|
|
56058
56365
|
};
|
|
56059
56366
|
process.stderr.write(`[mrrlin-mcp] API resolved: ${redactUrlForLog(baseUrl)} (source=${source})
|
|
56060
56367
|
`);
|
|
56368
|
+
if (source === "retired-retarget") {
|
|
56369
|
+
process.stderr.write(
|
|
56370
|
+
"[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"
|
|
56371
|
+
);
|
|
56372
|
+
}
|
|
56373
|
+
if (!await probeApiHealth(baseUrl)) {
|
|
56374
|
+
process.stderr.write(
|
|
56375
|
+
`[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.
|
|
56376
|
+
`
|
|
56377
|
+
);
|
|
56378
|
+
}
|
|
56061
56379
|
}
|
|
56062
56380
|
const { resolved, server } = createMrrlinMcpServer(effective);
|
|
56063
56381
|
const transport = new StdioServerTransport();
|
|
@@ -56082,56 +56400,8 @@ function runSetCredential(args) {
|
|
|
56082
56400
|
}
|
|
56083
56401
|
|
|
56084
56402
|
// src/install-service.ts
|
|
56085
|
-
var
|
|
56086
|
-
var
|
|
56087
|
-
|
|
56088
|
-
// src/service-paths.ts
|
|
56089
|
-
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
56090
|
-
function isWorktreePath(p) {
|
|
56091
|
-
const norm = import_node_path18.default.normalize(p).split(import_node_path18.default.sep).join("/");
|
|
56092
|
-
return norm.includes("/.claude/worktrees/");
|
|
56093
|
-
}
|
|
56094
|
-
function resolveServiceCwd(opts) {
|
|
56095
|
-
const chosen = (opts.explicit?.trim() || opts.cwd).trim();
|
|
56096
|
-
if (isWorktreePath(chosen)) {
|
|
56097
|
-
return {
|
|
56098
|
-
ok: false,
|
|
56099
|
-
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.`
|
|
56100
|
-
};
|
|
56101
|
-
}
|
|
56102
|
-
return { ok: true, cwd: chosen };
|
|
56103
|
-
}
|
|
56104
|
-
var BRIDGE_APP_NAME = "mrrlin-bridge";
|
|
56105
|
-
function renderEcosystemConfig(opts) {
|
|
56106
|
-
const env = {
|
|
56107
|
-
HOME: opts.home,
|
|
56108
|
-
PATH: opts.pathEnv,
|
|
56109
|
-
MRRLIN_DIRECTOR_BRIDGE_LOG: "1"
|
|
56110
|
-
};
|
|
56111
|
-
if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
|
|
56112
|
-
if (opts.staging) env.MRRLIN_STAGING = "1";
|
|
56113
|
-
else if (opts.apiBaseUrl) env.MRRLIN_API_BASE_URL = opts.apiBaseUrl;
|
|
56114
|
-
const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
|
|
56115
|
-
return `module.exports = {
|
|
56116
|
-
apps: [{
|
|
56117
|
-
name: ${JSON.stringify(BRIDGE_APP_NAME)},
|
|
56118
|
-
script: "mrrlin-mcp",
|
|
56119
|
-
args: "director-bridge",
|
|
56120
|
-
interpreter: "none",
|
|
56121
|
-
cwd: ${JSON.stringify(opts.cwd)},
|
|
56122
|
-
autorestart: true,
|
|
56123
|
-
max_restarts: 10,
|
|
56124
|
-
restart_delay: 3000,
|
|
56125
|
-
kill_timeout: 10000,
|
|
56126
|
-
env: {
|
|
56127
|
-
${envLines}
|
|
56128
|
-
},
|
|
56129
|
-
}],
|
|
56130
|
-
};
|
|
56131
|
-
`;
|
|
56132
|
-
}
|
|
56133
|
-
|
|
56134
|
-
// src/install-service.ts
|
|
56403
|
+
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
56404
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
56135
56405
|
function installService(deps) {
|
|
56136
56406
|
if (!deps.hasSecret()) {
|
|
56137
56407
|
deps.log("No agent credential found. Issue one in Settings, then run: mrrlin-mcp set-credential '<secret>'.");
|
|
@@ -56142,7 +56412,7 @@ function installService(deps) {
|
|
|
56142
56412
|
deps.log(resolved.reason);
|
|
56143
56413
|
return { ok: false };
|
|
56144
56414
|
}
|
|
56145
|
-
const home = deps.env.HOME ??
|
|
56415
|
+
const home = deps.env.HOME ?? import_node_os10.default.homedir();
|
|
56146
56416
|
const bins = ["node", "codex", "mrrlin-mcp"].map((b) => deps.which(b));
|
|
56147
56417
|
if (bins.some((b) => !b)) {
|
|
56148
56418
|
deps.log("Could not resolve absolute paths for node/codex/mrrlin-mcp on PATH. Install them or fix PATH.");
|
|
@@ -56153,7 +56423,7 @@ function installService(deps) {
|
|
|
56153
56423
|
return { ok: false };
|
|
56154
56424
|
}
|
|
56155
56425
|
const resolvedBins = bins.filter((b) => b !== null);
|
|
56156
|
-
const pathEnv = Array.from(new Set(resolvedBins.map((b) =>
|
|
56426
|
+
const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path20.default.dirname(b)))).join(":");
|
|
56157
56427
|
const text = renderEcosystemConfig({
|
|
56158
56428
|
cwd: resolved.cwd,
|
|
56159
56429
|
home,
|
|
@@ -56162,7 +56432,7 @@ function installService(deps) {
|
|
|
56162
56432
|
staging: deps.env.MRRLIN_STAGING === "1",
|
|
56163
56433
|
apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
|
|
56164
56434
|
});
|
|
56165
|
-
const ecoPath =
|
|
56435
|
+
const ecoPath = import_node_path20.default.join(home, ".mrrlin", "ecosystem.config.cjs");
|
|
56166
56436
|
deps.writeFile(ecoPath, text);
|
|
56167
56437
|
const start = deps.runPm2(["startOrReload", ecoPath]);
|
|
56168
56438
|
if (start.code !== 0) {
|
|
@@ -56193,13 +56463,13 @@ function uninstallService(deps) {
|
|
|
56193
56463
|
|
|
56194
56464
|
// src/uninstall-codex.ts
|
|
56195
56465
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
56196
|
-
var
|
|
56197
|
-
var
|
|
56466
|
+
var import_node_os11 = __toESM(require("node:os"), 1);
|
|
56467
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
56198
56468
|
var toml2 = __toESM(require_toml(), 1);
|
|
56199
56469
|
function resolveCodexHome2(options) {
|
|
56200
56470
|
if (options.codexHome) return options.codexHome;
|
|
56201
56471
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
56202
|
-
return
|
|
56472
|
+
return import_node_path21.default.join(options.homeDir ?? import_node_os11.default.homedir(), ".codex");
|
|
56203
56473
|
}
|
|
56204
56474
|
async function pathExists3(target) {
|
|
56205
56475
|
try {
|
|
@@ -56212,7 +56482,7 @@ async function pathExists3(target) {
|
|
|
56212
56482
|
var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
|
|
56213
56483
|
async function uninstallCodex(options = {}) {
|
|
56214
56484
|
const codexHome = resolveCodexHome2(options);
|
|
56215
|
-
const configPath =
|
|
56485
|
+
const configPath = import_node_path21.default.join(codexHome, "config.toml");
|
|
56216
56486
|
const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
|
|
56217
56487
|
if (!await pathExists3(configPath)) {
|
|
56218
56488
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
@@ -56240,10 +56510,10 @@ async function uninstallCodex(options = {}) {
|
|
|
56240
56510
|
}
|
|
56241
56511
|
async function uninstallPrompts(codexHome, names) {
|
|
56242
56512
|
if (names.length === 0) return [];
|
|
56243
|
-
const promptsDir =
|
|
56513
|
+
const promptsDir = import_node_path21.default.join(codexHome, "prompts");
|
|
56244
56514
|
const out = [];
|
|
56245
56515
|
for (const name of names) {
|
|
56246
|
-
const promptPath =
|
|
56516
|
+
const promptPath = import_node_path21.default.join(promptsDir, `${name}.md`);
|
|
56247
56517
|
try {
|
|
56248
56518
|
await import_promises4.default.unlink(promptPath);
|
|
56249
56519
|
out.push({ name, action: "removed", promptPath });
|
|
@@ -56496,8 +56766,8 @@ async function main() {
|
|
|
56496
56766
|
}
|
|
56497
56767
|
}
|
|
56498
56768
|
try {
|
|
56499
|
-
const codexHome = process.env.CODEX_HOME ??
|
|
56500
|
-
(0,
|
|
56769
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path23.default.join(process.env.HOME ?? (0, import_node_os12.homedir)(), ".codex");
|
|
56770
|
+
(0, import_node_fs15.rmSync)(import_node_path23.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
56501
56771
|
} catch {
|
|
56502
56772
|
}
|
|
56503
56773
|
return;
|
|
@@ -56527,8 +56797,8 @@ async function main() {
|
|
|
56527
56797
|
env: process.env,
|
|
56528
56798
|
cwd: process.cwd(),
|
|
56529
56799
|
writeFile: (p, c) => {
|
|
56530
|
-
(0,
|
|
56531
|
-
(0,
|
|
56800
|
+
(0, import_node_fs15.mkdirSync)(import_node_path23.default.dirname(p), { recursive: true, mode: 448 });
|
|
56801
|
+
(0, import_node_fs15.writeFileSync)(p, c, { mode: 384 });
|
|
56532
56802
|
},
|
|
56533
56803
|
runPm2: pm2Runner,
|
|
56534
56804
|
which: whichBin,
|
|
@@ -56545,35 +56815,35 @@ async function main() {
|
|
|
56545
56815
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
56546
56816
|
removeFile: (p) => {
|
|
56547
56817
|
try {
|
|
56548
|
-
(0,
|
|
56818
|
+
(0, import_node_fs15.rmSync)(p, { force: true });
|
|
56549
56819
|
} catch {
|
|
56550
56820
|
}
|
|
56551
56821
|
},
|
|
56552
56822
|
purgeSecret: purge,
|
|
56553
56823
|
secretPath: agentCredentialPath(),
|
|
56554
56824
|
tokenPath: operatorTokenPath(),
|
|
56555
|
-
ecoPath:
|
|
56825
|
+
ecoPath: import_node_path23.default.join(process.env.HOME ?? (0, import_node_os12.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
56556
56826
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
56557
56827
|
`)
|
|
56558
56828
|
});
|
|
56559
56829
|
return;
|
|
56560
56830
|
}
|
|
56561
56831
|
case "uninstall": {
|
|
56562
|
-
const home = process.env.HOME ?? (0,
|
|
56832
|
+
const home = process.env.HOME ?? (0, import_node_os12.homedir)();
|
|
56563
56833
|
const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
|
|
56564
56834
|
`);
|
|
56565
56835
|
uninstallService({
|
|
56566
56836
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
56567
56837
|
removeFile: (p) => {
|
|
56568
56838
|
try {
|
|
56569
|
-
(0,
|
|
56839
|
+
(0, import_node_fs15.rmSync)(p, { force: true });
|
|
56570
56840
|
} catch {
|
|
56571
56841
|
}
|
|
56572
56842
|
},
|
|
56573
56843
|
purgeSecret: true,
|
|
56574
56844
|
secretPath: agentCredentialPath(),
|
|
56575
56845
|
tokenPath: operatorTokenPath(),
|
|
56576
|
-
ecoPath:
|
|
56846
|
+
ecoPath: import_node_path23.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
|
|
56577
56847
|
log
|
|
56578
56848
|
});
|
|
56579
56849
|
let codexOk = true;
|
|
@@ -56593,7 +56863,7 @@ async function main() {
|
|
|
56593
56863
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
56594
56864
|
}
|
|
56595
56865
|
try {
|
|
56596
|
-
(0,
|
|
56866
|
+
(0, import_node_fs15.rmSync)(import_node_path23.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
56597
56867
|
} catch {
|
|
56598
56868
|
}
|
|
56599
56869
|
log("removed ~/.mrrlin");
|
|
@@ -56634,7 +56904,7 @@ ${HELP_TEXT}`);
|
|
|
56634
56904
|
}
|
|
56635
56905
|
}
|
|
56636
56906
|
function resolveSelfBinPath() {
|
|
56637
|
-
return
|
|
56907
|
+
return import_node_path22.default.resolve(process.argv[1] ?? process.execPath);
|
|
56638
56908
|
}
|
|
56639
56909
|
main().catch((error51) => {
|
|
56640
56910
|
process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
|