@mrrlin-dev/mcp 0.3.24 → 0.3.26
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 +298 -245
- package/package.json +5 -5
package/dist/bin.cjs
CHANGED
|
@@ -7729,14 +7729,14 @@ var require_polyfills = __commonJS({
|
|
|
7729
7729
|
fs7.fstatSync = statFixSync(fs7.fstatSync);
|
|
7730
7730
|
fs7.lstatSync = statFixSync(fs7.lstatSync);
|
|
7731
7731
|
if (fs7.chmod && !fs7.lchmod) {
|
|
7732
|
-
fs7.lchmod = function(
|
|
7732
|
+
fs7.lchmod = function(path16, mode, cb) {
|
|
7733
7733
|
if (cb) process.nextTick(cb);
|
|
7734
7734
|
};
|
|
7735
7735
|
fs7.lchmodSync = function() {
|
|
7736
7736
|
};
|
|
7737
7737
|
}
|
|
7738
7738
|
if (fs7.chown && !fs7.lchown) {
|
|
7739
|
-
fs7.lchown = function(
|
|
7739
|
+
fs7.lchown = function(path16, uid, gid, cb) {
|
|
7740
7740
|
if (cb) process.nextTick(cb);
|
|
7741
7741
|
};
|
|
7742
7742
|
fs7.lchownSync = function() {
|
|
@@ -7803,9 +7803,9 @@ var require_polyfills = __commonJS({
|
|
|
7803
7803
|
};
|
|
7804
7804
|
}(fs7.readSync);
|
|
7805
7805
|
function patchLchmod(fs8) {
|
|
7806
|
-
fs8.lchmod = function(
|
|
7806
|
+
fs8.lchmod = function(path16, mode, callback) {
|
|
7807
7807
|
fs8.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
|
-
fs8.lchmodSync = function(
|
|
7825
|
-
var fd = fs8.openSync(
|
|
7824
|
+
fs8.lchmodSync = function(path16, mode) {
|
|
7825
|
+
var fd = fs8.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(fs8) {
|
|
7845
7845
|
if (constants.hasOwnProperty("O_SYMLINK") && fs8.futimes) {
|
|
7846
|
-
fs8.lutimes = function(
|
|
7847
|
-
fs8.open(
|
|
7846
|
+
fs8.lutimes = function(path16, at, mt, cb) {
|
|
7847
|
+
fs8.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
|
-
fs8.lutimesSync = function(
|
|
7860
|
-
var fd = fs8.openSync(
|
|
7859
|
+
fs8.lutimesSync = function(path16, at, mt) {
|
|
7860
|
+
var fd = fs8.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
|
fs8.createWriteStream = createWriteStream;
|
|
8171
8171
|
var fs$readFile = fs8.readFile;
|
|
8172
8172
|
fs8.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 = fs8.writeFile;
|
|
8189
8189
|
fs8.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 = fs8.appendFile;
|
|
8206
8206
|
if (fs$appendFile)
|
|
8207
8207
|
fs8.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 = fs8.readdir;
|
|
8244
8244
|
fs8.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 fs8.ReadStream(
|
|
8379
|
+
function createReadStream(path16, options) {
|
|
8380
|
+
return new fs8.ReadStream(path16, options);
|
|
8381
8381
|
}
|
|
8382
|
-
function createWriteStream(
|
|
8383
|
-
return new fs8.WriteStream(
|
|
8382
|
+
function createWriteStream(path16, options) {
|
|
8383
|
+
return new fs8.WriteStream(path16, options);
|
|
8384
8384
|
}
|
|
8385
8385
|
var fs$open = fs8.open;
|
|
8386
8386
|
fs8.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 fs7 = 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 = fs7.createWriteStream(
|
|
13289
|
+
const stream = fs7.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 fs7 = require("fs");
|
|
13357
13357
|
const utf8 = exports2.render(qrData, options);
|
|
13358
|
-
fs7.writeFile(
|
|
13358
|
+
fs7.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 fs7 = 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
|
-
fs7.writeFile(
|
|
13535
|
+
fs7.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
|
|
20647
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
20648
20648
|
var import_node_child_process9 = require("node:child_process");
|
|
20649
20649
|
var import_node_fs14 = 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);
|
|
@@ -20980,7 +20980,7 @@ ${block}`;
|
|
|
20980
20980
|
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
20981
20981
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
20982
20982
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
20983
|
-
var
|
|
20983
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
20984
20984
|
var import_node_child_process7 = require("node:child_process");
|
|
20985
20985
|
var import_node_crypto7 = __toESM(require("node:crypto"), 1);
|
|
20986
20986
|
|
|
@@ -22537,10 +22537,10 @@ function mergeDefs(...defs) {
|
|
|
22537
22537
|
function cloneDef(schema) {
|
|
22538
22538
|
return mergeDefs(schema._zod.def);
|
|
22539
22539
|
}
|
|
22540
|
-
function getElementAtPath(obj,
|
|
22541
|
-
if (!
|
|
22540
|
+
function getElementAtPath(obj, path16) {
|
|
22541
|
+
if (!path16)
|
|
22542
22542
|
return obj;
|
|
22543
|
-
return
|
|
22543
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
22544
22544
|
}
|
|
22545
22545
|
function promiseAllObject(promisesObj) {
|
|
22546
22546
|
const keys = Object.keys(promisesObj);
|
|
@@ -22949,11 +22949,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
22949
22949
|
}
|
|
22950
22950
|
return false;
|
|
22951
22951
|
}
|
|
22952
|
-
function prefixIssues(
|
|
22952
|
+
function prefixIssues(path16, issues) {
|
|
22953
22953
|
return issues.map((iss) => {
|
|
22954
22954
|
var _a3;
|
|
22955
22955
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
22956
|
-
iss.path.unshift(
|
|
22956
|
+
iss.path.unshift(path16);
|
|
22957
22957
|
return iss;
|
|
22958
22958
|
});
|
|
22959
22959
|
}
|
|
@@ -23100,16 +23100,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23100
23100
|
}
|
|
23101
23101
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
23102
23102
|
const fieldErrors = { _errors: [] };
|
|
23103
|
-
const processError = (error52,
|
|
23103
|
+
const processError = (error52, path16 = []) => {
|
|
23104
23104
|
for (const issue2 of error52.issues) {
|
|
23105
23105
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23106
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23106
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
23107
23107
|
} else if (issue2.code === "invalid_key") {
|
|
23108
|
-
processError({ issues: issue2.issues }, [...
|
|
23108
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23109
23109
|
} else if (issue2.code === "invalid_element") {
|
|
23110
|
-
processError({ issues: issue2.issues }, [...
|
|
23110
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23111
23111
|
} else {
|
|
23112
|
-
const fullpath = [...
|
|
23112
|
+
const fullpath = [...path16, ...issue2.path];
|
|
23113
23113
|
if (fullpath.length === 0) {
|
|
23114
23114
|
fieldErrors._errors.push(mapper(issue2));
|
|
23115
23115
|
} else {
|
|
@@ -23136,17 +23136,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23136
23136
|
}
|
|
23137
23137
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
23138
23138
|
const result = { errors: [] };
|
|
23139
|
-
const processError = (error52,
|
|
23139
|
+
const processError = (error52, path16 = []) => {
|
|
23140
23140
|
var _a3, _b;
|
|
23141
23141
|
for (const issue2 of error52.issues) {
|
|
23142
23142
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23143
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23143
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
23144
23144
|
} else if (issue2.code === "invalid_key") {
|
|
23145
|
-
processError({ issues: issue2.issues }, [...
|
|
23145
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23146
23146
|
} else if (issue2.code === "invalid_element") {
|
|
23147
|
-
processError({ issues: issue2.issues }, [...
|
|
23147
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
23148
23148
|
} else {
|
|
23149
|
-
const fullpath = [...
|
|
23149
|
+
const fullpath = [...path16, ...issue2.path];
|
|
23150
23150
|
if (fullpath.length === 0) {
|
|
23151
23151
|
result.errors.push(mapper(issue2));
|
|
23152
23152
|
continue;
|
|
@@ -23178,8 +23178,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23178
23178
|
}
|
|
23179
23179
|
function toDotPath(_path) {
|
|
23180
23180
|
const segs = [];
|
|
23181
|
-
const
|
|
23182
|
-
for (const seg of
|
|
23181
|
+
const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
23182
|
+
for (const seg of path16) {
|
|
23183
23183
|
if (typeof seg === "number")
|
|
23184
23184
|
segs.push(`[${seg}]`);
|
|
23185
23185
|
else if (typeof seg === "symbol")
|
|
@@ -35871,13 +35871,13 @@ function resolveRef(ref, ctx) {
|
|
|
35871
35871
|
if (!ref.startsWith("#")) {
|
|
35872
35872
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
35873
35873
|
}
|
|
35874
|
-
const
|
|
35875
|
-
if (
|
|
35874
|
+
const path16 = ref.slice(1).split("/").filter(Boolean);
|
|
35875
|
+
if (path16.length === 0) {
|
|
35876
35876
|
return ctx.rootSchema;
|
|
35877
35877
|
}
|
|
35878
35878
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
35879
|
-
if (
|
|
35880
|
-
const key =
|
|
35879
|
+
if (path16[0] === defsKey) {
|
|
35880
|
+
const key = path16[1];
|
|
35881
35881
|
if (!key || !ctx.defs[key]) {
|
|
35882
35882
|
throw new Error(`Reference not found: ${ref}`);
|
|
35883
35883
|
}
|
|
@@ -37718,18 +37718,18 @@ function createMrrlinClient(config2) {
|
|
|
37718
37718
|
const customFetch = config2.fetch ?? globalThis.fetch;
|
|
37719
37719
|
const baseUrl = config2.baseUrl.replace(/\/$/, "");
|
|
37720
37720
|
const token = config2.token;
|
|
37721
|
-
async function request(
|
|
37721
|
+
async function request(path16, init) {
|
|
37722
37722
|
const method = init?.method ?? "GET";
|
|
37723
37723
|
const headers = new Headers(init?.headers ?? {});
|
|
37724
37724
|
if (token && !headers.has("authorization")) {
|
|
37725
37725
|
headers.set("authorization", `Bearer ${token}`);
|
|
37726
37726
|
}
|
|
37727
|
-
const response = await customFetch(`${baseUrl}${
|
|
37727
|
+
const response = await customFetch(`${baseUrl}${path16}`, { ...init, headers });
|
|
37728
37728
|
if (!response.ok) {
|
|
37729
37729
|
const body = await response.text();
|
|
37730
37730
|
let code = `HTTP_${response.status}`;
|
|
37731
37731
|
let violations = null;
|
|
37732
|
-
let message = `Mrrlin API ${method} ${
|
|
37732
|
+
let message = `Mrrlin API ${method} ${path16} failed: ${response.status}`;
|
|
37733
37733
|
try {
|
|
37734
37734
|
const parsed = JSON.parse(body);
|
|
37735
37735
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -37749,7 +37749,7 @@ function createMrrlinClient(config2) {
|
|
|
37749
37749
|
throw new MrrlinApiError({
|
|
37750
37750
|
code,
|
|
37751
37751
|
method,
|
|
37752
|
-
path:
|
|
37752
|
+
path: path16,
|
|
37753
37753
|
responseBody: body,
|
|
37754
37754
|
status: response.status,
|
|
37755
37755
|
violations,
|
|
@@ -38004,7 +38004,7 @@ function createMrrlinClient(config2) {
|
|
|
38004
38004
|
return taskEventListResponseSchema.parse(body).data;
|
|
38005
38005
|
},
|
|
38006
38006
|
async listTasks(projectSlug, filters = {}) {
|
|
38007
|
-
const
|
|
38007
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
|
|
38008
38008
|
assignee: filters.assignee,
|
|
38009
38009
|
autonomyLevel: filters.autonomyLevel,
|
|
38010
38010
|
blockedBy: filters.blockedBy,
|
|
@@ -38016,7 +38016,7 @@ function createMrrlinClient(config2) {
|
|
|
38016
38016
|
subcategory: filters.subcategory,
|
|
38017
38017
|
type: filters.type
|
|
38018
38018
|
});
|
|
38019
|
-
const body = await request(
|
|
38019
|
+
const body = await request(path16);
|
|
38020
38020
|
return taskListResponseSchema.parse(body).data;
|
|
38021
38021
|
},
|
|
38022
38022
|
async listTaxonomy(projectSlug) {
|
|
@@ -38024,22 +38024,22 @@ function createMrrlinClient(config2) {
|
|
|
38024
38024
|
return taxonomyListResponseSchema.parse(body).data;
|
|
38025
38025
|
},
|
|
38026
38026
|
async listWikiPages(projectSlug, filters = {}) {
|
|
38027
|
-
const
|
|
38027
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
|
|
38028
38028
|
folder: filters.folder,
|
|
38029
38029
|
q: filters.q,
|
|
38030
38030
|
taskId: filters.taskId
|
|
38031
38031
|
});
|
|
38032
|
-
const body = await request(
|
|
38032
|
+
const body = await request(path16);
|
|
38033
38033
|
return wikiPageListResponseSchema.parse(body).data;
|
|
38034
38034
|
},
|
|
38035
38035
|
async searchWikiPages(projectSlug, query) {
|
|
38036
|
-
const
|
|
38036
|
+
const path16 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
|
|
38037
38037
|
folder: query.folder,
|
|
38038
38038
|
limit: query.limit === void 0 ? void 0 : String(query.limit),
|
|
38039
38039
|
pathPrefix: query.pathPrefix,
|
|
38040
38040
|
q: query.q
|
|
38041
38041
|
});
|
|
38042
|
-
const body = await request(
|
|
38042
|
+
const body = await request(path16);
|
|
38043
38043
|
return wikiPageSearchResponseSchema.parse(body).data;
|
|
38044
38044
|
},
|
|
38045
38045
|
async updatePlan(projectSlug, planId, patch) {
|
|
@@ -38781,7 +38781,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
38781
38781
|
}
|
|
38782
38782
|
|
|
38783
38783
|
// src/_generated/version.ts
|
|
38784
|
-
var PKG_VERSION = "0.3.
|
|
38784
|
+
var PKG_VERSION = "0.3.26";
|
|
38785
38785
|
|
|
38786
38786
|
// src/api-base-url.ts
|
|
38787
38787
|
var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
|
|
@@ -38847,7 +38847,6 @@ async function resolveApiBaseUrlDynamic(opts = {}) {
|
|
|
38847
38847
|
|
|
38848
38848
|
// src/scheduler-tick.ts
|
|
38849
38849
|
var SCHEDULER_TICK_MIN_MS = 6e4;
|
|
38850
|
-
var SCHEDULER_TICK_MAX_MS = 9e5;
|
|
38851
38850
|
var SCHEDULER_TICK_FALLBACK_MS = 3e5;
|
|
38852
38851
|
function schedulerTickDisabled(env = process.env) {
|
|
38853
38852
|
return (env.MRRLIN_BRIDGE_SCHEDULER_TICK_DISABLE ?? "").trim() === "1";
|
|
@@ -38862,7 +38861,7 @@ function computeNextTickDelayMs(nextWakeAt, nowMs, opts = {}) {
|
|
|
38862
38861
|
if (typeof nextWakeAt === "string" && nextWakeAt.trim().length > 0) {
|
|
38863
38862
|
const wakeMs = Date.parse(nextWakeAt);
|
|
38864
38863
|
if (!Number.isNaN(wakeMs)) {
|
|
38865
|
-
base = Math.
|
|
38864
|
+
base = Math.max(wakeMs - nowMs, SCHEDULER_TICK_MIN_MS);
|
|
38866
38865
|
}
|
|
38867
38866
|
}
|
|
38868
38867
|
const jitter = base * 0.25 * (random() * 2 - 1);
|
|
@@ -38871,15 +38870,25 @@ function computeNextTickDelayMs(nextWakeAt, nowMs, opts = {}) {
|
|
|
38871
38870
|
function count(value) {
|
|
38872
38871
|
return Array.isArray(value) ? value.length : 0;
|
|
38873
38872
|
}
|
|
38873
|
+
function dispatchTickWork(deps, results) {
|
|
38874
|
+
if (!deps.dispatchEnqueued) return;
|
|
38875
|
+
for (const result of results) {
|
|
38876
|
+
if (typeof result.projectSlug !== "string") continue;
|
|
38877
|
+
for (const run3 of result.createdRuns ?? []) {
|
|
38878
|
+
if (typeof run3.runId === "string") deps.dispatchEnqueued(result.projectSlug, { kind: "execution_run", runId: run3.runId });
|
|
38879
|
+
}
|
|
38880
|
+
for (const job of [...result.enqueuedSpecDrafts ?? [], ...result.enqueuedConsensus ?? []]) {
|
|
38881
|
+
if (typeof job.jobId === "string") deps.dispatchEnqueued(result.projectSlug, { kind: "async_job", jobId: job.jobId });
|
|
38882
|
+
}
|
|
38883
|
+
}
|
|
38884
|
+
}
|
|
38874
38885
|
async function fireSchedulerTick(deps) {
|
|
38875
38886
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
38876
38887
|
try {
|
|
38877
|
-
const response = await fetchImpl(`${deps.apiBaseUrl}/
|
|
38878
|
-
headers: { authorization: `Bearer ${deps.token}` }
|
|
38879
|
-
});
|
|
38888
|
+
const response = await fetchImpl(`${deps.apiBaseUrl}/internal/scheduler/run`, { method: "POST" });
|
|
38880
38889
|
if (!response.ok) {
|
|
38881
38890
|
process.stderr.write(
|
|
38882
|
-
`[mrrlin-mcp director-bridge] scheduler tick failed: HTTP ${response.status} from /
|
|
38891
|
+
`[mrrlin-mcp director-bridge] scheduler tick failed: HTTP ${response.status} from /internal/scheduler/run
|
|
38883
38892
|
`
|
|
38884
38893
|
);
|
|
38885
38894
|
return { nextWakeAt: null };
|
|
@@ -38917,6 +38926,7 @@ async function fireSchedulerTick(deps) {
|
|
|
38917
38926
|
nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null
|
|
38918
38927
|
}
|
|
38919
38928
|
});
|
|
38929
|
+
dispatchTickWork(deps, results);
|
|
38920
38930
|
return { nextWakeAt: typeof data.nextWakeAt === "string" ? data.nextWakeAt : null };
|
|
38921
38931
|
} catch (error51) {
|
|
38922
38932
|
process.stderr.write(
|
|
@@ -38952,6 +38962,7 @@ function startSchedulerTickLoop(deps) {
|
|
|
38952
38962
|
// src/execution-consumer.ts
|
|
38953
38963
|
var import_node_child_process6 = require("node:child_process");
|
|
38954
38964
|
var import_node_crypto4 = __toESM(require("node:crypto"), 1);
|
|
38965
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
38955
38966
|
var import_node_util = require("node:util");
|
|
38956
38967
|
|
|
38957
38968
|
// src/consensus/heads.ts
|
|
@@ -39835,7 +39846,7 @@ function enforceSpecOutputContract(markdown, taskId, title) {
|
|
|
39835
39846
|
${body}`;
|
|
39836
39847
|
}
|
|
39837
39848
|
let tldrChars = 0;
|
|
39838
|
-
const tldrMatch = body.match(/(^##
|
|
39849
|
+
const tldrMatch = body.match(/(^## Summary\s*\n)([\s\S]*?)(?=\n## |$)/im);
|
|
39839
39850
|
if (tldrMatch && tldrMatch.index !== void 0) {
|
|
39840
39851
|
const heading = tldrMatch[1] ?? "";
|
|
39841
39852
|
const section = (tldrMatch[2] ?? "").trim();
|
|
@@ -39883,7 +39894,7 @@ function buildDraftSpecPrompt(task, constitution) {
|
|
|
39883
39894
|
`Return ONLY the full spec markdown, no commentary. Required structure:`,
|
|
39884
39895
|
`- First line heading: \`# ${task.id} \u2014 ${task.title}\``,
|
|
39885
39896
|
`- Sections: Problem, Scope, Non-goals, Acceptance criteria, Verification.`,
|
|
39886
|
-
`- Final section \`##
|
|
39897
|
+
`- Final section \`## Summary\`: a plain-English TL;DR of what will be done and how it`,
|
|
39887
39898
|
` will be verified, at most ${DRAFT_SPEC_TLDR_MAX_CHARS} characters.`
|
|
39888
39899
|
);
|
|
39889
39900
|
return lines2.join("\n");
|
|
@@ -40090,7 +40101,7 @@ function onComplete(outcome, input) {
|
|
|
40090
40101
|
}
|
|
40091
40102
|
return {
|
|
40092
40103
|
kind: "info",
|
|
40093
|
-
body:
|
|
40104
|
+
body: `Spec for ${input.taskId} was drafted automatically \u2014 page ${parsed.pageId ?? "?"} in Specs/. The next scheduler tick will run the consensus review.`
|
|
40094
40105
|
};
|
|
40095
40106
|
}
|
|
40096
40107
|
const summary = outcome.error;
|
|
@@ -40099,7 +40110,7 @@ function onComplete(outcome, input) {
|
|
|
40099
40110
|
kind: "info",
|
|
40100
40111
|
id: `II-sched-draft-failed-${input.taskId}-${hash3}`,
|
|
40101
40112
|
taskId: input.taskId,
|
|
40102
|
-
body:
|
|
40113
|
+
body: `Failed to draft a spec automatically for ${input.taskId} \u2014 please review the task. Reason: ${summary}`
|
|
40103
40114
|
};
|
|
40104
40115
|
}
|
|
40105
40116
|
function createDraftSpecDescriptor(deps = {}) {
|
|
@@ -40120,48 +40131,48 @@ function errMessage2(error51) {
|
|
|
40120
40131
|
function renderMilestone(m, ctx) {
|
|
40121
40132
|
switch (m) {
|
|
40122
40133
|
case "spec_drafted": {
|
|
40123
|
-
let s = "
|
|
40134
|
+
let s = "Drafted the spec and sent it for review";
|
|
40124
40135
|
if (ctx.specUrl) s += ` \u2014 ${ctx.specUrl}`;
|
|
40125
|
-
if (ctx.tldr) s += `.
|
|
40136
|
+
if (ctx.tldr) s += `. Summary: ${ctx.tldr}`;
|
|
40126
40137
|
return s;
|
|
40127
40138
|
}
|
|
40128
40139
|
case "consensus_converged":
|
|
40129
|
-
return "
|
|
40140
|
+
return "Spec review passed \u2014 no issues found";
|
|
40130
40141
|
case "consensus_converged_needs_approval": {
|
|
40131
|
-
let s = "
|
|
40142
|
+
let s = "Spec review passed. Please review and approve";
|
|
40132
40143
|
if (ctx.specUrl) s += ` \u2014 ${ctx.specUrl}`;
|
|
40133
|
-
if (ctx.tldr) s += `.
|
|
40144
|
+
if (ctx.tldr) s += `. Summary: ${ctx.tldr}`;
|
|
40134
40145
|
return s;
|
|
40135
40146
|
}
|
|
40136
40147
|
case "gate_question":
|
|
40137
|
-
return "
|
|
40148
|
+
return "I have a question about this task \u2014 please take a look";
|
|
40138
40149
|
case "run_started":
|
|
40139
|
-
return "
|
|
40150
|
+
return "Started working";
|
|
40140
40151
|
case "pr_opened":
|
|
40141
|
-
return "
|
|
40152
|
+
return "Done and opened a PR";
|
|
40142
40153
|
case "dev_deployed_verified":
|
|
40143
|
-
return "
|
|
40154
|
+
return "Deployed to dev and verified \u2014 it works";
|
|
40144
40155
|
case "grace_started": {
|
|
40145
|
-
let s = "
|
|
40146
|
-
if (ctx.graceUntilHHMM) s += `
|
|
40147
|
-
s += " \u2014
|
|
40156
|
+
let s = "Deployed to dev and verified. I will promote to prod";
|
|
40157
|
+
if (ctx.graceUntilHHMM) s += ` at ${ctx.graceUntilHHMM}`;
|
|
40158
|
+
s += " \u2014 stop me if this is not needed";
|
|
40148
40159
|
return s;
|
|
40149
40160
|
}
|
|
40150
40161
|
case "prod_deployed_verified":
|
|
40151
|
-
return "
|
|
40162
|
+
return "Deployed to prod and verified \u2014 everything works";
|
|
40152
40163
|
case "demoted_blast_radius": {
|
|
40153
|
-
let s = "
|
|
40154
|
-
if (ctx.reason) s += `.
|
|
40164
|
+
let s = "This change looks significant \u2014 waiting for your approval before deploy";
|
|
40165
|
+
if (ctx.reason) s += `. Reason: ${ctx.reason}`;
|
|
40155
40166
|
return s;
|
|
40156
40167
|
}
|
|
40157
40168
|
case "reverted":
|
|
40158
|
-
return "
|
|
40169
|
+
return "Production verification failed \u2014 rolled back, please review when you can";
|
|
40159
40170
|
case "revert_pr_failed":
|
|
40160
|
-
return "
|
|
40171
|
+
return "Production rollback completed, but creating a revert PR failed \u2014 please handle manually";
|
|
40161
40172
|
case "autodeploy_inert_non_code":
|
|
40162
|
-
return "
|
|
40173
|
+
return "Autodeploy is enabled, but this task has nothing deployable \u2014 skipping";
|
|
40163
40174
|
case "daily_limit_reached":
|
|
40164
|
-
return "
|
|
40175
|
+
return "Daily autonomous operations limit reached \u2014 I will continue tomorrow";
|
|
40165
40176
|
}
|
|
40166
40177
|
}
|
|
40167
40178
|
|
|
@@ -40225,9 +40236,9 @@ function deployApprovalItemId(runId, env) {
|
|
|
40225
40236
|
function graceCancelItemId(runId) {
|
|
40226
40237
|
return `II-grace-cancel-${runId}`;
|
|
40227
40238
|
}
|
|
40228
|
-
var APPROVE_ANSWER = "
|
|
40229
|
-
var REJECT_ANSWER = "
|
|
40230
|
-
var GRACE_CANCEL_ANSWER = "
|
|
40239
|
+
var APPROVE_ANSWER = "Approve";
|
|
40240
|
+
var REJECT_ANSWER = "Reject";
|
|
40241
|
+
var GRACE_CANCEL_ANSWER = "stop";
|
|
40231
40242
|
async function findInboxQuestion(client, projectSlug, itemId) {
|
|
40232
40243
|
const items = await client.listInboxItems(projectSlug, { kind: "question" });
|
|
40233
40244
|
return items.find((item) => item.id === itemId) ?? null;
|
|
@@ -40263,11 +40274,11 @@ async function resolveDeployApproval(deps, projectSlug, run3, task, env) {
|
|
|
40263
40274
|
id: itemId,
|
|
40264
40275
|
kind: "question",
|
|
40265
40276
|
taskId: task.id,
|
|
40266
|
-
body:
|
|
40277
|
+
body: `Ready to deploy to ${env}? (task ${task.id} \u2014 ${task.title}, run ${run3.id})`,
|
|
40267
40278
|
origin: "deploy-gate",
|
|
40268
40279
|
questionOptions: [
|
|
40269
|
-
{ label: APPROVE_ANSWER, answer: APPROVE_ANSWER, description:
|
|
40270
|
-
{ label: REJECT_ANSWER, answer: REJECT_ANSWER, description: "
|
|
40280
|
+
{ label: APPROVE_ANSWER, answer: APPROVE_ANSWER, description: `Deploy to ${env}`, recommended: true },
|
|
40281
|
+
{ label: REJECT_ANSWER, answer: REJECT_ANSWER, description: "Do not deploy \u2014 hand it off to me" }
|
|
40271
40282
|
]
|
|
40272
40283
|
}).catch(() => {
|
|
40273
40284
|
});
|
|
@@ -40300,11 +40311,11 @@ async function resolveProdGrace(deps, projectSlug, run3, task, artifacts) {
|
|
|
40300
40311
|
id: cancelId,
|
|
40301
40312
|
kind: "question",
|
|
40302
40313
|
taskId: task.id,
|
|
40303
|
-
body:
|
|
40314
|
+
body: `I will promote to prod at ${formatGraceHHMM(graceUntil)} (task ${task.id} \u2014 ${task.title}). Stop it?`,
|
|
40304
40315
|
origin: "deploy-gate",
|
|
40305
40316
|
questionOptions: [
|
|
40306
|
-
{ label: "
|
|
40307
|
-
{ label: "
|
|
40317
|
+
{ label: "Stop", answer: GRACE_CANCEL_ANSWER, description: "Do not deploy to prod \u2014 hand it off to me" },
|
|
40318
|
+
{ label: "Deploy", answer: "deploy", description: "Looks good, deploy on schedule", recommended: true }
|
|
40308
40319
|
]
|
|
40309
40320
|
}).catch(() => {
|
|
40310
40321
|
});
|
|
@@ -40499,7 +40510,7 @@ async function runDeployGateTick(deps, projectSlug, run3, task) {
|
|
|
40499
40510
|
projectSlug,
|
|
40500
40511
|
task,
|
|
40501
40512
|
run3,
|
|
40502
|
-
`verification_failed:prod (
|
|
40513
|
+
`verification_failed:prod (auto-rollback: prod restored to ${reverted.branch})`
|
|
40503
40514
|
);
|
|
40504
40515
|
return { kind: "handoff", reason: "verification_failed:prod:reverted" };
|
|
40505
40516
|
}
|
|
@@ -40726,12 +40737,19 @@ async function doPushRunBranch(opts, execGit) {
|
|
|
40726
40737
|
}
|
|
40727
40738
|
async function sweepOrphanWorktrees(opts) {
|
|
40728
40739
|
const reaped = [];
|
|
40740
|
+
const ownedPrefix = (() => {
|
|
40741
|
+
try {
|
|
40742
|
+
return (0, import_node_fs4.realpathSync)(opts.worktreeRoot);
|
|
40743
|
+
} catch {
|
|
40744
|
+
return opts.worktreeRoot;
|
|
40745
|
+
}
|
|
40746
|
+
})() + import_node_path5.sep + opts.slug + import_node_path5.sep;
|
|
40729
40747
|
await withCheckoutLock(opts.locksDir, opts.slug, async () => {
|
|
40730
40748
|
const listing = git(opts.checkout, ["worktree", "list", "--porcelain"]);
|
|
40731
40749
|
for (const block of listing.split("\n\n")) {
|
|
40732
40750
|
const m = /^worktree (.+)$/m.exec(block);
|
|
40733
40751
|
const wt = m?.[1];
|
|
40734
|
-
if (wt && wt.
|
|
40752
|
+
if (wt && wt.startsWith(ownedPrefix) && opts.isReapable(wt)) {
|
|
40735
40753
|
try {
|
|
40736
40754
|
git(opts.checkout, ["worktree", "remove", "--force", wt]);
|
|
40737
40755
|
reaped.push(wt);
|
|
@@ -40906,8 +40924,8 @@ function newArtifactId() {
|
|
|
40906
40924
|
return `EA-${import_node_crypto4.default.randomUUID()}`;
|
|
40907
40925
|
}
|
|
40908
40926
|
var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
|
|
40909
|
-
function isBlastRadiusFloorPath(
|
|
40910
|
-
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(
|
|
40927
|
+
function isBlastRadiusFloorPath(path16) {
|
|
40928
|
+
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path16));
|
|
40911
40929
|
}
|
|
40912
40930
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process6.execFile);
|
|
40913
40931
|
async function defaultListRunDiffPaths(opts) {
|
|
@@ -40928,11 +40946,11 @@ async function defaultListRunDiffPaths(opts) {
|
|
|
40928
40946
|
return parse5(stdout);
|
|
40929
40947
|
}
|
|
40930
40948
|
}
|
|
40931
|
-
var BLAST_RADIUS_FLOOR_REASON = "
|
|
40932
|
-
var BLAST_RADIUS_UNKNOWN_REASON = "
|
|
40949
|
+
var BLAST_RADIUS_FLOOR_REASON = "migration or database schema files changed";
|
|
40950
|
+
var BLAST_RADIUS_UNKNOWN_REASON = "could not inspect the diff for risk scoring";
|
|
40933
40951
|
async function resolveEffectiveRisk(deps, worktreePath, projectSlug, review) {
|
|
40934
40952
|
let risk = review?.risk ?? "trivial";
|
|
40935
|
-
let reason = review?.riskReason ?? "
|
|
40953
|
+
let reason = review?.riskReason ?? "self-review marked the change as nontrivial";
|
|
40936
40954
|
try {
|
|
40937
40955
|
const getDefaultBranch = deps.getDefaultBranch ?? (async () => "main");
|
|
40938
40956
|
const listPaths = deps.listRunDiffPaths ?? defaultListRunDiffPaths;
|
|
@@ -41726,6 +41744,13 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
|
|
|
41726
41744
|
running = [];
|
|
41727
41745
|
}
|
|
41728
41746
|
for (const run3 of running) {
|
|
41747
|
+
if (!isRunRecoverableByThisBridge(run3, deps.worktreeRoot)) {
|
|
41748
|
+
process.stderr.write(
|
|
41749
|
+
`[mrrlin] skipping foreign stale run ${slug}/${run3.id}; worktree is owned by another bridge
|
|
41750
|
+
`
|
|
41751
|
+
);
|
|
41752
|
+
continue;
|
|
41753
|
+
}
|
|
41729
41754
|
await deps.client.requeueExecutionRun(slug, run3.id, deps.staleSeconds).catch(() => null);
|
|
41730
41755
|
}
|
|
41731
41756
|
let pending = [];
|
|
@@ -41767,6 +41792,12 @@ async function runBackstopSweep(deps, drive = (slug, id) => driveRun(deps, slug,
|
|
|
41767
41792
|
}
|
|
41768
41793
|
}
|
|
41769
41794
|
}
|
|
41795
|
+
function isRunRecoverableByThisBridge(run3, worktreeRoot) {
|
|
41796
|
+
if (!worktreeRoot) return true;
|
|
41797
|
+
if (!run3.worktreeId) return false;
|
|
41798
|
+
const relative = import_node_path6.default.relative(import_node_path6.default.resolve(worktreeRoot), import_node_path6.default.resolve(run3.worktreeId));
|
|
41799
|
+
return relative === "" || relative.length > 0 && !relative.startsWith("..") && !import_node_path6.default.isAbsolute(relative);
|
|
41800
|
+
}
|
|
41770
41801
|
async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId) {
|
|
41771
41802
|
await deps.client.updateExecutionRun(projectSlug, runId, { status: "failed", finishedAt: (/* @__PURE__ */ new Date()).toISOString(), leaseId: leaseId ?? void 0 }).catch(() => {
|
|
41772
41803
|
});
|
|
@@ -42215,13 +42246,13 @@ function codexIdleMs() {
|
|
|
42215
42246
|
// src/operator-token.ts
|
|
42216
42247
|
var import_node_fs5 = require("node:fs");
|
|
42217
42248
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
42218
|
-
var
|
|
42249
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
42219
42250
|
function operatorDir() {
|
|
42220
|
-
const base = process.env.CODEX_HOME ?
|
|
42251
|
+
const base = process.env.CODEX_HOME ? import_node_path7.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path7.default.join(import_node_os4.default.homedir(), ".mrrlin");
|
|
42221
42252
|
return base;
|
|
42222
42253
|
}
|
|
42223
42254
|
function operatorTokenPath() {
|
|
42224
|
-
return
|
|
42255
|
+
return import_node_path7.default.join(operatorDir(), "operator-token");
|
|
42225
42256
|
}
|
|
42226
42257
|
function readOperatorToken() {
|
|
42227
42258
|
try {
|
|
@@ -42238,7 +42269,7 @@ function persistOperatorToken(token) {
|
|
|
42238
42269
|
`, { encoding: "utf8", mode: 384 });
|
|
42239
42270
|
}
|
|
42240
42271
|
function agentCredentialPath() {
|
|
42241
|
-
return
|
|
42272
|
+
return import_node_path7.default.join(operatorDir(), "agent-credential");
|
|
42242
42273
|
}
|
|
42243
42274
|
function persistAgentSecret(secret) {
|
|
42244
42275
|
const dir = operatorDir();
|
|
@@ -42259,9 +42290,9 @@ function readAgentSecret() {
|
|
|
42259
42290
|
|
|
42260
42291
|
// src/thread-index.ts
|
|
42261
42292
|
var import_node_fs6 = require("node:fs");
|
|
42262
|
-
var
|
|
42293
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
42263
42294
|
function threadIndexPath(stateDir) {
|
|
42264
|
-
return
|
|
42295
|
+
return import_node_path8.default.join(stateDir, "threads.json");
|
|
42265
42296
|
}
|
|
42266
42297
|
function loadThreadIndex(stateDir, ttlMs, now) {
|
|
42267
42298
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -42378,7 +42409,7 @@ function chatTurnMaxMs() {
|
|
|
42378
42409
|
var import_node_crypto6 = require("node:crypto");
|
|
42379
42410
|
var import_node_fs7 = require("node:fs");
|
|
42380
42411
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
42381
|
-
var
|
|
42412
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
42382
42413
|
var DEFAULT_WORKER_PORT = 8792;
|
|
42383
42414
|
function workerPort() {
|
|
42384
42415
|
const raw = process.env.MRRLIN_WORKER_PORT;
|
|
@@ -42387,11 +42418,11 @@ function workerPort() {
|
|
|
42387
42418
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
|
|
42388
42419
|
}
|
|
42389
42420
|
function workerDir() {
|
|
42390
|
-
const base = process.env.CODEX_HOME ?
|
|
42391
|
-
return
|
|
42421
|
+
const base = process.env.CODEX_HOME ? import_node_path9.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path9.default.join(import_node_os5.default.homedir(), ".mrrlin");
|
|
42422
|
+
return import_node_path9.default.join(base, "worker");
|
|
42392
42423
|
}
|
|
42393
42424
|
function workerTokenPath() {
|
|
42394
|
-
return
|
|
42425
|
+
return import_node_path9.default.join(workerDir(), "token");
|
|
42395
42426
|
}
|
|
42396
42427
|
function readWorkerToken() {
|
|
42397
42428
|
try {
|
|
@@ -42416,7 +42447,7 @@ function readOrCreateWorkerToken() {
|
|
|
42416
42447
|
var import_node_events2 = require("node:events");
|
|
42417
42448
|
var import_node_fs8 = require("node:fs");
|
|
42418
42449
|
var import_node_os6 = require("node:os");
|
|
42419
|
-
var
|
|
42450
|
+
var import_node_path10 = require("node:path");
|
|
42420
42451
|
|
|
42421
42452
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
42422
42453
|
var nc = __toESM(require("node:crypto"), 1);
|
|
@@ -45987,9 +46018,9 @@ var DirectorRelay = class {
|
|
|
45987
46018
|
|
|
45988
46019
|
// src/remote-phone-relay.ts
|
|
45989
46020
|
function loadOrCreateAgentDeviceKey() {
|
|
45990
|
-
const
|
|
46021
|
+
const path16 = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-device-key");
|
|
45991
46022
|
try {
|
|
45992
|
-
const raw = JSON.parse((0, import_node_fs8.readFileSync)(
|
|
46023
|
+
const raw = JSON.parse((0, import_node_fs8.readFileSync)(path16, "utf8"));
|
|
45993
46024
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
45994
46025
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
45995
46026
|
}
|
|
@@ -45997,9 +46028,9 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
45997
46028
|
}
|
|
45998
46029
|
const kp = generateIdentityKeyPair();
|
|
45999
46030
|
try {
|
|
46000
|
-
(0, import_node_fs8.mkdirSync)((0,
|
|
46031
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
|
|
46001
46032
|
(0, import_node_fs8.writeFileSync)(
|
|
46002
|
-
|
|
46033
|
+
path16,
|
|
46003
46034
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
46004
46035
|
{ mode: 384 }
|
|
46005
46036
|
);
|
|
@@ -46007,7 +46038,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
46007
46038
|
}
|
|
46008
46039
|
return kp;
|
|
46009
46040
|
}
|
|
46010
|
-
var AGENT_PAIRING_PATH = (0,
|
|
46041
|
+
var AGENT_PAIRING_PATH = (0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
46011
46042
|
function loadAgentPairing() {
|
|
46012
46043
|
try {
|
|
46013
46044
|
const raw = JSON.parse((0, import_node_fs8.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
@@ -46025,7 +46056,7 @@ function loadAgentPairing() {
|
|
|
46025
46056
|
}
|
|
46026
46057
|
function saveAgentPairing(record2) {
|
|
46027
46058
|
try {
|
|
46028
|
-
(0, import_node_fs8.mkdirSync)((0,
|
|
46059
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path10.join)((0, import_node_os6.homedir)(), ".mrrlin"), { recursive: true });
|
|
46029
46060
|
(0, import_node_fs8.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
46030
46061
|
} catch {
|
|
46031
46062
|
}
|
|
@@ -46204,11 +46235,11 @@ async function renderPairingQrSvg(payload) {
|
|
|
46204
46235
|
|
|
46205
46236
|
// src/checkout-registry.ts
|
|
46206
46237
|
var import_node_fs9 = require("node:fs");
|
|
46207
|
-
var
|
|
46238
|
+
var import_node_path11 = require("node:path");
|
|
46208
46239
|
var CheckoutRegistry = class {
|
|
46209
46240
|
file;
|
|
46210
46241
|
constructor(stateDir) {
|
|
46211
|
-
this.file = (0,
|
|
46242
|
+
this.file = (0, import_node_path11.join)(stateDir, "checkouts.json");
|
|
46212
46243
|
(0, import_node_fs9.mkdirSync)(stateDir, { recursive: true });
|
|
46213
46244
|
}
|
|
46214
46245
|
read() {
|
|
@@ -46222,9 +46253,9 @@ var CheckoutRegistry = class {
|
|
|
46222
46253
|
get(slug) {
|
|
46223
46254
|
return this.read()[slug] ?? null;
|
|
46224
46255
|
}
|
|
46225
|
-
confirm(slug,
|
|
46256
|
+
confirm(slug, path16, now) {
|
|
46226
46257
|
const all = this.read();
|
|
46227
|
-
all[slug] = { path:
|
|
46258
|
+
all[slug] = { path: path16, confirmedAt: now };
|
|
46228
46259
|
(0, import_node_fs9.writeFileSync)(this.file, JSON.stringify(all, null, 2));
|
|
46229
46260
|
}
|
|
46230
46261
|
};
|
|
@@ -46437,7 +46468,7 @@ function extractVerificationSection(markdown) {
|
|
|
46437
46468
|
|
|
46438
46469
|
// src/bridge-log.ts
|
|
46439
46470
|
var import_node_fs10 = require("node:fs");
|
|
46440
|
-
var
|
|
46471
|
+
var import_node_path12 = require("node:path");
|
|
46441
46472
|
|
|
46442
46473
|
// src/redact.ts
|
|
46443
46474
|
var REDACTED = "[REDACTED]";
|
|
@@ -46522,14 +46553,14 @@ function resolvePromptsEnabled(env) {
|
|
|
46522
46553
|
}
|
|
46523
46554
|
function createBridgeLogger(stateDir, env = process.env) {
|
|
46524
46555
|
if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
|
|
46525
|
-
const logsDir = (0,
|
|
46556
|
+
const logsDir = (0, import_node_path12.join)(stateDir, "logs");
|
|
46526
46557
|
try {
|
|
46527
46558
|
(0, import_node_fs10.mkdirSync)(logsDir, { recursive: true });
|
|
46528
46559
|
} catch {
|
|
46529
46560
|
return NOOP_LOGGER;
|
|
46530
46561
|
}
|
|
46531
46562
|
const includePrompts = resolvePromptsEnabled(env);
|
|
46532
|
-
const fileFor = () => (0,
|
|
46563
|
+
const fileFor = () => (0, import_node_path12.join)(logsDir, `bridge-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.jsonl`);
|
|
46533
46564
|
const write = (dir, rec) => {
|
|
46534
46565
|
try {
|
|
46535
46566
|
const line = JSON.stringify({
|
|
@@ -46619,9 +46650,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
46619
46650
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
46620
46651
|
}
|
|
46621
46652
|
function readCodexFallbackModels() {
|
|
46622
|
-
const codexHome = process.env.CODEX_HOME?.trim() ||
|
|
46653
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path13.default.join(import_node_os7.default.homedir(), ".codex");
|
|
46623
46654
|
const models = /* @__PURE__ */ new Map();
|
|
46624
|
-
const cachePath =
|
|
46655
|
+
const cachePath = import_node_path13.default.join(codexHome, "models_cache.json");
|
|
46625
46656
|
const cacheRaw = readTextIfExists(cachePath);
|
|
46626
46657
|
if (cacheRaw) {
|
|
46627
46658
|
try {
|
|
@@ -46671,7 +46702,7 @@ function readCodexFallbackModels() {
|
|
|
46671
46702
|
);
|
|
46672
46703
|
}
|
|
46673
46704
|
}
|
|
46674
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
46705
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path13.default.join(codexHome, "config.toml"))) {
|
|
46675
46706
|
addBridgeModel(
|
|
46676
46707
|
models,
|
|
46677
46708
|
mapBridgeModel({
|
|
@@ -46685,11 +46716,11 @@ function readCodexFallbackModels() {
|
|
|
46685
46716
|
})
|
|
46686
46717
|
);
|
|
46687
46718
|
}
|
|
46688
|
-
const automationsDir =
|
|
46719
|
+
const automationsDir = import_node_path13.default.join(codexHome, "automations");
|
|
46689
46720
|
try {
|
|
46690
46721
|
for (const entry of import_node_fs11.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
46691
46722
|
if (!entry.isDirectory()) continue;
|
|
46692
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
46723
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path13.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
46693
46724
|
addBridgeModel(
|
|
46694
46725
|
models,
|
|
46695
46726
|
mapBridgeModel({
|
|
@@ -46709,7 +46740,7 @@ function readCodexFallbackModels() {
|
|
|
46709
46740
|
return [...models.values()];
|
|
46710
46741
|
}
|
|
46711
46742
|
function neutralCheckoutCwd(stateDir) {
|
|
46712
|
-
const dir =
|
|
46743
|
+
const dir = import_node_path13.default.join(stateDir, "no-checkout");
|
|
46713
46744
|
try {
|
|
46714
46745
|
import_node_fs11.default.mkdirSync(dir, { recursive: true });
|
|
46715
46746
|
} catch {
|
|
@@ -46725,7 +46756,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
|
|
|
46725
46756
|
"required before the result LANDS (merge/deploy); it does not authorize building on unvalidated",
|
|
46726
46757
|
"assumptions. Judge clarification on requirement clarity, independently of autonomy_level.",
|
|
46727
46758
|
"Never announce or pre-narrate that you are about to use tools, and never name the toolset in",
|
|
46728
|
-
`prose. Do NOT write openers like "I'll use the Mrrlin tools to\u2026"
|
|
46759
|
+
`prose. Do NOT write openers like "I'll use the Mrrlin tools to\u2026",`,
|
|
46729
46760
|
'or "let me call the \u2026 tool" in ANY language. The operator already sees tool calls in the',
|
|
46730
46761
|
"transcript. Just call the tools and reply with the outcome \u2014 start your reply with the result.",
|
|
46731
46762
|
"When creating or updating tasks, always provide `autonomyLevel` and `autonomyReason`.",
|
|
@@ -47028,6 +47059,7 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47028
47059
|
try {
|
|
47029
47060
|
const reaped = await sweepOrphanWorktrees({
|
|
47030
47061
|
checkout: checkout.path,
|
|
47062
|
+
worktreeRoot: opts.worktreeRoot,
|
|
47031
47063
|
locksDir: opts.locksDir,
|
|
47032
47064
|
slug,
|
|
47033
47065
|
isReapable
|
|
@@ -47047,8 +47079,8 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
47047
47079
|
}
|
|
47048
47080
|
}
|
|
47049
47081
|
function readStateDir() {
|
|
47050
|
-
if (process.env.CODEX_HOME) return
|
|
47051
|
-
return
|
|
47082
|
+
if (process.env.CODEX_HOME) return import_node_path13.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
|
|
47083
|
+
return import_node_path13.default.join(import_node_os7.default.homedir(), ".mrrlin", "director-bridge");
|
|
47052
47084
|
}
|
|
47053
47085
|
function readAllowedOrigins() {
|
|
47054
47086
|
const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
|
|
@@ -48025,8 +48057,8 @@ async function startDirectorBridge() {
|
|
|
48025
48057
|
codexCwd: config2.codexCwd,
|
|
48026
48058
|
codexExecutable: config2.codexExecutable,
|
|
48027
48059
|
checkoutRegistry,
|
|
48028
|
-
worktreeRoot:
|
|
48029
|
-
locksDir:
|
|
48060
|
+
worktreeRoot: import_node_path13.default.join(config2.stateDir, "worktrees"),
|
|
48061
|
+
locksDir: import_node_path13.default.join(config2.stateDir, "locks"),
|
|
48030
48062
|
// Wire the executor server for code-execution runs. Each run gets its own app-server
|
|
48031
48063
|
// process at the run worktree, running UNRESTRICTED from the real ~/.codex (owner
|
|
48032
48064
|
// no-sandbox decision — auth + mrrlin MCP come from the operator config).
|
|
@@ -48062,7 +48094,7 @@ async function startDirectorBridge() {
|
|
|
48062
48094
|
// egressDomains is retained in the seam signature (verification-turn.ts still computes the
|
|
48063
48095
|
// env host) but no longer constrains anything — the executor is unrestricted.
|
|
48064
48096
|
startSandbox: async (_egressDomains) => {
|
|
48065
|
-
const cwd = import_node_fs11.default.mkdtempSync(
|
|
48097
|
+
const cwd = import_node_fs11.default.mkdtempSync(import_node_path13.default.join(import_node_os7.default.tmpdir(), "mrrlin-verify-"));
|
|
48066
48098
|
let handle;
|
|
48067
48099
|
try {
|
|
48068
48100
|
handle = await startExecutorServer({ worktree: cwd });
|
|
@@ -48142,6 +48174,16 @@ async function startDirectorBridge() {
|
|
|
48142
48174
|
consumerState.inFlightRunId = null;
|
|
48143
48175
|
}
|
|
48144
48176
|
});
|
|
48177
|
+
const driveRunNow = (slug, runId) => {
|
|
48178
|
+
consumerState.inFlightRunId = runId;
|
|
48179
|
+
consumerState.lastClaimAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
48180
|
+
void driveRun(consumerDeps, slug, runId).catch((error51) => {
|
|
48181
|
+
process.stderr.write(`[mrrlin-mcp director-bridge] drive failed for ${slug}/${runId}: ${error51 instanceof Error ? error51.message : String(error51)}
|
|
48182
|
+
`);
|
|
48183
|
+
}).finally(() => {
|
|
48184
|
+
consumerState.inFlightRunId = null;
|
|
48185
|
+
});
|
|
48186
|
+
};
|
|
48145
48187
|
const driveAsyncTracked = (slug, jobId) => enqueueRun(async () => {
|
|
48146
48188
|
try {
|
|
48147
48189
|
await driveAsyncJob(asyncConsumerDeps, slug, jobId);
|
|
@@ -48150,6 +48192,12 @@ async function startDirectorBridge() {
|
|
|
48150
48192
|
`);
|
|
48151
48193
|
}
|
|
48152
48194
|
});
|
|
48195
|
+
const driveAsyncNow = (slug, jobId) => {
|
|
48196
|
+
void driveAsyncJob(asyncConsumerDeps, slug, jobId).catch((error51) => {
|
|
48197
|
+
process.stderr.write(`[mrrlin-mcp director-bridge] async drive failed for ${slug}/${jobId}: ${error51 instanceof Error ? error51.message : String(error51)}
|
|
48198
|
+
`);
|
|
48199
|
+
});
|
|
48200
|
+
};
|
|
48153
48201
|
const server = import_node_http.default.createServer(
|
|
48154
48202
|
createBridgeRequestListener({
|
|
48155
48203
|
host: config2.host,
|
|
@@ -48344,8 +48392,8 @@ async function startDirectorBridge() {
|
|
|
48344
48392
|
}
|
|
48345
48393
|
res.writeHead(202, { "content-type": "application/json" });
|
|
48346
48394
|
res.end(JSON.stringify({ ok: true }));
|
|
48347
|
-
if (jobId)
|
|
48348
|
-
else
|
|
48395
|
+
if (jobId) driveAsyncNow(slug, jobId);
|
|
48396
|
+
else driveRunNow(slug, runId);
|
|
48349
48397
|
}).catch(() => {
|
|
48350
48398
|
res.writeHead(400).end();
|
|
48351
48399
|
});
|
|
@@ -48380,8 +48428,8 @@ async function startDirectorBridge() {
|
|
|
48380
48428
|
enqueueRun(
|
|
48381
48429
|
() => runOrphanWorktreeSweep(client, {
|
|
48382
48430
|
checkoutRegistry,
|
|
48383
|
-
worktreeRoot:
|
|
48384
|
-
locksDir:
|
|
48431
|
+
worktreeRoot: import_node_path13.default.join(config2.stateDir, "worktrees"),
|
|
48432
|
+
locksDir: import_node_path13.default.join(config2.stateDir, "locks")
|
|
48385
48433
|
})
|
|
48386
48434
|
);
|
|
48387
48435
|
enqueueRun(async () => {
|
|
@@ -48437,12 +48485,19 @@ async function startDirectorBridge() {
|
|
|
48437
48485
|
);
|
|
48438
48486
|
}
|
|
48439
48487
|
let schedulerTickHandle = null;
|
|
48440
|
-
|
|
48441
|
-
|
|
48442
|
-
|
|
48443
|
-
|
|
48488
|
+
if (tokenProvider && !schedulerTickDisabled(process.env)) {
|
|
48489
|
+
schedulerTickHandle = startSchedulerTickLoop({
|
|
48490
|
+
apiBaseUrl,
|
|
48491
|
+
fetchImpl: authedFetch,
|
|
48492
|
+
logger: bridgeLogger,
|
|
48493
|
+
dispatchEnqueued: (projectSlug, work) => {
|
|
48494
|
+
if (work.kind === "execution_run") driveRunNow(projectSlug, work.runId);
|
|
48495
|
+
else driveAsyncNow(projectSlug, work.jobId);
|
|
48496
|
+
}
|
|
48497
|
+
});
|
|
48498
|
+
} else if (!tokenProvider) {
|
|
48444
48499
|
process.stderr.write(
|
|
48445
|
-
"[mrrlin-mcp director-bridge] no
|
|
48500
|
+
"[mrrlin-mcp director-bridge] no durable agent credential; skipping bridge scheduler tick loop.\n"
|
|
48446
48501
|
);
|
|
48447
48502
|
} else {
|
|
48448
48503
|
process.stderr.write(
|
|
@@ -48623,7 +48678,7 @@ function readDispatchBody(req) {
|
|
|
48623
48678
|
function readOrCreateBridgeToken(stateDir) {
|
|
48624
48679
|
const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
|
|
48625
48680
|
if (explicit) return explicit;
|
|
48626
|
-
const tokenPath =
|
|
48681
|
+
const tokenPath = import_node_path13.default.join(stateDir, "token.txt");
|
|
48627
48682
|
try {
|
|
48628
48683
|
const existing = import_node_fs11.default.readFileSync(tokenPath, "utf8").trim();
|
|
48629
48684
|
if (existing) return existing;
|
|
@@ -52016,16 +52071,16 @@ var StdioServerTransport = class {
|
|
|
52016
52071
|
var import_node_crypto10 = require("node:crypto");
|
|
52017
52072
|
var import_promises3 = require("node:fs/promises");
|
|
52018
52073
|
var import_node_fs12 = require("node:fs");
|
|
52019
|
-
var
|
|
52074
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
52020
52075
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
52021
52076
|
var import_node_child_process8 = require("node:child_process");
|
|
52022
52077
|
|
|
52023
52078
|
// ../../packages/wiki/dist/index.js
|
|
52024
52079
|
var import_promises2 = __toESM(require("node:fs/promises"), 1);
|
|
52025
|
-
var
|
|
52080
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
52026
52081
|
var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
|
|
52027
52082
|
function toPosixPath(input) {
|
|
52028
|
-
return input.split(
|
|
52083
|
+
return input.split(import_node_path14.default.sep).join("/");
|
|
52029
52084
|
}
|
|
52030
52085
|
function slugifyWikiSegment(input) {
|
|
52031
52086
|
return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -52039,12 +52094,12 @@ async function pathExists2(input) {
|
|
|
52039
52094
|
}
|
|
52040
52095
|
}
|
|
52041
52096
|
async function findWorkspaceRoot(start = process.cwd()) {
|
|
52042
|
-
let current =
|
|
52097
|
+
let current = import_node_path14.default.resolve(start);
|
|
52043
52098
|
while (true) {
|
|
52044
|
-
if (await pathExists2(
|
|
52099
|
+
if (await pathExists2(import_node_path14.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path14.default.join(current, "docs"))) {
|
|
52045
52100
|
return current;
|
|
52046
52101
|
}
|
|
52047
|
-
const parent =
|
|
52102
|
+
const parent = import_node_path14.default.dirname(current);
|
|
52048
52103
|
if (parent === current) {
|
|
52049
52104
|
throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
|
|
52050
52105
|
}
|
|
@@ -52053,28 +52108,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
|
|
|
52053
52108
|
}
|
|
52054
52109
|
async function resolveDocsRoot(input) {
|
|
52055
52110
|
if (input) {
|
|
52056
|
-
return
|
|
52111
|
+
return import_node_path14.default.resolve(input);
|
|
52057
52112
|
}
|
|
52058
52113
|
if (process.env.MRRLIN_DOCS_ROOT) {
|
|
52059
|
-
return
|
|
52114
|
+
return import_node_path14.default.resolve(process.env.MRRLIN_DOCS_ROOT);
|
|
52060
52115
|
}
|
|
52061
|
-
return
|
|
52116
|
+
return import_node_path14.default.join(await findWorkspaceRoot(), "docs");
|
|
52062
52117
|
}
|
|
52063
52118
|
async function resolveIndexPath(input) {
|
|
52064
52119
|
if (input) {
|
|
52065
|
-
return
|
|
52120
|
+
return import_node_path14.default.resolve(input);
|
|
52066
52121
|
}
|
|
52067
52122
|
if (process.env.MRRLIN_WIKI_INDEX_PATH) {
|
|
52068
|
-
return
|
|
52123
|
+
return import_node_path14.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
52069
52124
|
}
|
|
52070
52125
|
const workspaceRoot = await findWorkspaceRoot();
|
|
52071
|
-
return
|
|
52126
|
+
return import_node_path14.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
52072
52127
|
}
|
|
52073
52128
|
async function walkMarkdownFiles(root, dir = root) {
|
|
52074
52129
|
const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
|
|
52075
52130
|
const files = [];
|
|
52076
52131
|
for (const entry of entries) {
|
|
52077
|
-
const absolute =
|
|
52132
|
+
const absolute = import_node_path14.default.join(dir, entry.name);
|
|
52078
52133
|
if (entry.isDirectory()) {
|
|
52079
52134
|
files.push(...await walkMarkdownFiles(root, absolute));
|
|
52080
52135
|
continue;
|
|
@@ -52093,7 +52148,7 @@ function parseTitle(markdown, sourcePath) {
|
|
|
52093
52148
|
return title;
|
|
52094
52149
|
}
|
|
52095
52150
|
function documentFromFile(docsRoot, absolutePath, markdown) {
|
|
52096
|
-
const relativePath = toPosixPath(
|
|
52151
|
+
const relativePath = toPosixPath(import_node_path14.default.relative(docsRoot, absolutePath));
|
|
52097
52152
|
const [section, fileName] = relativePath.split("/");
|
|
52098
52153
|
if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
|
|
52099
52154
|
return null;
|
|
@@ -54230,7 +54285,7 @@ function createMrrlinTools(options) {
|
|
|
54230
54285
|
"ARTIFACT_FILE_UPLOAD_FAILED",
|
|
54231
54286
|
"Unable to upload artifact file.",
|
|
54232
54287
|
async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
|
|
54233
|
-
const extension2 =
|
|
54288
|
+
const extension2 = import_node_path15.default.extname(filePath).toLowerCase();
|
|
54234
54289
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
54235
54290
|
if (!contentType) {
|
|
54236
54291
|
throw new McpToolCodedError(
|
|
@@ -54258,7 +54313,7 @@ function createMrrlinTools(options) {
|
|
|
54258
54313
|
"Artifact exceeds 5MB; split or summarize instead."
|
|
54259
54314
|
);
|
|
54260
54315
|
}
|
|
54261
|
-
const filename =
|
|
54316
|
+
const filename = import_node_path15.default.basename(filePath);
|
|
54262
54317
|
const created = await c.createArtifactFile(projectSlug, {
|
|
54263
54318
|
class: artifactClass,
|
|
54264
54319
|
contentType,
|
|
@@ -54341,7 +54396,7 @@ function createMrrlinTools(options) {
|
|
|
54341
54396
|
"Unable to register local checkout.",
|
|
54342
54397
|
async (_c, { projectSlug, path: checkoutPath, repo }) => {
|
|
54343
54398
|
const trimmedPath = checkoutPath.trim();
|
|
54344
|
-
if (!
|
|
54399
|
+
if (!import_node_path15.default.isAbsolute(trimmedPath)) {
|
|
54345
54400
|
throw new McpToolCodedError(
|
|
54346
54401
|
"LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
|
|
54347
54402
|
`Path must be absolute, got: ${trimmedPath}`
|
|
@@ -54376,7 +54431,7 @@ function createMrrlinTools(options) {
|
|
|
54376
54431
|
`Origin remote ${remoteUrl} does not match repo ${repo}.`
|
|
54377
54432
|
);
|
|
54378
54433
|
}
|
|
54379
|
-
const stateDir = process.env.CODEX_HOME ?
|
|
54434
|
+
const stateDir = process.env.CODEX_HOME ? import_node_path15.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path15.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
|
|
54380
54435
|
const registry3 = new CheckoutRegistry(stateDir);
|
|
54381
54436
|
const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
54382
54437
|
registry3.confirm(projectSlug, resolvedPath, confirmedAt);
|
|
@@ -54584,12 +54639,12 @@ function runSetCredential(args) {
|
|
|
54584
54639
|
|
|
54585
54640
|
// src/install-service.ts
|
|
54586
54641
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
54587
|
-
var
|
|
54642
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
54588
54643
|
|
|
54589
54644
|
// src/service-paths.ts
|
|
54590
|
-
var
|
|
54645
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
54591
54646
|
function isWorktreePath(p) {
|
|
54592
|
-
const norm =
|
|
54647
|
+
const norm = import_node_path16.default.normalize(p).split(import_node_path16.default.sep).join("/");
|
|
54593
54648
|
return norm.includes("/.claude/worktrees/");
|
|
54594
54649
|
}
|
|
54595
54650
|
function resolveServiceCwd(opts) {
|
|
@@ -54612,7 +54667,6 @@ function renderEcosystemConfig(opts) {
|
|
|
54612
54667
|
if (opts.codexHome) env.CODEX_HOME = opts.codexHome;
|
|
54613
54668
|
if (opts.staging) env.MRRLIN_STAGING = "1";
|
|
54614
54669
|
else if (opts.apiBaseUrl) env.MRRLIN_API_BASE_URL = opts.apiBaseUrl;
|
|
54615
|
-
if (opts.schedulerToken) env.MRRLIN_SCHEDULER_TOKEN = opts.schedulerToken;
|
|
54616
54670
|
const envLines = Object.entries(env).map(([k, v]) => ` ${k}: ${JSON.stringify(v)},`).join("\n");
|
|
54617
54671
|
return `module.exports = {
|
|
54618
54672
|
apps: [{
|
|
@@ -54655,17 +54709,16 @@ function installService(deps) {
|
|
|
54655
54709
|
return { ok: false };
|
|
54656
54710
|
}
|
|
54657
54711
|
const resolvedBins = bins.filter((b) => b !== null);
|
|
54658
|
-
const pathEnv = Array.from(new Set(resolvedBins.map((b) =>
|
|
54712
|
+
const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path17.default.dirname(b)))).join(":");
|
|
54659
54713
|
const text = renderEcosystemConfig({
|
|
54660
54714
|
cwd: resolved.cwd,
|
|
54661
54715
|
home,
|
|
54662
54716
|
codexHome: deps.env.CODEX_HOME?.trim() || void 0,
|
|
54663
54717
|
pathEnv,
|
|
54664
54718
|
staging: deps.env.MRRLIN_STAGING === "1",
|
|
54665
|
-
apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
|
|
54666
|
-
schedulerToken: deps.env.MRRLIN_SCHEDULER_TOKEN?.trim() || void 0
|
|
54719
|
+
apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
|
|
54667
54720
|
});
|
|
54668
|
-
const ecoPath =
|
|
54721
|
+
const ecoPath = import_node_path17.default.join(home, ".mrrlin", "ecosystem.config.cjs");
|
|
54669
54722
|
deps.writeFile(ecoPath, text);
|
|
54670
54723
|
const start = deps.runPm2(["startOrReload", ecoPath]);
|
|
54671
54724
|
if (start.code !== 0) {
|
|
@@ -54697,12 +54750,12 @@ function uninstallService(deps) {
|
|
|
54697
54750
|
// src/uninstall-codex.ts
|
|
54698
54751
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
54699
54752
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
54700
|
-
var
|
|
54753
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
54701
54754
|
var toml2 = __toESM(require_toml(), 1);
|
|
54702
54755
|
function resolveCodexHome2(options) {
|
|
54703
54756
|
if (options.codexHome) return options.codexHome;
|
|
54704
54757
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
54705
|
-
return
|
|
54758
|
+
return import_node_path18.default.join(options.homeDir ?? import_node_os10.default.homedir(), ".codex");
|
|
54706
54759
|
}
|
|
54707
54760
|
async function pathExists3(target) {
|
|
54708
54761
|
try {
|
|
@@ -54715,7 +54768,7 @@ async function pathExists3(target) {
|
|
|
54715
54768
|
var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.mrrlin(?:-browser)?(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
|
|
54716
54769
|
async function uninstallCodex(options = {}) {
|
|
54717
54770
|
const codexHome = resolveCodexHome2(options);
|
|
54718
|
-
const configPath =
|
|
54771
|
+
const configPath = import_node_path18.default.join(codexHome, "config.toml");
|
|
54719
54772
|
const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
|
|
54720
54773
|
if (!await pathExists3(configPath)) {
|
|
54721
54774
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
@@ -54743,10 +54796,10 @@ async function uninstallCodex(options = {}) {
|
|
|
54743
54796
|
}
|
|
54744
54797
|
async function uninstallPrompts(codexHome, names) {
|
|
54745
54798
|
if (names.length === 0) return [];
|
|
54746
|
-
const promptsDir2 =
|
|
54799
|
+
const promptsDir2 = import_node_path18.default.join(codexHome, "prompts");
|
|
54747
54800
|
const out = [];
|
|
54748
54801
|
for (const name of names) {
|
|
54749
|
-
const promptPath =
|
|
54802
|
+
const promptPath = import_node_path18.default.join(promptsDir2, `${name}.md`);
|
|
54750
54803
|
try {
|
|
54751
54804
|
await import_promises4.default.unlink(promptPath);
|
|
54752
54805
|
out.push({ name, action: "removed", promptPath });
|
|
@@ -54764,15 +54817,15 @@ async function uninstallPrompts(codexHome, names) {
|
|
|
54764
54817
|
|
|
54765
54818
|
// src/report-issue-prompt.ts
|
|
54766
54819
|
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
54767
|
-
var
|
|
54820
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
54768
54821
|
var import_node_url3 = require("node:url");
|
|
54769
54822
|
var import_meta3 = {};
|
|
54770
54823
|
function promptsDir() {
|
|
54771
|
-
if (typeof __dirname !== "undefined") return
|
|
54772
|
-
return
|
|
54824
|
+
if (typeof __dirname !== "undefined") return import_node_path19.default.join(__dirname, "prompts");
|
|
54825
|
+
return import_node_path19.default.join(import_node_path19.default.dirname((0, import_node_url3.fileURLToPath)(import_meta3.url)), "prompts");
|
|
54773
54826
|
}
|
|
54774
54827
|
function readReportIssuePrompt() {
|
|
54775
|
-
return import_node_fs13.default.readFileSync(
|
|
54828
|
+
return import_node_fs13.default.readFileSync(import_node_path19.default.join(promptsDir(), "report-issue.md"), "utf8");
|
|
54776
54829
|
}
|
|
54777
54830
|
|
|
54778
54831
|
// src/bin.ts
|
|
@@ -55053,7 +55106,7 @@ async function main() {
|
|
|
55053
55106
|
env: process.env,
|
|
55054
55107
|
cwd: process.cwd(),
|
|
55055
55108
|
writeFile: (p, c) => {
|
|
55056
|
-
(0, import_node_fs14.mkdirSync)(
|
|
55109
|
+
(0, import_node_fs14.mkdirSync)(import_node_path21.default.dirname(p), { recursive: true, mode: 448 });
|
|
55057
55110
|
(0, import_node_fs14.writeFileSync)(p, c, { mode: 384 });
|
|
55058
55111
|
},
|
|
55059
55112
|
runPm2: pm2Runner,
|
|
@@ -55078,7 +55131,7 @@ async function main() {
|
|
|
55078
55131
|
purgeSecret: purge,
|
|
55079
55132
|
secretPath: agentCredentialPath(),
|
|
55080
55133
|
tokenPath: operatorTokenPath(),
|
|
55081
|
-
ecoPath:
|
|
55134
|
+
ecoPath: import_node_path21.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
55082
55135
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
55083
55136
|
`)
|
|
55084
55137
|
});
|
|
@@ -55099,7 +55152,7 @@ async function main() {
|
|
|
55099
55152
|
purgeSecret: true,
|
|
55100
55153
|
secretPath: agentCredentialPath(),
|
|
55101
55154
|
tokenPath: operatorTokenPath(),
|
|
55102
|
-
ecoPath:
|
|
55155
|
+
ecoPath: import_node_path21.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
|
|
55103
55156
|
log
|
|
55104
55157
|
});
|
|
55105
55158
|
let codexOk = true;
|
|
@@ -55119,7 +55172,7 @@ async function main() {
|
|
|
55119
55172
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
55120
55173
|
}
|
|
55121
55174
|
try {
|
|
55122
|
-
(0, import_node_fs14.rmSync)(
|
|
55175
|
+
(0, import_node_fs14.rmSync)(import_node_path21.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
55123
55176
|
} catch {
|
|
55124
55177
|
}
|
|
55125
55178
|
log("removed ~/.mrrlin");
|
|
@@ -55160,7 +55213,7 @@ ${HELP_TEXT}`);
|
|
|
55160
55213
|
}
|
|
55161
55214
|
}
|
|
55162
55215
|
function resolveSelfBinPath() {
|
|
55163
|
-
return
|
|
55216
|
+
return import_node_path20.default.resolve(process.argv[1] ?? process.execPath);
|
|
55164
55217
|
}
|
|
55165
55218
|
main().catch((error51) => {
|
|
55166
55219
|
process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
|