@mrrlin-dev/mcp 0.3.37 → 0.3.38
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 +311 -246
- package/package.json +4 -4
package/dist/bin.cjs
CHANGED
|
@@ -7729,14 +7729,14 @@ var require_polyfills = __commonJS({
|
|
|
7729
7729
|
fs6.fstatSync = statFixSync(fs6.fstatSync);
|
|
7730
7730
|
fs6.lstatSync = statFixSync(fs6.lstatSync);
|
|
7731
7731
|
if (fs6.chmod && !fs6.lchmod) {
|
|
7732
|
-
fs6.lchmod = function(
|
|
7732
|
+
fs6.lchmod = function(path16, mode, cb) {
|
|
7733
7733
|
if (cb) process.nextTick(cb);
|
|
7734
7734
|
};
|
|
7735
7735
|
fs6.lchmodSync = function() {
|
|
7736
7736
|
};
|
|
7737
7737
|
}
|
|
7738
7738
|
if (fs6.chown && !fs6.lchown) {
|
|
7739
|
-
fs6.lchown = function(
|
|
7739
|
+
fs6.lchown = function(path16, uid, gid, cb) {
|
|
7740
7740
|
if (cb) process.nextTick(cb);
|
|
7741
7741
|
};
|
|
7742
7742
|
fs6.lchownSync = function() {
|
|
@@ -7803,9 +7803,9 @@ var require_polyfills = __commonJS({
|
|
|
7803
7803
|
};
|
|
7804
7804
|
}(fs6.readSync);
|
|
7805
7805
|
function patchLchmod(fs7) {
|
|
7806
|
-
fs7.lchmod = function(
|
|
7806
|
+
fs7.lchmod = function(path16, mode, callback) {
|
|
7807
7807
|
fs7.open(
|
|
7808
|
-
|
|
7808
|
+
path16,
|
|
7809
7809
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
7810
7810
|
mode,
|
|
7811
7811
|
function(err, fd) {
|
|
@@ -7821,8 +7821,8 @@ var require_polyfills = __commonJS({
|
|
|
7821
7821
|
}
|
|
7822
7822
|
);
|
|
7823
7823
|
};
|
|
7824
|
-
fs7.lchmodSync = function(
|
|
7825
|
-
var fd = fs7.openSync(
|
|
7824
|
+
fs7.lchmodSync = function(path16, mode) {
|
|
7825
|
+
var fd = fs7.openSync(path16, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
7826
7826
|
var threw = true;
|
|
7827
7827
|
var ret;
|
|
7828
7828
|
try {
|
|
@@ -7843,8 +7843,8 @@ var require_polyfills = __commonJS({
|
|
|
7843
7843
|
}
|
|
7844
7844
|
function patchLutimes(fs7) {
|
|
7845
7845
|
if (constants.hasOwnProperty("O_SYMLINK") && fs7.futimes) {
|
|
7846
|
-
fs7.lutimes = function(
|
|
7847
|
-
fs7.open(
|
|
7846
|
+
fs7.lutimes = function(path16, at, mt, cb) {
|
|
7847
|
+
fs7.open(path16, constants.O_SYMLINK, function(er, fd) {
|
|
7848
7848
|
if (er) {
|
|
7849
7849
|
if (cb) cb(er);
|
|
7850
7850
|
return;
|
|
@@ -7856,8 +7856,8 @@ var require_polyfills = __commonJS({
|
|
|
7856
7856
|
});
|
|
7857
7857
|
});
|
|
7858
7858
|
};
|
|
7859
|
-
fs7.lutimesSync = function(
|
|
7860
|
-
var fd = fs7.openSync(
|
|
7859
|
+
fs7.lutimesSync = function(path16, at, mt) {
|
|
7860
|
+
var fd = fs7.openSync(path16, constants.O_SYMLINK);
|
|
7861
7861
|
var ret;
|
|
7862
7862
|
var threw = true;
|
|
7863
7863
|
try {
|
|
@@ -7975,11 +7975,11 @@ var require_legacy_streams = __commonJS({
|
|
|
7975
7975
|
ReadStream,
|
|
7976
7976
|
WriteStream
|
|
7977
7977
|
};
|
|
7978
|
-
function ReadStream(
|
|
7979
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
7978
|
+
function ReadStream(path16, options) {
|
|
7979
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path16, options);
|
|
7980
7980
|
Stream.call(this);
|
|
7981
7981
|
var self = this;
|
|
7982
|
-
this.path =
|
|
7982
|
+
this.path = path16;
|
|
7983
7983
|
this.fd = null;
|
|
7984
7984
|
this.readable = true;
|
|
7985
7985
|
this.paused = false;
|
|
@@ -8024,10 +8024,10 @@ var require_legacy_streams = __commonJS({
|
|
|
8024
8024
|
self._read();
|
|
8025
8025
|
});
|
|
8026
8026
|
}
|
|
8027
|
-
function WriteStream(
|
|
8028
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
8027
|
+
function WriteStream(path16, options) {
|
|
8028
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path16, options);
|
|
8029
8029
|
Stream.call(this);
|
|
8030
|
-
this.path =
|
|
8030
|
+
this.path = path16;
|
|
8031
8031
|
this.fd = null;
|
|
8032
8032
|
this.writable = true;
|
|
8033
8033
|
this.flags = "w";
|
|
@@ -8170,14 +8170,14 @@ var require_graceful_fs = __commonJS({
|
|
|
8170
8170
|
fs7.createWriteStream = createWriteStream;
|
|
8171
8171
|
var fs$readFile = fs7.readFile;
|
|
8172
8172
|
fs7.readFile = readFile2;
|
|
8173
|
-
function readFile2(
|
|
8173
|
+
function readFile2(path16, 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(path16, options, cb);
|
|
8177
|
+
function go$readFile(path17, options2, cb2, startTime) {
|
|
8178
|
+
return fs$readFile(path17, options2, function(err) {
|
|
8179
8179
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8180
|
-
enqueue([go$readFile, [
|
|
8180
|
+
enqueue([go$readFile, [path17, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8181
8181
|
else {
|
|
8182
8182
|
if (typeof cb2 === "function")
|
|
8183
8183
|
cb2.apply(this, arguments);
|
|
@@ -8187,14 +8187,14 @@ var require_graceful_fs = __commonJS({
|
|
|
8187
8187
|
}
|
|
8188
8188
|
var fs$writeFile = fs7.writeFile;
|
|
8189
8189
|
fs7.writeFile = writeFile;
|
|
8190
|
-
function writeFile(
|
|
8190
|
+
function writeFile(path16, 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(path16, data, options, cb);
|
|
8194
|
+
function go$writeFile(path17, data2, options2, cb2, startTime) {
|
|
8195
|
+
return fs$writeFile(path17, data2, options2, function(err) {
|
|
8196
8196
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8197
|
-
enqueue([go$writeFile, [
|
|
8197
|
+
enqueue([go$writeFile, [path17, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8198
8198
|
else {
|
|
8199
8199
|
if (typeof cb2 === "function")
|
|
8200
8200
|
cb2.apply(this, arguments);
|
|
@@ -8205,14 +8205,14 @@ var require_graceful_fs = __commonJS({
|
|
|
8205
8205
|
var fs$appendFile = fs7.appendFile;
|
|
8206
8206
|
if (fs$appendFile)
|
|
8207
8207
|
fs7.appendFile = appendFile;
|
|
8208
|
-
function appendFile(
|
|
8208
|
+
function appendFile(path16, 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(path16, data, options, cb);
|
|
8212
|
+
function go$appendFile(path17, data2, options2, cb2, startTime) {
|
|
8213
|
+
return fs$appendFile(path17, data2, options2, function(err) {
|
|
8214
8214
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8215
|
-
enqueue([go$appendFile, [
|
|
8215
|
+
enqueue([go$appendFile, [path17, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8216
8216
|
else {
|
|
8217
8217
|
if (typeof cb2 === "function")
|
|
8218
8218
|
cb2.apply(this, arguments);
|
|
@@ -8243,31 +8243,31 @@ var require_graceful_fs = __commonJS({
|
|
|
8243
8243
|
var fs$readdir = fs7.readdir;
|
|
8244
8244
|
fs7.readdir = readdir2;
|
|
8245
8245
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
8246
|
-
function readdir2(
|
|
8246
|
+
function readdir2(path16, options, cb) {
|
|
8247
8247
|
if (typeof options === "function")
|
|
8248
8248
|
cb = options, options = null;
|
|
8249
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
8250
|
-
return fs$readdir(
|
|
8251
|
-
|
|
8249
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path17, options2, cb2, startTime) {
|
|
8250
|
+
return fs$readdir(path17, fs$readdirCallback(
|
|
8251
|
+
path17,
|
|
8252
8252
|
options2,
|
|
8253
8253
|
cb2,
|
|
8254
8254
|
startTime
|
|
8255
8255
|
));
|
|
8256
|
-
} : function go$readdir2(
|
|
8257
|
-
return fs$readdir(
|
|
8258
|
-
|
|
8256
|
+
} : function go$readdir2(path17, options2, cb2, startTime) {
|
|
8257
|
+
return fs$readdir(path17, options2, fs$readdirCallback(
|
|
8258
|
+
path17,
|
|
8259
8259
|
options2,
|
|
8260
8260
|
cb2,
|
|
8261
8261
|
startTime
|
|
8262
8262
|
));
|
|
8263
8263
|
};
|
|
8264
|
-
return go$readdir(
|
|
8265
|
-
function fs$readdirCallback(
|
|
8264
|
+
return go$readdir(path16, options, cb);
|
|
8265
|
+
function fs$readdirCallback(path17, options2, cb2, startTime) {
|
|
8266
8266
|
return function(err, files) {
|
|
8267
8267
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8268
8268
|
enqueue([
|
|
8269
8269
|
go$readdir,
|
|
8270
|
-
[
|
|
8270
|
+
[path17, options2, cb2],
|
|
8271
8271
|
err,
|
|
8272
8272
|
startTime || Date.now(),
|
|
8273
8273
|
Date.now()
|
|
@@ -8338,7 +8338,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8338
8338
|
enumerable: true,
|
|
8339
8339
|
configurable: true
|
|
8340
8340
|
});
|
|
8341
|
-
function ReadStream(
|
|
8341
|
+
function ReadStream(path16, options) {
|
|
8342
8342
|
if (this instanceof ReadStream)
|
|
8343
8343
|
return fs$ReadStream.apply(this, arguments), this;
|
|
8344
8344
|
else
|
|
@@ -8358,7 +8358,7 @@ var require_graceful_fs = __commonJS({
|
|
|
8358
8358
|
}
|
|
8359
8359
|
});
|
|
8360
8360
|
}
|
|
8361
|
-
function WriteStream(
|
|
8361
|
+
function WriteStream(path16, options) {
|
|
8362
8362
|
if (this instanceof WriteStream)
|
|
8363
8363
|
return fs$WriteStream.apply(this, arguments), this;
|
|
8364
8364
|
else
|
|
@@ -8376,22 +8376,22 @@ var require_graceful_fs = __commonJS({
|
|
|
8376
8376
|
}
|
|
8377
8377
|
});
|
|
8378
8378
|
}
|
|
8379
|
-
function createReadStream(
|
|
8380
|
-
return new fs7.ReadStream(
|
|
8379
|
+
function createReadStream(path16, options) {
|
|
8380
|
+
return new fs7.ReadStream(path16, options);
|
|
8381
8381
|
}
|
|
8382
|
-
function createWriteStream(
|
|
8383
|
-
return new fs7.WriteStream(
|
|
8382
|
+
function createWriteStream(path16, options) {
|
|
8383
|
+
return new fs7.WriteStream(path16, options);
|
|
8384
8384
|
}
|
|
8385
8385
|
var fs$open = fs7.open;
|
|
8386
8386
|
fs7.open = open;
|
|
8387
|
-
function open(
|
|
8387
|
+
function open(path16, 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(path16, flags, mode, cb);
|
|
8391
|
+
function go$open(path17, flags2, mode2, cb2, startTime) {
|
|
8392
|
+
return fs$open(path17, flags2, mode2, function(err, fd) {
|
|
8393
8393
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8394
|
-
enqueue([go$open, [
|
|
8394
|
+
enqueue([go$open, [path17, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
8395
8395
|
else {
|
|
8396
8396
|
if (typeof cb2 === "function")
|
|
8397
8397
|
cb2.apply(this, arguments);
|
|
@@ -8920,7 +8920,7 @@ var require_mtime_precision = __commonJS({
|
|
|
8920
8920
|
var require_lockfile = __commonJS({
|
|
8921
8921
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
|
|
8922
8922
|
"use strict";
|
|
8923
|
-
var
|
|
8923
|
+
var path16 = require("path");
|
|
8924
8924
|
var fs6 = require_graceful_fs();
|
|
8925
8925
|
var retry = require_retry2();
|
|
8926
8926
|
var onExit = require_signal_exit();
|
|
@@ -8931,7 +8931,7 @@ var require_lockfile = __commonJS({
|
|
|
8931
8931
|
}
|
|
8932
8932
|
function resolveCanonicalPath(file2, options, callback) {
|
|
8933
8933
|
if (!options.realpath) {
|
|
8934
|
-
return callback(null,
|
|
8934
|
+
return callback(null, path16.resolve(file2));
|
|
8935
8935
|
}
|
|
8936
8936
|
options.fs.realpath(file2, callback);
|
|
8937
8937
|
}
|
|
@@ -10795,10 +10795,10 @@ var require_segments = __commonJS({
|
|
|
10795
10795
|
const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
|
|
10796
10796
|
const nodes = buildNodes(segs);
|
|
10797
10797
|
const graph = buildGraph(nodes, version2);
|
|
10798
|
-
const
|
|
10798
|
+
const path16 = 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 < path16.length - 1; i++) {
|
|
10801
|
+
optimizedSegs.push(graph.table[path16[i]].node);
|
|
10802
10802
|
}
|
|
10803
10803
|
return exports2.fromArray(mergeSegments(optimizedSegs));
|
|
10804
10804
|
};
|
|
@@ -13275,7 +13275,7 @@ var require_png2 = __commonJS({
|
|
|
13275
13275
|
});
|
|
13276
13276
|
png.pack();
|
|
13277
13277
|
};
|
|
13278
|
-
exports2.renderToFile = function renderToFile(
|
|
13278
|
+
exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
|
|
13279
13279
|
if (typeof cb === "undefined") {
|
|
13280
13280
|
cb = options;
|
|
13281
13281
|
options = void 0;
|
|
@@ -13286,7 +13286,7 @@ var require_png2 = __commonJS({
|
|
|
13286
13286
|
called = true;
|
|
13287
13287
|
cb.apply(null, args);
|
|
13288
13288
|
};
|
|
13289
|
-
const stream = fs6.createWriteStream(
|
|
13289
|
+
const stream = fs6.createWriteStream(path16);
|
|
13290
13290
|
stream.on("error", done);
|
|
13291
13291
|
stream.on("close", done);
|
|
13292
13292
|
exports2.renderToFileStream(stream, qrData, options);
|
|
@@ -13348,14 +13348,14 @@ var require_utf8 = __commonJS({
|
|
|
13348
13348
|
}
|
|
13349
13349
|
return output3;
|
|
13350
13350
|
};
|
|
13351
|
-
exports2.renderToFile = function renderToFile(
|
|
13351
|
+
exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
|
|
13352
13352
|
if (typeof cb === "undefined") {
|
|
13353
13353
|
cb = options;
|
|
13354
13354
|
options = void 0;
|
|
13355
13355
|
}
|
|
13356
13356
|
const fs6 = require("fs");
|
|
13357
13357
|
const utf8 = exports2.render(qrData, options);
|
|
13358
|
-
fs6.writeFile(
|
|
13358
|
+
fs6.writeFile(path16, utf8, cb);
|
|
13359
13359
|
};
|
|
13360
13360
|
}
|
|
13361
13361
|
});
|
|
@@ -13476,7 +13476,7 @@ var require_svg_tag = __commonJS({
|
|
|
13476
13476
|
return str;
|
|
13477
13477
|
}
|
|
13478
13478
|
function qrToPath(data, size, margin) {
|
|
13479
|
-
let
|
|
13479
|
+
let path16 = "";
|
|
13480
13480
|
let moveBy = 0;
|
|
13481
13481
|
let newRow = false;
|
|
13482
13482
|
let lineLength = 0;
|
|
@@ -13487,19 +13487,19 @@ var require_svg_tag = __commonJS({
|
|
|
13487
13487
|
if (data[i]) {
|
|
13488
13488
|
lineLength++;
|
|
13489
13489
|
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
13490
|
-
|
|
13490
|
+
path16 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
|
|
13491
13491
|
moveBy = 0;
|
|
13492
13492
|
newRow = false;
|
|
13493
13493
|
}
|
|
13494
13494
|
if (!(col + 1 < size && data[i + 1])) {
|
|
13495
|
-
|
|
13495
|
+
path16 += svgCmd("h", lineLength);
|
|
13496
13496
|
lineLength = 0;
|
|
13497
13497
|
}
|
|
13498
13498
|
} else {
|
|
13499
13499
|
moveBy++;
|
|
13500
13500
|
}
|
|
13501
13501
|
}
|
|
13502
|
-
return
|
|
13502
|
+
return path16;
|
|
13503
13503
|
}
|
|
13504
13504
|
exports2.render = function render(qrData, options, cb) {
|
|
13505
13505
|
const opts = Utils.getOptions(options);
|
|
@@ -13507,10 +13507,10 @@ var require_svg_tag = __commonJS({
|
|
|
13507
13507
|
const data = qrData.modules.data;
|
|
13508
13508
|
const qrcodesize = size + opts.margin * 2;
|
|
13509
13509
|
const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
|
|
13510
|
-
const
|
|
13510
|
+
const path16 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
|
|
13511
13511
|
const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
|
|
13512
13512
|
const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
|
|
13513
|
-
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg +
|
|
13513
|
+
const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path16 + "</svg>\n";
|
|
13514
13514
|
if (typeof cb === "function") {
|
|
13515
13515
|
cb(null, svgTag);
|
|
13516
13516
|
}
|
|
@@ -13524,7 +13524,7 @@ var require_svg = __commonJS({
|
|
|
13524
13524
|
"../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
|
|
13525
13525
|
var svgTagRenderer = require_svg_tag();
|
|
13526
13526
|
exports2.render = svgTagRenderer.render;
|
|
13527
|
-
exports2.renderToFile = function renderToFile(
|
|
13527
|
+
exports2.renderToFile = function renderToFile(path16, qrData, options, cb) {
|
|
13528
13528
|
if (typeof cb === "undefined") {
|
|
13529
13529
|
cb = options;
|
|
13530
13530
|
options = void 0;
|
|
@@ -13532,7 +13532,7 @@ var require_svg = __commonJS({
|
|
|
13532
13532
|
const fs6 = 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
|
-
fs6.writeFile(
|
|
13535
|
+
fs6.writeFile(path16, xmlStr, cb);
|
|
13536
13536
|
};
|
|
13537
13537
|
}
|
|
13538
13538
|
});
|
|
@@ -13690,8 +13690,8 @@ var require_server = __commonJS({
|
|
|
13690
13690
|
cb
|
|
13691
13691
|
};
|
|
13692
13692
|
}
|
|
13693
|
-
function getTypeFromFilename(
|
|
13694
|
-
return
|
|
13693
|
+
function getTypeFromFilename(path16) {
|
|
13694
|
+
return path16.slice((path16.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
|
|
13695
13695
|
}
|
|
13696
13696
|
function getRendererFromType(type) {
|
|
13697
13697
|
switch (type) {
|
|
@@ -13755,17 +13755,17 @@ var require_server = __commonJS({
|
|
|
13755
13755
|
const renderer = getRendererFromType(params.opts.type);
|
|
13756
13756
|
return render(renderer.renderToBuffer, text, params);
|
|
13757
13757
|
};
|
|
13758
|
-
exports2.toFile = function toFile(
|
|
13759
|
-
if (typeof
|
|
13758
|
+
exports2.toFile = function toFile(path16, text, opts, cb) {
|
|
13759
|
+
if (typeof path16 !== "string" || !(typeof text === "string" || typeof text === "object")) {
|
|
13760
13760
|
throw new Error("Invalid argument");
|
|
13761
13761
|
}
|
|
13762
13762
|
if (arguments.length < 3 && !canPromise()) {
|
|
13763
13763
|
throw new Error("Too few arguments provided");
|
|
13764
13764
|
}
|
|
13765
13765
|
const params = checkParams(text, opts, cb);
|
|
13766
|
-
const type = params.opts.type || getTypeFromFilename(
|
|
13766
|
+
const type = params.opts.type || getTypeFromFilename(path16);
|
|
13767
13767
|
const renderer = getRendererFromType(type);
|
|
13768
|
-
const renderToFile = renderer.renderToFile.bind(null,
|
|
13768
|
+
const renderToFile = renderer.renderToFile.bind(null, path16);
|
|
13769
13769
|
return render(renderToFile, text, params);
|
|
13770
13770
|
};
|
|
13771
13771
|
exports2.toFileStream = function toFileStream(stream, text, opts) {
|
|
@@ -16983,8 +16983,8 @@ var require_utils3 = __commonJS({
|
|
|
16983
16983
|
}
|
|
16984
16984
|
return ind;
|
|
16985
16985
|
}
|
|
16986
|
-
function removeDotSegments(
|
|
16987
|
-
let input =
|
|
16986
|
+
function removeDotSegments(path16) {
|
|
16987
|
+
let input = path16;
|
|
16988
16988
|
const output3 = [];
|
|
16989
16989
|
let nextSlash = -1;
|
|
16990
16990
|
let len = 0;
|
|
@@ -17236,8 +17236,8 @@ var require_schemes = __commonJS({
|
|
|
17236
17236
|
wsComponent.secure = void 0;
|
|
17237
17237
|
}
|
|
17238
17238
|
if (wsComponent.resourceName) {
|
|
17239
|
-
const [
|
|
17240
|
-
wsComponent.path =
|
|
17239
|
+
const [path16, query] = wsComponent.resourceName.split("?");
|
|
17240
|
+
wsComponent.path = path16 && path16 !== "/" ? path16 : void 0;
|
|
17241
17241
|
wsComponent.query = query;
|
|
17242
17242
|
wsComponent.resourceName = void 0;
|
|
17243
17243
|
}
|
|
@@ -20644,11 +20644,11 @@ var require_dist = __commonJS({
|
|
|
20644
20644
|
});
|
|
20645
20645
|
|
|
20646
20646
|
// src/bin.ts
|
|
20647
|
-
var
|
|
20648
|
-
var
|
|
20647
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
20648
|
+
var import_node_child_process13 = require("node:child_process");
|
|
20649
20649
|
var import_node_fs13 = require("node:fs");
|
|
20650
20650
|
var import_node_os11 = require("node:os");
|
|
20651
|
-
var
|
|
20651
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
20652
20652
|
|
|
20653
20653
|
// src/install-codex.ts
|
|
20654
20654
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
@@ -20989,8 +20989,8 @@ ${block}`;
|
|
|
20989
20989
|
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
20990
20990
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
20991
20991
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
20992
|
-
var
|
|
20993
|
-
var
|
|
20992
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
20993
|
+
var import_node_child_process10 = require("node:child_process");
|
|
20994
20994
|
var import_node_crypto7 = __toESM(require("node:crypto"), 1);
|
|
20995
20995
|
|
|
20996
20996
|
// src/turn-replay-buffer.ts
|
|
@@ -22546,10 +22546,10 @@ function mergeDefs(...defs) {
|
|
|
22546
22546
|
function cloneDef(schema) {
|
|
22547
22547
|
return mergeDefs(schema._zod.def);
|
|
22548
22548
|
}
|
|
22549
|
-
function getElementAtPath(obj,
|
|
22550
|
-
if (!
|
|
22549
|
+
function getElementAtPath(obj, path16) {
|
|
22550
|
+
if (!path16)
|
|
22551
22551
|
return obj;
|
|
22552
|
-
return
|
|
22552
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
22553
22553
|
}
|
|
22554
22554
|
function promiseAllObject(promisesObj) {
|
|
22555
22555
|
const keys = Object.keys(promisesObj);
|
|
@@ -22958,11 +22958,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
22958
22958
|
}
|
|
22959
22959
|
return false;
|
|
22960
22960
|
}
|
|
22961
|
-
function prefixIssues(
|
|
22961
|
+
function prefixIssues(path16, issues) {
|
|
22962
22962
|
return issues.map((iss) => {
|
|
22963
22963
|
var _a3;
|
|
22964
22964
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
22965
|
-
iss.path.unshift(
|
|
22965
|
+
iss.path.unshift(path16);
|
|
22966
22966
|
return iss;
|
|
22967
22967
|
});
|
|
22968
22968
|
}
|
|
@@ -23109,16 +23109,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23109
23109
|
}
|
|
23110
23110
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
23111
23111
|
const fieldErrors = { _errors: [] };
|
|
23112
|
-
const processError = (error52,
|
|
23112
|
+
const processError = (error52, path16 = []) => {
|
|
23113
23113
|
for (const issue2 of error52.issues) {
|
|
23114
23114
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23115
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23115
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
23116
23116
|
} else if (issue2.code === "invalid_key") {
|
|
23117
|
-
processError({ issues: issue2.issues }, [...
|
|
23117
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23118
23118
|
} else if (issue2.code === "invalid_element") {
|
|
23119
|
-
processError({ issues: issue2.issues }, [...
|
|
23119
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23120
23120
|
} else {
|
|
23121
|
-
const fullpath = [...
|
|
23121
|
+
const fullpath = [...path16, ...issue2.path];
|
|
23122
23122
|
if (fullpath.length === 0) {
|
|
23123
23123
|
fieldErrors._errors.push(mapper(issue2));
|
|
23124
23124
|
} else {
|
|
@@ -23145,17 +23145,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23145
23145
|
}
|
|
23146
23146
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
23147
23147
|
const result = { errors: [] };
|
|
23148
|
-
const processError = (error52,
|
|
23148
|
+
const processError = (error52, path16 = []) => {
|
|
23149
23149
|
var _a3, _b;
|
|
23150
23150
|
for (const issue2 of error52.issues) {
|
|
23151
23151
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23152
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23152
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
23153
23153
|
} else if (issue2.code === "invalid_key") {
|
|
23154
|
-
processError({ issues: issue2.issues }, [...
|
|
23154
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23155
23155
|
} else if (issue2.code === "invalid_element") {
|
|
23156
|
-
processError({ issues: issue2.issues }, [...
|
|
23156
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23157
23157
|
} else {
|
|
23158
|
-
const fullpath = [...
|
|
23158
|
+
const fullpath = [...path16, ...issue2.path];
|
|
23159
23159
|
if (fullpath.length === 0) {
|
|
23160
23160
|
result.errors.push(mapper(issue2));
|
|
23161
23161
|
continue;
|
|
@@ -23187,8 +23187,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23187
23187
|
}
|
|
23188
23188
|
function toDotPath(_path) {
|
|
23189
23189
|
const segs = [];
|
|
23190
|
-
const
|
|
23191
|
-
for (const seg of
|
|
23190
|
+
const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
23191
|
+
for (const seg of path16) {
|
|
23192
23192
|
if (typeof seg === "number")
|
|
23193
23193
|
segs.push(`[${seg}]`);
|
|
23194
23194
|
else if (typeof seg === "symbol")
|
|
@@ -35880,13 +35880,13 @@ function resolveRef(ref, ctx) {
|
|
|
35880
35880
|
if (!ref.startsWith("#")) {
|
|
35881
35881
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
35882
35882
|
}
|
|
35883
|
-
const
|
|
35884
|
-
if (
|
|
35883
|
+
const path16 = ref.slice(1).split("/").filter(Boolean);
|
|
35884
|
+
if (path16.length === 0) {
|
|
35885
35885
|
return ctx.rootSchema;
|
|
35886
35886
|
}
|
|
35887
35887
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
35888
|
-
if (
|
|
35889
|
-
const key =
|
|
35888
|
+
if (path16[0] === defsKey) {
|
|
35889
|
+
const key = path16[1];
|
|
35890
35890
|
if (!key || !ctx.defs[key]) {
|
|
35891
35891
|
throw new Error(`Reference not found: ${ref}`);
|
|
35892
35892
|
}
|
|
@@ -37760,18 +37760,18 @@ function createMrrlinClient(config2) {
|
|
|
37760
37760
|
const customFetch = config2.fetch ?? globalThis.fetch;
|
|
37761
37761
|
const baseUrl = config2.baseUrl.replace(/\/$/, "");
|
|
37762
37762
|
const token = config2.token;
|
|
37763
|
-
async function request(
|
|
37763
|
+
async function request(path16, init) {
|
|
37764
37764
|
const method = init?.method ?? "GET";
|
|
37765
37765
|
const headers = new Headers(init?.headers ?? {});
|
|
37766
37766
|
if (token && !headers.has("authorization")) {
|
|
37767
37767
|
headers.set("authorization", `Bearer ${token}`);
|
|
37768
37768
|
}
|
|
37769
|
-
const response = await customFetch(`${baseUrl}${
|
|
37769
|
+
const response = await customFetch(`${baseUrl}${path16}`, { ...init, headers });
|
|
37770
37770
|
if (!response.ok) {
|
|
37771
37771
|
const body = await response.text();
|
|
37772
37772
|
let code = `HTTP_${response.status}`;
|
|
37773
37773
|
let violations = null;
|
|
37774
|
-
let message = `Mrrlin API ${method} ${
|
|
37774
|
+
let message = `Mrrlin API ${method} ${path16} failed: ${response.status}`;
|
|
37775
37775
|
try {
|
|
37776
37776
|
const parsed = JSON.parse(body);
|
|
37777
37777
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -37791,7 +37791,7 @@ function createMrrlinClient(config2) {
|
|
|
37791
37791
|
throw new MrrlinApiError({
|
|
37792
37792
|
code,
|
|
37793
37793
|
method,
|
|
37794
|
-
path:
|
|
37794
|
+
path: path16,
|
|
37795
37795
|
responseBody: body,
|
|
37796
37796
|
status: response.status,
|
|
37797
37797
|
violations,
|
|
@@ -38046,7 +38046,7 @@ function createMrrlinClient(config2) {
|
|
|
38046
38046
|
return taskEventListResponseSchema.parse(body).data;
|
|
38047
38047
|
},
|
|
38048
38048
|
async listTasks(projectSlug, filters = {}) {
|
|
38049
|
-
const
|
|
38049
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
|
|
38050
38050
|
assignee: filters.assignee,
|
|
38051
38051
|
autonomyLevel: filters.autonomyLevel,
|
|
38052
38052
|
blockedBy: filters.blockedBy,
|
|
@@ -38058,7 +38058,7 @@ function createMrrlinClient(config2) {
|
|
|
38058
38058
|
subcategory: filters.subcategory,
|
|
38059
38059
|
type: filters.type
|
|
38060
38060
|
});
|
|
38061
|
-
const body = await request(
|
|
38061
|
+
const body = await request(path16);
|
|
38062
38062
|
return taskListResponseSchema.parse(body).data;
|
|
38063
38063
|
},
|
|
38064
38064
|
async listTaxonomy(projectSlug) {
|
|
@@ -38066,22 +38066,22 @@ function createMrrlinClient(config2) {
|
|
|
38066
38066
|
return taxonomyListResponseSchema.parse(body).data;
|
|
38067
38067
|
},
|
|
38068
38068
|
async listWikiPages(projectSlug, filters = {}) {
|
|
38069
|
-
const
|
|
38069
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
|
|
38070
38070
|
folder: filters.folder,
|
|
38071
38071
|
q: filters.q,
|
|
38072
38072
|
taskId: filters.taskId
|
|
38073
38073
|
});
|
|
38074
|
-
const body = await request(
|
|
38074
|
+
const body = await request(path16);
|
|
38075
38075
|
return wikiPageListResponseSchema.parse(body).data;
|
|
38076
38076
|
},
|
|
38077
38077
|
async searchWikiPages(projectSlug, query) {
|
|
38078
|
-
const
|
|
38078
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
|
|
38079
38079
|
folder: query.folder,
|
|
38080
38080
|
limit: query.limit === void 0 ? void 0 : String(query.limit),
|
|
38081
38081
|
pathPrefix: query.pathPrefix,
|
|
38082
38082
|
q: query.q
|
|
38083
38083
|
});
|
|
38084
|
-
const body = await request(
|
|
38084
|
+
const body = await request(path16);
|
|
38085
38085
|
return wikiPageSearchResponseSchema.parse(body).data;
|
|
38086
38086
|
},
|
|
38087
38087
|
async updatePlan(projectSlug, planId, patch) {
|
|
@@ -38595,9 +38595,38 @@ function createTurnLock() {
|
|
|
38595
38595
|
}
|
|
38596
38596
|
|
|
38597
38597
|
// src/self-update.ts
|
|
38598
|
+
var import_node_child_process3 = require("node:child_process");
|
|
38598
38599
|
var import_node_crypto = require("node:crypto");
|
|
38599
38600
|
var import_node_fs = require("node:fs");
|
|
38601
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
38600
38602
|
var import_semver = __toESM(require_semver2(), 1);
|
|
38603
|
+
var BIN_NAME = "mrrlin-mcp";
|
|
38604
|
+
function resolveBinPath(opts) {
|
|
38605
|
+
if (opts.argv1 && import_node_path3.default.basename(opts.argv1).includes("mrrlin")) {
|
|
38606
|
+
return { path: opts.argv1, source: "argv" };
|
|
38607
|
+
}
|
|
38608
|
+
const whichSync = opts.whichSync ?? ((name) => {
|
|
38609
|
+
try {
|
|
38610
|
+
return (0, import_node_child_process3.execFileSync)("which", [name], { encoding: "utf8", timeout: 3e3 }).trim() || null;
|
|
38611
|
+
} catch {
|
|
38612
|
+
return null;
|
|
38613
|
+
}
|
|
38614
|
+
});
|
|
38615
|
+
const existsSync4 = opts.existsSync ?? import_node_fs.existsSync;
|
|
38616
|
+
const resolved = whichSync(BIN_NAME);
|
|
38617
|
+
if (resolved && existsSync4(resolved)) {
|
|
38618
|
+
return { path: resolved, source: "which" };
|
|
38619
|
+
}
|
|
38620
|
+
const envPath = (opts.env ?? process.env).PATH ?? "";
|
|
38621
|
+
for (const dir of envPath.split(import_node_path3.default.delimiter)) {
|
|
38622
|
+
if (!dir) continue;
|
|
38623
|
+
const candidate = import_node_path3.default.join(dir, BIN_NAME);
|
|
38624
|
+
if (existsSync4(candidate)) {
|
|
38625
|
+
return { path: candidate, source: "path-walk" };
|
|
38626
|
+
}
|
|
38627
|
+
}
|
|
38628
|
+
return { path: opts.argv1 || "", source: "fallback" };
|
|
38629
|
+
}
|
|
38601
38630
|
var DEFAULT_INTERVAL_MS = 15 * 60 * 1e3;
|
|
38602
38631
|
var DEFAULT_IDLE_MS = 2e3;
|
|
38603
38632
|
var DEFAULT_REGISTRY_POLL_MS = 6 * 60 * 60 * 1e3;
|
|
@@ -38637,6 +38666,7 @@ function startSelfUpdate(deps) {
|
|
|
38637
38666
|
const nowFn = deps.now ?? (() => Date.now());
|
|
38638
38667
|
const disabled = isDisabled();
|
|
38639
38668
|
let drainOnQuiet = false;
|
|
38669
|
+
let drainSource = null;
|
|
38640
38670
|
let shutdownCalled = false;
|
|
38641
38671
|
let latestVersion = null;
|
|
38642
38672
|
let lastUpdateMentionAt = null;
|
|
@@ -38684,6 +38714,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38684
38714
|
}
|
|
38685
38715
|
log("info", "bridge.self_update.startup", {
|
|
38686
38716
|
binPath: deps.binPath,
|
|
38717
|
+
binPathSource: deps.binPathSource ?? "unknown",
|
|
38687
38718
|
startupBinSha: startupBinSha?.slice(0, 12) ?? null,
|
|
38688
38719
|
selfUpdateEnabled: !disabled,
|
|
38689
38720
|
intervalMs
|
|
@@ -38768,6 +38799,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38768
38799
|
if (currentBinSha !== startupBinSha) {
|
|
38769
38800
|
if (!drainOnQuiet) {
|
|
38770
38801
|
drainOnQuiet = true;
|
|
38802
|
+
drainSource = drainSource ?? "hash";
|
|
38771
38803
|
log("info", "bridge.self_update.hash_drift_detected", {
|
|
38772
38804
|
startupBinSha: startupBinSha.slice(0, 12),
|
|
38773
38805
|
currentBinSha: currentBinSha.slice(0, 12)
|
|
@@ -38775,7 +38807,9 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38775
38807
|
}
|
|
38776
38808
|
}
|
|
38777
38809
|
const driftConfirmed = startupBinSha !== null && currentBinSha !== startupBinSha;
|
|
38778
|
-
|
|
38810
|
+
const signalTrusted = drainSource === "signal" && deps.binPathSource === "fallback";
|
|
38811
|
+
const canExit = signalTrusted || driftConfirmed;
|
|
38812
|
+
if (drainOnQuiet && canExit && !shutdownCalled) {
|
|
38779
38813
|
const active = deps.getActiveTurnCount();
|
|
38780
38814
|
const idle = deps.getIdleMs();
|
|
38781
38815
|
const resumable = deps.getResumableTurnCount ? deps.getResumableTurnCount() : 0;
|
|
@@ -38789,7 +38823,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38789
38823
|
err: String(e?.message ?? e)
|
|
38790
38824
|
});
|
|
38791
38825
|
}
|
|
38792
|
-
} else if (active === 0 && idle >= idleThresholdMs && resumable > 0) {
|
|
38826
|
+
} else if (canExit && active === 0 && idle >= idleThresholdMs && resumable > 0) {
|
|
38793
38827
|
log("info", "bridge.self_update.reload_deferred_resumable_turn", { resumable });
|
|
38794
38828
|
}
|
|
38795
38829
|
}
|
|
@@ -38824,6 +38858,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38824
38858
|
}
|
|
38825
38859
|
if (!drainOnQuiet) {
|
|
38826
38860
|
drainOnQuiet = true;
|
|
38861
|
+
drainSource = "signal";
|
|
38827
38862
|
log("info", "bridge.self_update.signal_received", { signal: "SIGUSR2" });
|
|
38828
38863
|
}
|
|
38829
38864
|
},
|
|
@@ -38836,7 +38871,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38836
38871
|
}
|
|
38837
38872
|
|
|
38838
38873
|
// src/codex-version.ts
|
|
38839
|
-
var
|
|
38874
|
+
var import_node_child_process4 = require("node:child_process");
|
|
38840
38875
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
38841
38876
|
var SEMVER_RE = /\b\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?\b/;
|
|
38842
38877
|
var CODEX_PACKAGE = process.env.MRRLIN_CODEX_PACKAGE?.trim() || "@openai/codex";
|
|
@@ -38846,7 +38881,7 @@ function parseCodexVersion(raw) {
|
|
|
38846
38881
|
return m ? m[0] : null;
|
|
38847
38882
|
}
|
|
38848
38883
|
var defaultRun = (args) => {
|
|
38849
|
-
const r = (0,
|
|
38884
|
+
const r = (0, import_node_child_process4.spawnSync)("codex", args, { encoding: "utf8", timeout: 8e3, shell: true });
|
|
38850
38885
|
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
38851
38886
|
};
|
|
38852
38887
|
function getInstalledCodexVersion(run3) {
|
|
@@ -38920,7 +38955,7 @@ function startCodexProbe(deps = {}) {
|
|
|
38920
38955
|
}
|
|
38921
38956
|
|
|
38922
38957
|
// src/_generated/version.ts
|
|
38923
|
-
var PKG_VERSION = "0.3.
|
|
38958
|
+
var PKG_VERSION = "0.3.38";
|
|
38924
38959
|
|
|
38925
38960
|
// src/api-base-url.ts
|
|
38926
38961
|
var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
|
|
@@ -39099,7 +39134,7 @@ function startSchedulerTickLoop(deps) {
|
|
|
39099
39134
|
}
|
|
39100
39135
|
|
|
39101
39136
|
// src/agent-pool-loop.ts
|
|
39102
|
-
var
|
|
39137
|
+
var import_node_child_process5 = require("node:child_process");
|
|
39103
39138
|
|
|
39104
39139
|
// src/agent-pool-snapshot.ts
|
|
39105
39140
|
function buildAgentPoolSnapshot(statusRows, stats, opts) {
|
|
@@ -39221,7 +39256,7 @@ function defaultRunCli(args) {
|
|
|
39221
39256
|
}
|
|
39222
39257
|
};
|
|
39223
39258
|
try {
|
|
39224
|
-
const child = (0,
|
|
39259
|
+
const child = (0, import_node_child_process5.spawn)(cmd, baseArgs, { stdio: ["ignore", "pipe", "ignore"] });
|
|
39225
39260
|
const timer = setTimeout(() => {
|
|
39226
39261
|
try {
|
|
39227
39262
|
child.kill("SIGKILL");
|
|
@@ -39283,9 +39318,9 @@ function startAgentPoolLoop(deps) {
|
|
|
39283
39318
|
}
|
|
39284
39319
|
|
|
39285
39320
|
// src/execution-consumer.ts
|
|
39286
|
-
var
|
|
39321
|
+
var import_node_child_process9 = require("node:child_process");
|
|
39287
39322
|
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
39288
|
-
var
|
|
39323
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
39289
39324
|
var import_node_util = require("node:util");
|
|
39290
39325
|
|
|
39291
39326
|
// src/consensus/heads.ts
|
|
@@ -39323,11 +39358,11 @@ function resolveProducerPersona(domain2) {
|
|
|
39323
39358
|
// src/consensus/wiring.ts
|
|
39324
39359
|
var import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
39325
39360
|
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
39326
|
-
var
|
|
39361
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
39327
39362
|
var import_node_url2 = require("node:url");
|
|
39328
39363
|
|
|
39329
39364
|
// src/consensus/codex-exec.ts
|
|
39330
|
-
var
|
|
39365
|
+
var import_node_child_process6 = require("node:child_process");
|
|
39331
39366
|
function extractFinalMessage(stdout) {
|
|
39332
39367
|
let last = null;
|
|
39333
39368
|
for (const rawLine of stdout.split(/\r?\n/)) {
|
|
@@ -39372,7 +39407,7 @@ function firstString(...values) {
|
|
|
39372
39407
|
return null;
|
|
39373
39408
|
}
|
|
39374
39409
|
function runCodexExec(input, deps) {
|
|
39375
|
-
const spawn3 = deps?.spawn ??
|
|
39410
|
+
const spawn3 = deps?.spawn ?? import_node_child_process6.spawn;
|
|
39376
39411
|
const executable = input.codexExecutable ?? "codex";
|
|
39377
39412
|
const sandbox = input.sandbox ?? "read-only";
|
|
39378
39413
|
const fullPrompt = input.developerInstructions.trim() ? `${input.developerInstructions.trim()}
|
|
@@ -39511,7 +39546,7 @@ function parseAcceptanceCriteria(markdown) {
|
|
|
39511
39546
|
}
|
|
39512
39547
|
|
|
39513
39548
|
// src/consensus/code-gate-git.ts
|
|
39514
|
-
var
|
|
39549
|
+
var import_node_child_process7 = require("node:child_process");
|
|
39515
39550
|
var DIFF_MAX_BYTES = 2e5;
|
|
39516
39551
|
var FASTGATE_OUTPUT_MAX_BYTES = 16e3;
|
|
39517
39552
|
var GIT_TIMEOUT_MS = 6e4;
|
|
@@ -39527,7 +39562,7 @@ var defaultRunCmd = (cmd, args, opts) => new Promise((resolve) => {
|
|
|
39527
39562
|
};
|
|
39528
39563
|
let child;
|
|
39529
39564
|
try {
|
|
39530
|
-
child = (0,
|
|
39565
|
+
child = (0, import_node_child_process7.spawn)(cmd, args, {
|
|
39531
39566
|
cwd: opts.cwd,
|
|
39532
39567
|
env: process.env,
|
|
39533
39568
|
shell: false,
|
|
@@ -39742,15 +39777,15 @@ ${res.stdout}${res.stderr}`);
|
|
|
39742
39777
|
var import_meta2 = {};
|
|
39743
39778
|
function getPersonasDir() {
|
|
39744
39779
|
if (typeof __dirname !== "undefined") {
|
|
39745
|
-
return
|
|
39780
|
+
return import_node_path4.default.join(__dirname, "consensus", "personas");
|
|
39746
39781
|
}
|
|
39747
|
-
return
|
|
39782
|
+
return import_node_path4.default.join(import_node_path4.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)), "personas");
|
|
39748
39783
|
}
|
|
39749
39784
|
var personaCache = /* @__PURE__ */ new Map();
|
|
39750
39785
|
function loadPersona(name) {
|
|
39751
39786
|
const cached2 = personaCache.get(name);
|
|
39752
39787
|
if (cached2 !== void 0) return cached2;
|
|
39753
|
-
const content = import_node_fs2.default.readFileSync(
|
|
39788
|
+
const content = import_node_fs2.default.readFileSync(import_node_path4.default.join(getPersonasDir(), `${name}.md`), "utf8");
|
|
39754
39789
|
personaCache.set(name, content);
|
|
39755
39790
|
return content;
|
|
39756
39791
|
}
|
|
@@ -40940,18 +40975,18 @@ async function awaitTurnWithDeadline(opts) {
|
|
|
40940
40975
|
}
|
|
40941
40976
|
|
|
40942
40977
|
// src/worktree.ts
|
|
40943
|
-
var
|
|
40978
|
+
var import_node_child_process8 = require("node:child_process");
|
|
40944
40979
|
var import_node_fs4 = require("node:fs");
|
|
40945
40980
|
var import_node_os3 = require("node:os");
|
|
40946
|
-
var
|
|
40981
|
+
var import_node_path6 = require("node:path");
|
|
40947
40982
|
|
|
40948
40983
|
// src/checkout-lock.ts
|
|
40949
40984
|
var import_node_fs3 = require("node:fs");
|
|
40950
|
-
var
|
|
40985
|
+
var import_node_path5 = require("node:path");
|
|
40951
40986
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
40952
40987
|
async function withCheckoutLock(locksDir, slug, fn) {
|
|
40953
40988
|
(0, import_node_fs3.mkdirSync)(locksDir, { recursive: true });
|
|
40954
|
-
const target = (0,
|
|
40989
|
+
const target = (0, import_node_path5.join)(locksDir, `${slug}.lock`);
|
|
40955
40990
|
if (!(0, import_node_fs3.existsSync)(target)) (0, import_node_fs3.writeFileSync)(target, "");
|
|
40956
40991
|
const release = await import_proper_lockfile.default.lock(target, {
|
|
40957
40992
|
retries: { retries: 600, factor: 1, minTimeout: 100, maxTimeout: 100 },
|
|
@@ -40968,16 +41003,16 @@ async function withCheckoutLock(locksDir, slug, fn) {
|
|
|
40968
41003
|
function worktreeBranch(runId) {
|
|
40969
41004
|
return `mrrlin/run-${runId}`;
|
|
40970
41005
|
}
|
|
40971
|
-
var defaultGitExec = (args, env) => (0,
|
|
41006
|
+
var defaultGitExec = (args, env) => (0, import_node_child_process8.execFileSync)("git", args, { encoding: "utf8", timeout: 3e4, env });
|
|
40972
41007
|
function git(checkout, args) {
|
|
40973
|
-
return (0,
|
|
41008
|
+
return (0, import_node_child_process8.execFileSync)("git", ["-C", checkout, ...args], {
|
|
40974
41009
|
encoding: "utf8",
|
|
40975
41010
|
timeout: 3e4,
|
|
40976
41011
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
40977
41012
|
});
|
|
40978
41013
|
}
|
|
40979
41014
|
async function createRunWorktree(opts) {
|
|
40980
|
-
const worktreePath = (0,
|
|
41015
|
+
const worktreePath = (0, import_node_path6.join)(opts.worktreeRoot, opts.slug, opts.runId);
|
|
40981
41016
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
40982
41017
|
(0, import_node_fs4.mkdirSync)(opts.worktreeRoot, { recursive: true });
|
|
40983
41018
|
try {
|
|
@@ -41040,8 +41075,8 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
41040
41075
|
if (localConfig.trim()) {
|
|
41041
41076
|
throw new Error(`push aborted: agent-controlled git config present in worktree: ${localConfig.trim().split("\n")[0]}`);
|
|
41042
41077
|
}
|
|
41043
|
-
const dir = (0, import_node_fs4.mkdtempSync)((0,
|
|
41044
|
-
const askpass = (0,
|
|
41078
|
+
const dir = (0, import_node_fs4.mkdtempSync)((0, import_node_path6.join)((0, import_node_os3.tmpdir)(), "mrrlin-push-"));
|
|
41079
|
+
const askpass = (0, import_node_path6.join)(dir, "askpass");
|
|
41045
41080
|
try {
|
|
41046
41081
|
(0, import_node_fs4.writeFileSync)(
|
|
41047
41082
|
askpass,
|
|
@@ -41078,7 +41113,7 @@ async function sweepOrphanWorktrees(opts) {
|
|
|
41078
41113
|
} catch {
|
|
41079
41114
|
return opts.worktreeRoot;
|
|
41080
41115
|
}
|
|
41081
|
-
})() +
|
|
41116
|
+
})() + import_node_path6.sep + opts.slug + import_node_path6.sep;
|
|
41082
41117
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
41083
41118
|
const listing = git(opts.checkout, ["worktree", "list", "--porcelain"]);
|
|
41084
41119
|
for (const block of listing.split("\n\n")) {
|
|
@@ -41278,19 +41313,27 @@ var EXECUTOR_BASE_INSTRUCTIONS = [
|
|
|
41278
41313
|
"next increment of progress, stop the turn.",
|
|
41279
41314
|
// ADR 0022 Phase 3: the executor is the orchestrator, not the sole worker. It has the
|
|
41280
41315
|
// external-agents `pick`/`dispatch` MCP tools (a pool of cheap/free models) and should
|
|
41281
|
-
// delegate
|
|
41282
|
-
//
|
|
41283
|
-
//
|
|
41284
|
-
// read as advice the model can't act on, and it does the work itself (graceful, no-op).
|
|
41316
|
+
// delegate judgment-requiring work to them, keeping itself as judge. If external-agents
|
|
41317
|
+
// isn't installed the tools are simply absent — these lines then read as advice the model
|
|
41318
|
+
// can't act on, and it does the work itself (graceful, no-op).
|
|
41285
41319
|
"You are the ORCHESTRATOR and JUDGE, not the sole worker. If the external-agents `pick` and",
|
|
41286
|
-
"`dispatch` tools are available,
|
|
41287
|
-
"
|
|
41288
|
-
"
|
|
41289
|
-
"
|
|
41290
|
-
"
|
|
41291
|
-
"
|
|
41292
|
-
"
|
|
41293
|
-
"
|
|
41320
|
+
"`dispatch` tools are available, use this rule to decide what to delegate:",
|
|
41321
|
+
"",
|
|
41322
|
+
"DISPATCH (judgment work): changes that require choosing an approach, understanding context",
|
|
41323
|
+
"across files, or making a non-obvious decision \u2014 feature code, tests, refactors, research.",
|
|
41324
|
+
"Gather context first, then write a focused prompt including what you already know (file contents,",
|
|
41325
|
+
"constraints, architecture decisions) so the worker skips re-discovery. That context distillation",
|
|
41326
|
+
"is where your tokens add value. Prefer `deepseek-reasoner` for hard/medium tasks; fall back to",
|
|
41327
|
+
"`openrouter-nemotron-ultra-free`, `openrouter-nemotron-super-free`, or `ollama-gpt-oss-120b`.",
|
|
41328
|
+
"Use `deepseek-chat` for quick parallel tasks. Dispatch several in parallel when subtasks are",
|
|
41329
|
+
"independent.",
|
|
41330
|
+
"",
|
|
41331
|
+
"SELF-EDIT (mechanical work): deterministic changes with no judgment \u2014 typo, import path, version",
|
|
41332
|
+
"bump, config plumbing. The prompt would cost more than the change itself. Just do it.",
|
|
41333
|
+
"",
|
|
41334
|
+
"You MUST verify every delegated result against the actual files and tests before it lands \u2014",
|
|
41335
|
+
"pool models are lower-reliability and a wrong delegated edit is YOUR responsibility; never",
|
|
41336
|
+
"commit unverified delegated output. If dispatch fails or the pool is unavailable, do the",
|
|
41294
41337
|
"work yourself \u2014 never block the run on the pool."
|
|
41295
41338
|
].join("\n");
|
|
41296
41339
|
function artifactKindForEvent(event) {
|
|
@@ -41327,10 +41370,10 @@ function newArtifactId() {
|
|
|
41327
41370
|
return `EA-${import_node_crypto4.default.randomUUID()}`;
|
|
41328
41371
|
}
|
|
41329
41372
|
var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
|
|
41330
|
-
function isBlastRadiusFloorPath(
|
|
41331
|
-
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(
|
|
41373
|
+
function isBlastRadiusFloorPath(path16) {
|
|
41374
|
+
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path16));
|
|
41332
41375
|
}
|
|
41333
|
-
var execFileAsync = (0, import_node_util.promisify)(
|
|
41376
|
+
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process9.execFile);
|
|
41334
41377
|
async function defaultListRunDiffPaths(opts) {
|
|
41335
41378
|
const parse5 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
41336
41379
|
try {
|
|
@@ -42267,8 +42310,8 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
|
|
|
42267
42310
|
function isRunRecoverableByThisBridge(run3, worktreeRoot) {
|
|
42268
42311
|
if (!worktreeRoot) return true;
|
|
42269
42312
|
if (!run3.worktreeId) return false;
|
|
42270
|
-
const relative =
|
|
42271
|
-
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !
|
|
42313
|
+
const relative = import_node_path7.default.relative(import_node_path7.default.resolve(worktreeRoot), import_node_path7.default.resolve(run3.worktreeId));
|
|
42314
|
+
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !import_node_path7.default.isAbsolute(relative);
|
|
42272
42315
|
}
|
|
42273
42316
|
async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId) {
|
|
42274
42317
|
await deps.client.updateExecutionRun(projectSlug, runId, { status: "failed", finishedAt: (/* @__PURE__ */ new Date()).toISOString(), leaseId: leaseId ?? void 0 }).catch(() => {
|
|
@@ -42720,13 +42763,13 @@ function codexIdleMs() {
|
|
|
42720
42763
|
// src/operator-token.ts
|
|
42721
42764
|
var import_node_fs5 = require("node:fs");
|
|
42722
42765
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
42723
|
-
var
|
|
42766
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
42724
42767
|
function operatorDir() {
|
|
42725
|
-
const base = process.env.CODEX_HOME ?
|
|
42768
|
+
const base = process.env.CODEX_HOME ? import_node_path8.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path8.default.join(import_node_os4.default.homedir(), ".mrrlin");
|
|
42726
42769
|
return base;
|
|
42727
42770
|
}
|
|
42728
42771
|
function operatorTokenPath() {
|
|
42729
|
-
return
|
|
42772
|
+
return import_node_path8.default.join(operatorDir(), "operator-token");
|
|
42730
42773
|
}
|
|
42731
42774
|
function readOperatorToken() {
|
|
42732
42775
|
try {
|
|
@@ -42743,7 +42786,7 @@ function persistOperatorToken(token) {
|
|
|
42743
42786
|
`, { encoding: "utf8", mode: 384 });
|
|
42744
42787
|
}
|
|
42745
42788
|
function agentCredentialPath() {
|
|
42746
|
-
return
|
|
42789
|
+
return import_node_path8.default.join(operatorDir(), "agent-credential");
|
|
42747
42790
|
}
|
|
42748
42791
|
function persistAgentSecret(secret) {
|
|
42749
42792
|
const dir = operatorDir();
|
|
@@ -42764,9 +42807,9 @@ function readAgentSecret() {
|
|
|
42764
42807
|
|
|
42765
42808
|
// src/thread-index.ts
|
|
42766
42809
|
var import_node_fs6 = require("node:fs");
|
|
42767
|
-
var
|
|
42810
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
42768
42811
|
function threadIndexPath(stateDir) {
|
|
42769
|
-
return
|
|
42812
|
+
return import_node_path9.default.join(stateDir, "threads.json");
|
|
42770
42813
|
}
|
|
42771
42814
|
function loadThreadIndex(stateDir, ttlMs, now) {
|
|
42772
42815
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -42883,7 +42926,7 @@ function chatTurnMaxMs() {
|
|
|
42883
42926
|
var import_node_crypto6 = require("node:crypto");
|
|
42884
42927
|
var import_node_fs7 = require("node:fs");
|
|
42885
42928
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
42886
|
-
var
|
|
42929
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
42887
42930
|
var DEFAULT_WORKER_PORT = 8792;
|
|
42888
42931
|
function workerPort() {
|
|
42889
42932
|
const raw = process.env.MRRLIN_WORKER_PORT;
|
|
@@ -42892,11 +42935,11 @@ function workerPort() {
|
|
|
42892
42935
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
|
|
42893
42936
|
}
|
|
42894
42937
|
function workerDir() {
|
|
42895
|
-
const base = process.env.CODEX_HOME ?
|
|
42896
|
-
return
|
|
42938
|
+
const base = process.env.CODEX_HOME ? import_node_path10.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path10.default.join(import_node_os5.default.homedir(), ".mrrlin");
|
|
42939
|
+
return import_node_path10.default.join(base, "worker");
|
|
42897
42940
|
}
|
|
42898
42941
|
function workerTokenPath() {
|
|
42899
|
-
return
|
|
42942
|
+
return import_node_path10.default.join(workerDir(), "token");
|
|
42900
42943
|
}
|
|
42901
42944
|
function readWorkerToken() {
|
|
42902
42945
|
try {
|
|
@@ -42921,7 +42964,7 @@ function readOrCreateWorkerToken() {
|
|
|
42921
42964
|
var import_node_events2 = require("node:events");
|
|
42922
42965
|
var import_node_fs8 = require("node:fs");
|
|
42923
42966
|
var import_node_os6 = require("node:os");
|
|
42924
|
-
var
|
|
42967
|
+
var import_node_path11 = require("node:path");
|
|
42925
42968
|
|
|
42926
42969
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
42927
42970
|
var nc = __toESM(require("node:crypto"), 1);
|
|
@@ -46492,9 +46535,9 @@ var DirectorRelay = class {
|
|
|
46492
46535
|
|
|
46493
46536
|
// src/remote-phone-relay.ts
|
|
46494
46537
|
function loadOrCreateAgentDeviceKey() {
|
|
46495
|
-
const
|
|
46538
|
+
const path16 = (0, import_node_path11.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-device-key");
|
|
46496
46539
|
try {
|
|
46497
|
-
const raw = JSON.parse((0, import_node_fs8.readFileSync)(
|
|
46540
|
+
const raw = JSON.parse((0, import_node_fs8.readFileSync)(path16, "utf8"));
|
|
46498
46541
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
46499
46542
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
46500
46543
|
}
|
|
@@ -46502,9 +46545,9 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46502
46545
|
}
|
|
46503
46546
|
const kp = generateIdentityKeyPair();
|
|
46504
46547
|
try {
|
|
46505
|
-
(0, import_node_fs8.mkdirSync)((0,
|
|
46548
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path11.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
|
|
46506
46549
|
(0, import_node_fs8.writeFileSync)(
|
|
46507
|
-
|
|
46550
|
+
path16,
|
|
46508
46551
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
46509
46552
|
{ mode: 384 }
|
|
46510
46553
|
);
|
|
@@ -46512,7 +46555,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46512
46555
|
}
|
|
46513
46556
|
return kp;
|
|
46514
46557
|
}
|
|
46515
|
-
var AGENT_PAIRING_PATH = (0,
|
|
46558
|
+
var AGENT_PAIRING_PATH = (0, import_node_path11.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
46516
46559
|
function loadAgentPairing() {
|
|
46517
46560
|
try {
|
|
46518
46561
|
const raw = JSON.parse((0, import_node_fs8.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
@@ -46530,7 +46573,7 @@ function loadAgentPairing() {
|
|
|
46530
46573
|
}
|
|
46531
46574
|
function saveAgentPairing(record2) {
|
|
46532
46575
|
try {
|
|
46533
|
-
(0, import_node_fs8.mkdirSync)((0,
|
|
46576
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path11.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
|
|
46534
46577
|
(0, import_node_fs8.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
46535
46578
|
} catch {
|
|
46536
46579
|
}
|
|
@@ -46709,11 +46752,11 @@ async function renderPairingQrSvg(payload) {
|
|
|
46709
46752
|
|
|
46710
46753
|
// src/checkout-registry.ts
|
|
46711
46754
|
var import_node_fs9 = require("node:fs");
|
|
46712
|
-
var
|
|
46755
|
+
var import_node_path12 = require("node:path");
|
|
46713
46756
|
var CheckoutRegistry = class {
|
|
46714
46757
|
file;
|
|
46715
46758
|
constructor(stateDir) {
|
|
46716
|
-
this.file = (0,
|
|
46759
|
+
this.file = (0, import_node_path12.join)(stateDir, "checkouts.json");
|
|
46717
46760
|
(0, import_node_fs9.mkdirSync)(stateDir, { recursive: true });
|
|
46718
46761
|
}
|
|
46719
46762
|
read() {
|
|
@@ -46727,9 +46770,9 @@ var CheckoutRegistry = class {
|
|
|
46727
46770
|
get(slug) {
|
|
46728
46771
|
return this.read()[slug] ?? null;
|
|
46729
46772
|
}
|
|
46730
|
-
confirm(slug,
|
|
46773
|
+
confirm(slug, path16, now) {
|
|
46731
46774
|
const all = this.read();
|
|
46732
|
-
all[slug] = { path:
|
|
46775
|
+
all[slug] = { path: path16, confirmedAt: now };
|
|
46733
46776
|
(0, import_node_fs9.writeFileSync)(this.file, JSON.stringify(all, null, 2));
|
|
46734
46777
|
}
|
|
46735
46778
|
};
|
|
@@ -46942,7 +46985,7 @@ function extractVerificationSection(markdown) {
|
|
|
46942
46985
|
|
|
46943
46986
|
// src/bridge-log.ts
|
|
46944
46987
|
var import_node_fs10 = require("node:fs");
|
|
46945
|
-
var
|
|
46988
|
+
var import_node_path13 = require("node:path");
|
|
46946
46989
|
|
|
46947
46990
|
// src/redact.ts
|
|
46948
46991
|
var REDACTED = "[REDACTED]";
|
|
@@ -47027,14 +47070,14 @@ function resolvePromptsEnabled(env) {
|
|
|
47027
47070
|
}
|
|
47028
47071
|
function createBridgeLogger(stateDir, env = process.env) {
|
|
47029
47072
|
if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
|
|
47030
|
-
const logsDir = (0,
|
|
47073
|
+
const logsDir = (0, import_node_path13.join)(stateDir, "logs");
|
|
47031
47074
|
try {
|
|
47032
47075
|
(0, import_node_fs10.mkdirSync)(logsDir, { recursive: true });
|
|
47033
47076
|
} catch {
|
|
47034
47077
|
return NOOP_LOGGER;
|
|
47035
47078
|
}
|
|
47036
47079
|
const includePrompts = resolvePromptsEnabled(env);
|
|
47037
|
-
const fileFor = () => (0,
|
|
47080
|
+
const fileFor = () => (0, import_node_path13.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
|
|
47038
47081
|
const write = (dir, rec) => {
|
|
47039
47082
|
try {
|
|
47040
47083
|
const line = JSON.stringify({
|
|
@@ -47127,9 +47170,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
47127
47170
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
47128
47171
|
}
|
|
47129
47172
|
function readCodexFallbackModels() {
|
|
47130
|
-
const codexHome = process.env.CODEX_HOME?.trim() ||
|
|
47173
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path14.default.join(import_node_os7.default.homedir(), ".codex");
|
|
47131
47174
|
const models = /* @__PURE__ */ new Map();
|
|
47132
|
-
const cachePath =
|
|
47175
|
+
const cachePath = import_node_path14.default.join(codexHome, "models_cache.json");
|
|
47133
47176
|
const cacheRaw = readTextIfExists(cachePath);
|
|
47134
47177
|
if (cacheRaw) {
|
|
47135
47178
|
try {
|
|
@@ -47179,7 +47222,7 @@ function readCodexFallbackModels() {
|
|
|
47179
47222
|
);
|
|
47180
47223
|
}
|
|
47181
47224
|
}
|
|
47182
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47225
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path14.default.join(codexHome, "config.toml"))) {
|
|
47183
47226
|
addBridgeModel(
|
|
47184
47227
|
models,
|
|
47185
47228
|
mapBridgeModel({
|
|
@@ -47193,11 +47236,11 @@ function readCodexFallbackModels() {
|
|
|
47193
47236
|
})
|
|
47194
47237
|
);
|
|
47195
47238
|
}
|
|
47196
|
-
const automationsDir =
|
|
47239
|
+
const automationsDir = import_node_path14.default.join(codexHome, "automations");
|
|
47197
47240
|
try {
|
|
47198
47241
|
for (const entry of import_node_fs11.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
47199
47242
|
if (!entry.isDirectory()) continue;
|
|
47200
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
47243
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path14.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
47201
47244
|
addBridgeModel(
|
|
47202
47245
|
models,
|
|
47203
47246
|
mapBridgeModel({
|
|
@@ -47217,7 +47260,7 @@ function readCodexFallbackModels() {
|
|
|
47217
47260
|
return [...models.values()];
|
|
47218
47261
|
}
|
|
47219
47262
|
function neutralCheckoutCwd(stateDir) {
|
|
47220
|
-
const dir =
|
|
47263
|
+
const dir = import_node_path14.default.join(stateDir, "no-checkout");
|
|
47221
47264
|
try {
|
|
47222
47265
|
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
47223
47266
|
} catch {
|
|
@@ -47503,7 +47546,7 @@ function resolveDefaultBranch(checkoutPath) {
|
|
|
47503
47546
|
if (!checkoutPath) return "main";
|
|
47504
47547
|
const runGit = (args) => {
|
|
47505
47548
|
try {
|
|
47506
|
-
return (0,
|
|
47549
|
+
return (0, import_node_child_process10.execFileSync)("git", ["-C", checkoutPath, ...args], {
|
|
47507
47550
|
encoding: "utf8",
|
|
47508
47551
|
stdio: ["ignore", "pipe", "ignore"],
|
|
47509
47552
|
timeout: 15e3,
|
|
@@ -47573,8 +47616,8 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47573
47616
|
}
|
|
47574
47617
|
}
|
|
47575
47618
|
function readStateDir() {
|
|
47576
|
-
if (process.env.CODEX_HOME) return
|
|
47577
|
-
return
|
|
47619
|
+
if (process.env.CODEX_HOME) return import_node_path14.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
|
|
47620
|
+
return import_node_path14.default.join(import_node_os7.default.homedir(), ".mrrlin", "director-bridge");
|
|
47578
47621
|
}
|
|
47579
47622
|
function readAllowedOrigins() {
|
|
47580
47623
|
const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
|
|
@@ -48462,7 +48505,7 @@ function parseConfig() {
|
|
|
48462
48505
|
}
|
|
48463
48506
|
function scanForOtherBridges() {
|
|
48464
48507
|
try {
|
|
48465
|
-
const result = (0,
|
|
48508
|
+
const result = (0, import_node_child_process10.spawnSync)("pgrep", ["-f", "mrrlin-mcp director-bridge"], {
|
|
48466
48509
|
encoding: "utf8"
|
|
48467
48510
|
});
|
|
48468
48511
|
if (result.status !== 0) return [];
|
|
@@ -48489,8 +48532,12 @@ async function startDirectorBridge() {
|
|
|
48489
48532
|
};
|
|
48490
48533
|
const shutdownHolder = { fn: null };
|
|
48491
48534
|
const resumableCountHolder = { fn: null };
|
|
48535
|
+
const { path: binPath, source: binPathSource } = resolveBinPath({
|
|
48536
|
+
argv1: process.argv[1] ?? ""
|
|
48537
|
+
});
|
|
48492
48538
|
const selfUpdateHandle = startSelfUpdate({
|
|
48493
|
-
binPath
|
|
48539
|
+
binPath,
|
|
48540
|
+
binPathSource,
|
|
48494
48541
|
getActiveTurnCount: () => wrappedTurnLock.activeCount(),
|
|
48495
48542
|
getResumableTurnCount: () => resumableCountHolder.fn?.() ?? 0,
|
|
48496
48543
|
getIdleMs: () => Date.now() - lastTurnEndedAt,
|
|
@@ -48597,8 +48644,8 @@ async function startDirectorBridge() {
|
|
|
48597
48644
|
codexCwd: config2.codexCwd,
|
|
48598
48645
|
codexExecutable: config2.codexExecutable,
|
|
48599
48646
|
checkoutRegistry,
|
|
48600
|
-
worktreeRoot:
|
|
48601
|
-
locksDir:
|
|
48647
|
+
worktreeRoot: import_node_path14.default.join(config2.stateDir, "worktrees"),
|
|
48648
|
+
locksDir: import_node_path14.default.join(config2.stateDir, "locks"),
|
|
48602
48649
|
// Wire the executor server for code-execution runs. Each run gets its own app-server
|
|
48603
48650
|
// process at the run worktree, running UNRESTRICTED from the real ~/.codex (owner
|
|
48604
48651
|
// no-sandbox decision — auth + mrrlin MCP come from the operator config).
|
|
@@ -48634,7 +48681,7 @@ async function startDirectorBridge() {
|
|
|
48634
48681
|
// egressDomains is retained in the seam signature (verification-turn.ts still computes the
|
|
48635
48682
|
// env host) but no longer constrains anything — the executor is unrestricted.
|
|
48636
48683
|
startSandbox: async (_egressDomains) => {
|
|
48637
|
-
const cwd = import_node_fs11.default.mkdtempSync(
|
|
48684
|
+
const cwd = import_node_fs11.default.mkdtempSync(import_node_path14.default.join(import_node_os7.default.tmpdir(), "mrrlin-verify-"));
|
|
48638
48685
|
let handle;
|
|
48639
48686
|
try {
|
|
48640
48687
|
handle = await startExecutorServer({ worktree: cwd });
|
|
@@ -48972,8 +49019,8 @@ async function startDirectorBridge() {
|
|
|
48972
49019
|
enqueueRun(
|
|
48973
49020
|
() => runOrphanWorktreeSweep(client, {
|
|
48974
49021
|
checkoutRegistry,
|
|
48975
|
-
worktreeRoot:
|
|
48976
|
-
locksDir:
|
|
49022
|
+
worktreeRoot: import_node_path14.default.join(config2.stateDir, "worktrees"),
|
|
49023
|
+
locksDir: import_node_path14.default.join(config2.stateDir, "locks")
|
|
48977
49024
|
})
|
|
48978
49025
|
);
|
|
48979
49026
|
enqueueRun(async () => {
|
|
@@ -49234,7 +49281,7 @@ function readDispatchBody(req) {
|
|
|
49234
49281
|
function readOrCreateBridgeToken(stateDir) {
|
|
49235
49282
|
const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
|
|
49236
49283
|
if (explicit) return explicit;
|
|
49237
|
-
const tokenPath =
|
|
49284
|
+
const tokenPath = import_node_path14.default.join(stateDir, "token.txt");
|
|
49238
49285
|
try {
|
|
49239
49286
|
const existing = import_node_fs11.default.readFileSync(tokenPath, "utf8").trim();
|
|
49240
49287
|
if (existing) return existing;
|
|
@@ -52627,16 +52674,16 @@ var StdioServerTransport = class {
|
|
|
52627
52674
|
var import_node_crypto10 = require("node:crypto");
|
|
52628
52675
|
var import_promises3 = require("node:fs/promises");
|
|
52629
52676
|
var import_node_fs12 = require("node:fs");
|
|
52630
|
-
var
|
|
52677
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
52631
52678
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
52632
|
-
var
|
|
52679
|
+
var import_node_child_process12 = require("node:child_process");
|
|
52633
52680
|
|
|
52634
52681
|
// ../../packages/wiki/dist/index.js
|
|
52635
52682
|
var import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
52636
|
-
var
|
|
52683
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
52637
52684
|
var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
|
|
52638
52685
|
function toPosixPath(input) {
|
|
52639
|
-
return input.split(
|
|
52686
|
+
return input.split(import_node_path15.default.sep).join("/");
|
|
52640
52687
|
}
|
|
52641
52688
|
function slugifyWikiSegment(input) {
|
|
52642
52689
|
return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -52650,12 +52697,12 @@ async function pathExists2(input) {
|
|
|
52650
52697
|
}
|
|
52651
52698
|
}
|
|
52652
52699
|
async function findWorkspaceRoot(start = process.cwd()) {
|
|
52653
|
-
let current =
|
|
52700
|
+
let current = import_node_path15.default.resolve(start);
|
|
52654
52701
|
while (true) {
|
|
52655
|
-
if (await pathExists2(
|
|
52702
|
+
if (await pathExists2(import_node_path15.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path15.default.join(current, "docs"))) {
|
|
52656
52703
|
return current;
|
|
52657
52704
|
}
|
|
52658
|
-
const parent =
|
|
52705
|
+
const parent = import_node_path15.default.dirname(current);
|
|
52659
52706
|
if (parent === current) {
|
|
52660
52707
|
throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
|
|
52661
52708
|
}
|
|
@@ -52664,28 +52711,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
|
|
|
52664
52711
|
}
|
|
52665
52712
|
async function resolveDocsRoot(input) {
|
|
52666
52713
|
if (input) {
|
|
52667
|
-
return
|
|
52714
|
+
return import_node_path15.default.resolve(input);
|
|
52668
52715
|
}
|
|
52669
52716
|
if (process.env.MRRLIN_DOCS_ROOT) {
|
|
52670
|
-
return
|
|
52717
|
+
return import_node_path15.default.resolve(process.env.MRRLIN_DOCS_ROOT);
|
|
52671
52718
|
}
|
|
52672
|
-
return
|
|
52719
|
+
return import_node_path15.default.join(await findWorkspaceRoot(), "docs");
|
|
52673
52720
|
}
|
|
52674
52721
|
async function resolveIndexPath(input) {
|
|
52675
52722
|
if (input) {
|
|
52676
|
-
return
|
|
52723
|
+
return import_node_path15.default.resolve(input);
|
|
52677
52724
|
}
|
|
52678
52725
|
if (process.env.MRRLIN_WIKI_INDEX_PATH) {
|
|
52679
|
-
return
|
|
52726
|
+
return import_node_path15.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
52680
52727
|
}
|
|
52681
52728
|
const workspaceRoot = await findWorkspaceRoot();
|
|
52682
|
-
return
|
|
52729
|
+
return import_node_path15.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
52683
52730
|
}
|
|
52684
52731
|
async function walkMarkdownFiles(root, dir = root) {
|
|
52685
52732
|
const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
|
|
52686
52733
|
const files = [];
|
|
52687
52734
|
for (const entry of entries) {
|
|
52688
|
-
const absolute =
|
|
52735
|
+
const absolute = import_node_path15.default.join(dir, entry.name);
|
|
52689
52736
|
if (entry.isDirectory()) {
|
|
52690
52737
|
files.push(...await walkMarkdownFiles(root, absolute));
|
|
52691
52738
|
continue;
|
|
@@ -52704,7 +52751,7 @@ function parseTitle(markdown, sourcePath) {
|
|
|
52704
52751
|
return title;
|
|
52705
52752
|
}
|
|
52706
52753
|
function documentFromFile(docsRoot, absolutePath, markdown) {
|
|
52707
|
-
const relativePath = toPosixPath(
|
|
52754
|
+
const relativePath = toPosixPath(import_node_path15.default.relative(docsRoot, absolutePath));
|
|
52708
52755
|
const [section, fileName] = relativePath.split("/");
|
|
52709
52756
|
if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
|
|
52710
52757
|
return null;
|
|
@@ -53067,7 +53114,7 @@ async function runCodeGate(_target, deps) {
|
|
|
53067
53114
|
}
|
|
53068
53115
|
|
|
53069
53116
|
// src/consensus/multi-llm-head.ts
|
|
53070
|
-
var
|
|
53117
|
+
var import_node_child_process11 = require("node:child_process");
|
|
53071
53118
|
function errMessage3(err) {
|
|
53072
53119
|
return err instanceof Error ? err.message : String(err);
|
|
53073
53120
|
}
|
|
@@ -53109,7 +53156,7 @@ function runExternalAgents(bin, args, timeoutMs, spawn3) {
|
|
|
53109
53156
|
});
|
|
53110
53157
|
}
|
|
53111
53158
|
async function pickPanel(input, deps) {
|
|
53112
|
-
const spawn3 = deps?.spawn ??
|
|
53159
|
+
const spawn3 = deps?.spawn ?? import_node_child_process11.spawn;
|
|
53113
53160
|
const bin = deps?.externalAgentsBin ?? "external-agents";
|
|
53114
53161
|
const args = [
|
|
53115
53162
|
"pick",
|
|
@@ -53130,7 +53177,7 @@ async function pickPanel(input, deps) {
|
|
|
53130
53177
|
return { ok: true, agents };
|
|
53131
53178
|
}
|
|
53132
53179
|
async function dispatchHead(agentId, prompt, timeoutMs, deps) {
|
|
53133
|
-
const spawn3 = deps?.spawn ??
|
|
53180
|
+
const spawn3 = deps?.spawn ?? import_node_child_process11.spawn;
|
|
53134
53181
|
const bin = deps?.externalAgentsBin ?? "external-agents";
|
|
53135
53182
|
const args = ["dispatch", agentId, "--json", prompt];
|
|
53136
53183
|
const r = await runExternalAgents(bin, args, timeoutMs, spawn3);
|
|
@@ -53429,12 +53476,19 @@ async function run(ctx, input) {
|
|
|
53429
53476
|
} catch {
|
|
53430
53477
|
}
|
|
53431
53478
|
}
|
|
53479
|
+
let resolvedTaskId = null;
|
|
53480
|
+
try {
|
|
53481
|
+
const page = await ctx.client.getWikiPage(input.projectSlug, input.pageId);
|
|
53482
|
+
resolvedTaskId = page?.taskId ?? null;
|
|
53483
|
+
} catch {
|
|
53484
|
+
}
|
|
53432
53485
|
if (result.outcome === "CONSENSUS_BLOCKED") {
|
|
53433
53486
|
const clarifications = result.clarifications ?? [];
|
|
53434
53487
|
let filedQuestionCount = 0;
|
|
53435
53488
|
if (clarifications.length > 0) {
|
|
53436
53489
|
const page = await ctx.client.getWikiPage(input.projectSlug, input.pageId);
|
|
53437
53490
|
const taskId = page?.taskId ?? null;
|
|
53491
|
+
if (!resolvedTaskId && taskId) resolvedTaskId = taskId;
|
|
53438
53492
|
let planId = null;
|
|
53439
53493
|
if (!taskId) {
|
|
53440
53494
|
const plans = await ctx.client.listPlans(input.projectSlug);
|
|
@@ -53484,7 +53538,13 @@ async function run(ctx, input) {
|
|
|
53484
53538
|
} else {
|
|
53485
53539
|
error51 = "Consensus blocked: reviewers did not converge within budget.";
|
|
53486
53540
|
}
|
|
53487
|
-
return {
|
|
53541
|
+
return {
|
|
53542
|
+
kind: "failed",
|
|
53543
|
+
failureReason: "consensus_blocked",
|
|
53544
|
+
error: error51,
|
|
53545
|
+
filedQuestionCount,
|
|
53546
|
+
...resolvedTaskId ? { taskId: resolvedTaskId } : {}
|
|
53547
|
+
};
|
|
53488
53548
|
}
|
|
53489
53549
|
switch (result.outcome) {
|
|
53490
53550
|
case "CONVERGED":
|
|
@@ -53498,11 +53558,13 @@ async function run(ctx, input) {
|
|
|
53498
53558
|
return {
|
|
53499
53559
|
kind: "failed",
|
|
53500
53560
|
failureReason: "provider_unavailable",
|
|
53501
|
-
error: `Unexpected consensus outcome: ${String(result.outcome)}
|
|
53561
|
+
error: `Unexpected consensus outcome: ${String(result.outcome)}`,
|
|
53562
|
+
...resolvedTaskId ? { taskId: resolvedTaskId } : {}
|
|
53502
53563
|
};
|
|
53503
53564
|
}
|
|
53504
53565
|
}
|
|
53505
53566
|
function onComplete2(outcome, input) {
|
|
53567
|
+
const taskId = outcome.kind === "failed" ? outcome.taskId : void 0;
|
|
53506
53568
|
if (outcome.kind === "done") {
|
|
53507
53569
|
let specOutcome = "CONVERGED";
|
|
53508
53570
|
try {
|
|
@@ -53525,12 +53587,15 @@ function onComplete2(outcome, input) {
|
|
|
53525
53587
|
return {
|
|
53526
53588
|
kind: "info",
|
|
53527
53589
|
suppressInbox: true,
|
|
53590
|
+
...taskId ? { taskId } : {},
|
|
53528
53591
|
body: `Consensus blocked on Specs/${input.pageId}; filed ${n} clarifying question${n === 1 ? "" : "s"} \u2014 answer to unblock the run.`
|
|
53529
53592
|
};
|
|
53530
53593
|
}
|
|
53594
|
+
const taskRef = taskId ? ` (${taskId})` : "";
|
|
53531
53595
|
return {
|
|
53532
53596
|
kind: "handoff",
|
|
53533
|
-
|
|
53597
|
+
...taskId ? { taskId } : {},
|
|
53598
|
+
body: `Consensus could not complete for Specs/${input.pageId}${taskRef}: ${outcome.error} Needs operator attention.`
|
|
53534
53599
|
};
|
|
53535
53600
|
}
|
|
53536
53601
|
var consensusDescriptor = {
|
|
@@ -55168,7 +55233,7 @@ function createMrrlinTools(options) {
|
|
|
55168
55233
|
"ARTIFACT_FILE_UPLOAD_FAILED",
|
|
55169
55234
|
"Unable to upload artifact file.",
|
|
55170
55235
|
async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
|
|
55171
|
-
const extension2 =
|
|
55236
|
+
const extension2 = import_node_path16.default.extname(filePath).toLowerCase();
|
|
55172
55237
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
55173
55238
|
if (!contentType) {
|
|
55174
55239
|
throw new McpToolCodedError(
|
|
@@ -55196,7 +55261,7 @@ function createMrrlinTools(options) {
|
|
|
55196
55261
|
"Artifact exceeds 5MB; split or summarize instead."
|
|
55197
55262
|
);
|
|
55198
55263
|
}
|
|
55199
|
-
const filename =
|
|
55264
|
+
const filename = import_node_path16.default.basename(filePath);
|
|
55200
55265
|
const created = await c.createArtifactFile(projectSlug, {
|
|
55201
55266
|
class: artifactClass,
|
|
55202
55267
|
contentType,
|
|
@@ -55279,7 +55344,7 @@ function createMrrlinTools(options) {
|
|
|
55279
55344
|
"Unable to register local checkout.",
|
|
55280
55345
|
async (_c, { projectSlug, path: checkoutPath, repo }) => {
|
|
55281
55346
|
const trimmedPath = checkoutPath.trim();
|
|
55282
|
-
if (!
|
|
55347
|
+
if (!import_node_path16.default.isAbsolute(trimmedPath)) {
|
|
55283
55348
|
throw new McpToolCodedError(
|
|
55284
55349
|
"LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
|
|
55285
55350
|
`Path must be absolute, got: ${trimmedPath}`
|
|
@@ -55296,7 +55361,7 @@ function createMrrlinTools(options) {
|
|
|
55296
55361
|
}
|
|
55297
55362
|
let remoteUrl;
|
|
55298
55363
|
try {
|
|
55299
|
-
remoteUrl = (0,
|
|
55364
|
+
remoteUrl = (0, import_node_child_process12.execFileSync)("git", ["-C", resolvedPath, "remote", "get-url", "origin"], {
|
|
55300
55365
|
encoding: "utf8",
|
|
55301
55366
|
stdio: ["ignore", "pipe", "ignore"],
|
|
55302
55367
|
timeout: 15e3,
|
|
@@ -55314,7 +55379,7 @@ function createMrrlinTools(options) {
|
|
|
55314
55379
|
`Origin remote ${remoteUrl} does not match repo ${repo}.`
|
|
55315
55380
|
);
|
|
55316
55381
|
}
|
|
55317
|
-
const stateDir = process.env.CODEX_HOME ?
|
|
55382
|
+
const stateDir = process.env.CODEX_HOME ? import_node_path16.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path16.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
|
|
55318
55383
|
const registry3 = new CheckoutRegistry(stateDir);
|
|
55319
55384
|
const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
55320
55385
|
registry3.confirm(projectSlug, resolvedPath, confirmedAt);
|
|
@@ -55522,12 +55587,12 @@ function runSetCredential(args) {
|
|
|
55522
55587
|
|
|
55523
55588
|
// src/install-service.ts
|
|
55524
55589
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
55525
|
-
var
|
|
55590
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
55526
55591
|
|
|
55527
55592
|
// src/service-paths.ts
|
|
55528
|
-
var
|
|
55593
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
55529
55594
|
function isWorktreePath(p) {
|
|
55530
|
-
const norm =
|
|
55595
|
+
const norm = import_node_path17.default.normalize(p).split(import_node_path17.default.sep).join("/");
|
|
55531
55596
|
return norm.includes("/.claude/worktrees/");
|
|
55532
55597
|
}
|
|
55533
55598
|
function resolveServiceCwd(opts) {
|
|
@@ -55592,7 +55657,7 @@ function installService(deps) {
|
|
|
55592
55657
|
return { ok: false };
|
|
55593
55658
|
}
|
|
55594
55659
|
const resolvedBins = bins.filter((b) => b !== null);
|
|
55595
|
-
const pathEnv = Array.from(new Set(resolvedBins.map((b) =>
|
|
55660
|
+
const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path18.default.dirname(b)))).join(":");
|
|
55596
55661
|
const text = renderEcosystemConfig({
|
|
55597
55662
|
cwd: resolved.cwd,
|
|
55598
55663
|
home,
|
|
@@ -55601,7 +55666,7 @@ function installService(deps) {
|
|
|
55601
55666
|
staging: deps.env.MRRLIN_STAGING === "1",
|
|
55602
55667
|
apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
|
|
55603
55668
|
});
|
|
55604
|
-
const ecoPath =
|
|
55669
|
+
const ecoPath = import_node_path18.default.join(home, ".mrrlin", "ecosystem.config.cjs");
|
|
55605
55670
|
deps.writeFile(ecoPath, text);
|
|
55606
55671
|
const start = deps.runPm2(["startOrReload", ecoPath]);
|
|
55607
55672
|
if (start.code !== 0) {
|
|
@@ -55633,12 +55698,12 @@ function uninstallService(deps) {
|
|
|
55633
55698
|
// src/uninstall-codex.ts
|
|
55634
55699
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
55635
55700
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
55636
|
-
var
|
|
55701
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
55637
55702
|
var toml2 = __toESM(require_toml(), 1);
|
|
55638
55703
|
function resolveCodexHome2(options) {
|
|
55639
55704
|
if (options.codexHome) return options.codexHome;
|
|
55640
55705
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
55641
|
-
return
|
|
55706
|
+
return import_node_path19.default.join(options.homeDir ?? import_node_os10.default.homedir(), ".codex");
|
|
55642
55707
|
}
|
|
55643
55708
|
async function pathExists3(target) {
|
|
55644
55709
|
try {
|
|
@@ -55651,7 +55716,7 @@ async function pathExists3(target) {
|
|
|
55651
55716
|
var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
|
|
55652
55717
|
async function uninstallCodex(options = {}) {
|
|
55653
55718
|
const codexHome = resolveCodexHome2(options);
|
|
55654
|
-
const configPath =
|
|
55719
|
+
const configPath = import_node_path19.default.join(codexHome, "config.toml");
|
|
55655
55720
|
const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
|
|
55656
55721
|
if (!await pathExists3(configPath)) {
|
|
55657
55722
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
@@ -55679,10 +55744,10 @@ async function uninstallCodex(options = {}) {
|
|
|
55679
55744
|
}
|
|
55680
55745
|
async function uninstallPrompts(codexHome, names) {
|
|
55681
55746
|
if (names.length === 0) return [];
|
|
55682
|
-
const promptsDir =
|
|
55747
|
+
const promptsDir = import_node_path19.default.join(codexHome, "prompts");
|
|
55683
55748
|
const out = [];
|
|
55684
55749
|
for (const name of names) {
|
|
55685
|
-
const promptPath =
|
|
55750
|
+
const promptPath = import_node_path19.default.join(promptsDir, `${name}.md`);
|
|
55686
55751
|
try {
|
|
55687
55752
|
await import_promises4.default.unlink(promptPath);
|
|
55688
55753
|
out.push({ name, action: "removed", promptPath });
|
|
@@ -55700,13 +55765,13 @@ async function uninstallPrompts(codexHome, names) {
|
|
|
55700
55765
|
|
|
55701
55766
|
// src/bin.ts
|
|
55702
55767
|
function pm2Runner(args) {
|
|
55703
|
-
const r = (0,
|
|
55768
|
+
const r = (0, import_node_child_process13.spawnSync)("pm2", args, { encoding: "utf8" });
|
|
55704
55769
|
process.stderr.write(r.stdout ?? "");
|
|
55705
55770
|
process.stderr.write(r.stderr ?? "");
|
|
55706
55771
|
return { code: r.status ?? 1, stdout: r.stdout ?? "" };
|
|
55707
55772
|
}
|
|
55708
55773
|
function whichBin(bin) {
|
|
55709
|
-
const r = (0,
|
|
55774
|
+
const r = (0, import_node_child_process13.spawnSync)("which", [bin], { encoding: "utf8" });
|
|
55710
55775
|
const out = (r.stdout ?? "").trim();
|
|
55711
55776
|
return r.status === 0 && out ? out.split("\n")[0] ?? null : null;
|
|
55712
55777
|
}
|
|
@@ -55882,7 +55947,7 @@ async function main() {
|
|
|
55882
55947
|
}
|
|
55883
55948
|
case "browser-serve": {
|
|
55884
55949
|
const { command: command2, args, env } = browserServeArgs();
|
|
55885
|
-
const r = (0,
|
|
55950
|
+
const r = (0, import_node_child_process13.spawnSync)(command2, args, { stdio: "inherit", env: { ...process.env, ...env } });
|
|
55886
55951
|
process.exitCode = r.status ?? 1;
|
|
55887
55952
|
return;
|
|
55888
55953
|
}
|
|
@@ -55923,8 +55988,8 @@ async function main() {
|
|
|
55923
55988
|
}
|
|
55924
55989
|
}
|
|
55925
55990
|
try {
|
|
55926
|
-
const codexHome = process.env.CODEX_HOME ??
|
|
55927
|
-
(0, import_node_fs13.rmSync)(
|
|
55991
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path21.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".codex");
|
|
55992
|
+
(0, import_node_fs13.rmSync)(import_node_path21.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
55928
55993
|
} catch {
|
|
55929
55994
|
}
|
|
55930
55995
|
return;
|
|
@@ -55954,7 +56019,7 @@ async function main() {
|
|
|
55954
56019
|
env: process.env,
|
|
55955
56020
|
cwd: process.cwd(),
|
|
55956
56021
|
writeFile: (p, c) => {
|
|
55957
|
-
(0, import_node_fs13.mkdirSync)(
|
|
56022
|
+
(0, import_node_fs13.mkdirSync)(import_node_path21.default.dirname(p), { recursive: true, mode: 448 });
|
|
55958
56023
|
(0, import_node_fs13.writeFileSync)(p, c, { mode: 384 });
|
|
55959
56024
|
},
|
|
55960
56025
|
runPm2: pm2Runner,
|
|
@@ -55979,7 +56044,7 @@ async function main() {
|
|
|
55979
56044
|
purgeSecret: purge,
|
|
55980
56045
|
secretPath: agentCredentialPath(),
|
|
55981
56046
|
tokenPath: operatorTokenPath(),
|
|
55982
|
-
ecoPath:
|
|
56047
|
+
ecoPath: import_node_path21.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
55983
56048
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
55984
56049
|
`)
|
|
55985
56050
|
});
|
|
@@ -56000,7 +56065,7 @@ async function main() {
|
|
|
56000
56065
|
purgeSecret: true,
|
|
56001
56066
|
secretPath: agentCredentialPath(),
|
|
56002
56067
|
tokenPath: operatorTokenPath(),
|
|
56003
|
-
ecoPath:
|
|
56068
|
+
ecoPath: import_node_path21.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
|
|
56004
56069
|
log
|
|
56005
56070
|
});
|
|
56006
56071
|
let codexOk = true;
|
|
@@ -56020,7 +56085,7 @@ async function main() {
|
|
|
56020
56085
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
56021
56086
|
}
|
|
56022
56087
|
try {
|
|
56023
|
-
(0, import_node_fs13.rmSync)(
|
|
56088
|
+
(0, import_node_fs13.rmSync)(import_node_path21.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
56024
56089
|
} catch {
|
|
56025
56090
|
}
|
|
56026
56091
|
log("removed ~/.mrrlin");
|
|
@@ -56061,7 +56126,7 @@ ${HELP_TEXT}`);
|
|
|
56061
56126
|
}
|
|
56062
56127
|
}
|
|
56063
56128
|
function resolveSelfBinPath() {
|
|
56064
|
-
return
|
|
56129
|
+
return import_node_path20.default.resolve(process.argv[1] ?? process.execPath);
|
|
56065
56130
|
}
|
|
56066
56131
|
main().catch((error51) => {
|
|
56067
56132
|
process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
|