@mrrlin-dev/mcp 0.4.42 → 0.4.44
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 +708 -256
- package/package.json +4 -4
package/dist/bin.cjs
CHANGED
|
@@ -7729,14 +7729,14 @@ var require_polyfills = __commonJS({
|
|
|
7729
7729
|
fs10.fstatSync = statFixSync(fs10.fstatSync);
|
|
7730
7730
|
fs10.lstatSync = statFixSync(fs10.lstatSync);
|
|
7731
7731
|
if (fs10.chmod && !fs10.lchmod) {
|
|
7732
|
-
fs10.lchmod = function(
|
|
7732
|
+
fs10.lchmod = function(path23, mode, cb) {
|
|
7733
7733
|
if (cb) process.nextTick(cb);
|
|
7734
7734
|
};
|
|
7735
7735
|
fs10.lchmodSync = function() {
|
|
7736
7736
|
};
|
|
7737
7737
|
}
|
|
7738
7738
|
if (fs10.chown && !fs10.lchown) {
|
|
7739
|
-
fs10.lchown = function(
|
|
7739
|
+
fs10.lchown = function(path23, uid, gid, cb) {
|
|
7740
7740
|
if (cb) process.nextTick(cb);
|
|
7741
7741
|
};
|
|
7742
7742
|
fs10.lchownSync = function() {
|
|
@@ -7803,9 +7803,9 @@ var require_polyfills = __commonJS({
|
|
|
7803
7803
|
};
|
|
7804
7804
|
}(fs10.readSync);
|
|
7805
7805
|
function patchLchmod(fs11) {
|
|
7806
|
-
fs11.lchmod = function(
|
|
7806
|
+
fs11.lchmod = function(path23, mode, callback) {
|
|
7807
7807
|
fs11.open(
|
|
7808
|
-
|
|
7808
|
+
path23,
|
|
7809
7809
|
constants2.O_WRONLY | constants2.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
|
-
fs11.lchmodSync = function(
|
|
7825
|
-
var fd = fs11.openSync(
|
|
7824
|
+
fs11.lchmodSync = function(path23, mode) {
|
|
7825
|
+
var fd = fs11.openSync(path23, constants2.O_WRONLY | constants2.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(fs11) {
|
|
7845
7845
|
if (constants2.hasOwnProperty("O_SYMLINK") && fs11.futimes) {
|
|
7846
|
-
fs11.lutimes = function(
|
|
7847
|
-
fs11.open(
|
|
7846
|
+
fs11.lutimes = function(path23, at, mt, cb) {
|
|
7847
|
+
fs11.open(path23, constants2.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
|
-
fs11.lutimesSync = function(
|
|
7860
|
-
var fd = fs11.openSync(
|
|
7859
|
+
fs11.lutimesSync = function(path23, at, mt) {
|
|
7860
|
+
var fd = fs11.openSync(path23, constants2.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(path23, options) {
|
|
7979
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path23, options);
|
|
7980
7980
|
Stream.call(this);
|
|
7981
7981
|
var self = this;
|
|
7982
|
-
this.path =
|
|
7982
|
+
this.path = path23;
|
|
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(path23, options) {
|
|
8028
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path23, options);
|
|
8029
8029
|
Stream.call(this);
|
|
8030
|
-
this.path =
|
|
8030
|
+
this.path = path23;
|
|
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
|
fs11.createWriteStream = createWriteStream;
|
|
8171
8171
|
var fs$readFile = fs11.readFile;
|
|
8172
8172
|
fs11.readFile = readFile9;
|
|
8173
|
-
function readFile9(
|
|
8173
|
+
function readFile9(path23, 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(path23, options, cb);
|
|
8177
|
+
function go$readFile(path24, options2, cb2, startTime) {
|
|
8178
|
+
return fs$readFile(path24, options2, function(err) {
|
|
8179
8179
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8180
|
-
enqueue([go$readFile, [
|
|
8180
|
+
enqueue([go$readFile, [path24, 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 = fs11.writeFile;
|
|
8189
8189
|
fs11.writeFile = writeFile5;
|
|
8190
|
-
function writeFile5(
|
|
8190
|
+
function writeFile5(path23, 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(path23, data, options, cb);
|
|
8194
|
+
function go$writeFile(path24, data2, options2, cb2, startTime) {
|
|
8195
|
+
return fs$writeFile(path24, data2, options2, function(err) {
|
|
8196
8196
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8197
|
-
enqueue([go$writeFile, [
|
|
8197
|
+
enqueue([go$writeFile, [path24, 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 = fs11.appendFile;
|
|
8206
8206
|
if (fs$appendFile)
|
|
8207
8207
|
fs11.appendFile = appendFile2;
|
|
8208
|
-
function appendFile2(
|
|
8208
|
+
function appendFile2(path23, 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(path23, data, options, cb);
|
|
8212
|
+
function go$appendFile(path24, data2, options2, cb2, startTime) {
|
|
8213
|
+
return fs$appendFile(path24, data2, options2, function(err) {
|
|
8214
8214
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8215
|
-
enqueue([go$appendFile, [
|
|
8215
|
+
enqueue([go$appendFile, [path24, 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 = fs11.readdir;
|
|
8244
8244
|
fs11.readdir = readdir5;
|
|
8245
8245
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
8246
|
-
function readdir5(
|
|
8246
|
+
function readdir5(path23, 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(path24, options2, cb2, startTime) {
|
|
8250
|
+
return fs$readdir(path24, fs$readdirCallback(
|
|
8251
|
+
path24,
|
|
8252
8252
|
options2,
|
|
8253
8253
|
cb2,
|
|
8254
8254
|
startTime
|
|
8255
8255
|
));
|
|
8256
|
-
} : function go$readdir2(
|
|
8257
|
-
return fs$readdir(
|
|
8258
|
-
|
|
8256
|
+
} : function go$readdir2(path24, options2, cb2, startTime) {
|
|
8257
|
+
return fs$readdir(path24, options2, fs$readdirCallback(
|
|
8258
|
+
path24,
|
|
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(path23, options, cb);
|
|
8265
|
+
function fs$readdirCallback(path24, 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
|
+
[path24, 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(path23, 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(path23, 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 createReadStream2(
|
|
8380
|
-
return new fs11.ReadStream(
|
|
8379
|
+
function createReadStream2(path23, options) {
|
|
8380
|
+
return new fs11.ReadStream(path23, options);
|
|
8381
8381
|
}
|
|
8382
|
-
function createWriteStream(
|
|
8383
|
-
return new fs11.WriteStream(
|
|
8382
|
+
function createWriteStream(path23, options) {
|
|
8383
|
+
return new fs11.WriteStream(path23, options);
|
|
8384
8384
|
}
|
|
8385
8385
|
var fs$open = fs11.open;
|
|
8386
8386
|
fs11.open = open;
|
|
8387
|
-
function open(
|
|
8387
|
+
function open(path23, 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(path23, flags, mode, cb);
|
|
8391
|
+
function go$open(path24, flags2, mode2, cb2, startTime) {
|
|
8392
|
+
return fs$open(path24, flags2, mode2, function(err, fd) {
|
|
8393
8393
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
8394
|
-
enqueue([go$open, [
|
|
8394
|
+
enqueue([go$open, [path24, 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 path23 = require("path");
|
|
8924
8924
|
var fs10 = 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, path23.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 path23 = 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 < path23.length - 1; i++) {
|
|
10801
|
+
optimizedSegs.push(graph.table[path23[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(path23, 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 = fs10.createWriteStream(
|
|
13289
|
+
const stream = fs10.createWriteStream(path23);
|
|
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(path23, qrData, options, cb) {
|
|
13352
13352
|
if (typeof cb === "undefined") {
|
|
13353
13353
|
cb = options;
|
|
13354
13354
|
options = void 0;
|
|
13355
13355
|
}
|
|
13356
13356
|
const fs10 = require("fs");
|
|
13357
13357
|
const utf8 = exports2.render(qrData, options);
|
|
13358
|
-
fs10.writeFile(
|
|
13358
|
+
fs10.writeFile(path23, 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 path23 = "";
|
|
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
|
+
path23 += 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
|
+
path23 += svgCmd("h", lineLength);
|
|
13496
13496
|
lineLength = 0;
|
|
13497
13497
|
}
|
|
13498
13498
|
} else {
|
|
13499
13499
|
moveBy++;
|
|
13500
13500
|
}
|
|
13501
13501
|
}
|
|
13502
|
-
return
|
|
13502
|
+
return path23;
|
|
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 path23 = "<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 + path23 + "</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(path23, 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 fs10 = 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
|
-
fs10.writeFile(
|
|
13535
|
+
fs10.writeFile(path23, 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(path23) {
|
|
13694
|
+
return path23.slice((path23.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(path23, text, opts, cb) {
|
|
13759
|
+
if (typeof path23 !== "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(path23);
|
|
13767
13767
|
const renderer = getRendererFromType(type);
|
|
13768
|
-
const renderToFile = renderer.renderToFile.bind(null,
|
|
13768
|
+
const renderToFile = renderer.renderToFile.bind(null, path23);
|
|
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(path23) {
|
|
16987
|
+
let input = path23;
|
|
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 [path23, query] = wsComponent.resourceName.split("?");
|
|
17240
|
+
wsComponent.path = path23 && path23 !== "/" ? path23 : 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_path35 = __toESM(require("node:path"), 1);
|
|
20648
20648
|
var import_node_child_process18 = require("node:child_process");
|
|
20649
20649
|
var import_node_fs22 = require("node:fs");
|
|
20650
|
-
var
|
|
20651
|
-
var
|
|
20650
|
+
var import_node_os17 = require("node:os");
|
|
20651
|
+
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
20652
20652
|
|
|
20653
20653
|
// src/install-codex.ts
|
|
20654
20654
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
@@ -21556,8 +21556,8 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
|
|
|
21556
21556
|
// src/director-bridge.ts
|
|
21557
21557
|
var import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
21558
21558
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
21559
|
-
var
|
|
21560
|
-
var
|
|
21559
|
+
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
21560
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
21561
21561
|
var import_node_child_process15 = require("node:child_process");
|
|
21562
21562
|
var import_node_crypto11 = __toESM(require("node:crypto"), 1);
|
|
21563
21563
|
|
|
@@ -23051,10 +23051,10 @@ function mergeDefs(...defs) {
|
|
|
23051
23051
|
function cloneDef(schema) {
|
|
23052
23052
|
return mergeDefs(schema._zod.def);
|
|
23053
23053
|
}
|
|
23054
|
-
function getElementAtPath(obj,
|
|
23055
|
-
if (!
|
|
23054
|
+
function getElementAtPath(obj, path23) {
|
|
23055
|
+
if (!path23)
|
|
23056
23056
|
return obj;
|
|
23057
|
-
return
|
|
23057
|
+
return path23.reduce((acc, key) => acc?.[key], obj);
|
|
23058
23058
|
}
|
|
23059
23059
|
function promiseAllObject(promisesObj) {
|
|
23060
23060
|
const keys = Object.keys(promisesObj);
|
|
@@ -23463,11 +23463,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
23463
23463
|
}
|
|
23464
23464
|
return false;
|
|
23465
23465
|
}
|
|
23466
|
-
function prefixIssues(
|
|
23466
|
+
function prefixIssues(path23, issues) {
|
|
23467
23467
|
return issues.map((iss) => {
|
|
23468
23468
|
var _a3;
|
|
23469
23469
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
23470
|
-
iss.path.unshift(
|
|
23470
|
+
iss.path.unshift(path23);
|
|
23471
23471
|
return iss;
|
|
23472
23472
|
});
|
|
23473
23473
|
}
|
|
@@ -23614,16 +23614,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23614
23614
|
}
|
|
23615
23615
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
23616
23616
|
const fieldErrors = { _errors: [] };
|
|
23617
|
-
const processError = (error52,
|
|
23617
|
+
const processError = (error52, path23 = []) => {
|
|
23618
23618
|
for (const issue2 of error52.issues) {
|
|
23619
23619
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23620
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23620
|
+
issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
|
|
23621
23621
|
} else if (issue2.code === "invalid_key") {
|
|
23622
|
-
processError({ issues: issue2.issues }, [...
|
|
23622
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
23623
23623
|
} else if (issue2.code === "invalid_element") {
|
|
23624
|
-
processError({ issues: issue2.issues }, [...
|
|
23624
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
23625
23625
|
} else {
|
|
23626
|
-
const fullpath = [...
|
|
23626
|
+
const fullpath = [...path23, ...issue2.path];
|
|
23627
23627
|
if (fullpath.length === 0) {
|
|
23628
23628
|
fieldErrors._errors.push(mapper(issue2));
|
|
23629
23629
|
} else {
|
|
@@ -23650,17 +23650,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23650
23650
|
}
|
|
23651
23651
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
23652
23652
|
const result = { errors: [] };
|
|
23653
|
-
const processError = (error52,
|
|
23653
|
+
const processError = (error52, path23 = []) => {
|
|
23654
23654
|
var _a3, _b;
|
|
23655
23655
|
for (const issue2 of error52.issues) {
|
|
23656
23656
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
23657
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
23657
|
+
issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
|
|
23658
23658
|
} else if (issue2.code === "invalid_key") {
|
|
23659
|
-
processError({ issues: issue2.issues }, [...
|
|
23659
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
23660
23660
|
} else if (issue2.code === "invalid_element") {
|
|
23661
|
-
processError({ issues: issue2.issues }, [...
|
|
23661
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
23662
23662
|
} else {
|
|
23663
|
-
const fullpath = [...
|
|
23663
|
+
const fullpath = [...path23, ...issue2.path];
|
|
23664
23664
|
if (fullpath.length === 0) {
|
|
23665
23665
|
result.errors.push(mapper(issue2));
|
|
23666
23666
|
continue;
|
|
@@ -23692,8 +23692,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
23692
23692
|
}
|
|
23693
23693
|
function toDotPath(_path) {
|
|
23694
23694
|
const segs = [];
|
|
23695
|
-
const
|
|
23696
|
-
for (const seg of
|
|
23695
|
+
const path23 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
23696
|
+
for (const seg of path23) {
|
|
23697
23697
|
if (typeof seg === "number")
|
|
23698
23698
|
segs.push(`[${seg}]`);
|
|
23699
23699
|
else if (typeof seg === "symbol")
|
|
@@ -36385,13 +36385,13 @@ function resolveRef(ref, ctx) {
|
|
|
36385
36385
|
if (!ref.startsWith("#")) {
|
|
36386
36386
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
36387
36387
|
}
|
|
36388
|
-
const
|
|
36389
|
-
if (
|
|
36388
|
+
const path23 = ref.slice(1).split("/").filter(Boolean);
|
|
36389
|
+
if (path23.length === 0) {
|
|
36390
36390
|
return ctx.rootSchema;
|
|
36391
36391
|
}
|
|
36392
36392
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
36393
|
-
if (
|
|
36394
|
-
const key =
|
|
36393
|
+
if (path23[0] === defsKey) {
|
|
36394
|
+
const key = path23[1];
|
|
36395
36395
|
if (!key || !ctx.defs[key]) {
|
|
36396
36396
|
throw new Error(`Reference not found: ${ref}`);
|
|
36397
36397
|
}
|
|
@@ -36816,6 +36816,17 @@ var ARTIFACT_CHECKS = {
|
|
|
36816
36816
|
structured_data: null,
|
|
36817
36817
|
message: { verifier: "status" }
|
|
36818
36818
|
};
|
|
36819
|
+
var ARTIFACT_DESTINATIONS = {
|
|
36820
|
+
document: "wiki",
|
|
36821
|
+
page: "git",
|
|
36822
|
+
file_set: null,
|
|
36823
|
+
code_change: "git",
|
|
36824
|
+
structured_data: null,
|
|
36825
|
+
message: null
|
|
36826
|
+
};
|
|
36827
|
+
function resolveKindCapability(kind) {
|
|
36828
|
+
return ARTIFACT_DESTINATIONS[kind];
|
|
36829
|
+
}
|
|
36819
36830
|
|
|
36820
36831
|
// ../../packages/schemas/dist/operationIds.js
|
|
36821
36832
|
var openApiOperationIds = {
|
|
@@ -36957,7 +36968,11 @@ var openApiOperationIds = {
|
|
|
36957
36968
|
upsertCapabilityRoute: "upsertCapabilityRoute",
|
|
36958
36969
|
resolveCapabilityRoute: "resolveCapabilityRoute",
|
|
36959
36970
|
overrideCapabilityToolClass: "overrideCapabilityToolClass",
|
|
36960
|
-
listCapabilityUses: "listCapabilityUses"
|
|
36971
|
+
listCapabilityUses: "listCapabilityUses",
|
|
36972
|
+
confirmFirstWrite: "confirmFirstWrite",
|
|
36973
|
+
resolveArtifactKindRoute: "resolveArtifactKindRoute",
|
|
36974
|
+
resolveDeliveryForArtifactKind: "resolveDeliveryForArtifactKind",
|
|
36975
|
+
recordCapabilityUse: "recordCapabilityUse"
|
|
36961
36976
|
};
|
|
36962
36977
|
|
|
36963
36978
|
// ../../packages/schemas/dist/session.js
|
|
@@ -37533,6 +37548,18 @@ var mrrlinDeclaredOutcomeSchema = mrrlinDeclaredOutcomeShapeSchema.superRefine((
|
|
|
37533
37548
|
message: `requires spans more than one verifier, so no receipt can ever satisfy it (${spread}). Declare the outcome rather than the steps that produced it; if two things must genuinely exist and neither is a means to the other, split them into linked tasks.`
|
|
37534
37549
|
});
|
|
37535
37550
|
}
|
|
37551
|
+
const distinctCapabilities = new Set(value.requires.map((kind) => resolveKindCapability(kind)).filter((capability) => capability !== null));
|
|
37552
|
+
if (distinctCapabilities.size > 1) {
|
|
37553
|
+
const spread = value.requires.map((kind) => {
|
|
37554
|
+
const capability = resolveKindCapability(kind);
|
|
37555
|
+
return capability === null ? `${kind} has no destination` : `${kind} routes to ${capability}`;
|
|
37556
|
+
}).join(", ");
|
|
37557
|
+
ctx.addIssue({
|
|
37558
|
+
code: external_exports.ZodIssueCode.custom,
|
|
37559
|
+
path: ["requires"],
|
|
37560
|
+
message: `requires spans more than one capability, so no single delivery can satisfy it (${spread}). Split into linked tasks, one per destination.`
|
|
37561
|
+
});
|
|
37562
|
+
}
|
|
37536
37563
|
const hasVerifiableKind = value.requires.some((kind) => ARTIFACT_CHECKS[kind] !== null);
|
|
37537
37564
|
const hasUnverifiableKind = value.requires.some((kind) => ARTIFACT_CHECKS[kind] === null);
|
|
37538
37565
|
if (value.verification === "human_tap" && hasVerifiableKind) {
|
|
@@ -37660,6 +37687,13 @@ var mrrlinRunBlockingReasonCodeSchema = external_exports.enum([
|
|
|
37660
37687
|
// with a task-content block; before it existed such a failure fell through to `unknown` and was
|
|
37661
37688
|
// handed off to the operator as though the Director had judged the task.
|
|
37662
37689
|
"provider_limit_exhausted",
|
|
37690
|
+
// Крок 3, task 8.1: the dispatch pre-flight's own refusal — the task's declared outcome requires
|
|
37691
|
+
// an artifact kind with no capability route at all (client-side, resolveKindCapability) or no
|
|
37692
|
+
// configured route in this project (server-side, resolveArtifactKindRoute). Distinct from
|
|
37693
|
+
// `task_blocked` (which is about blocker TASKS, not this run's own delivery destination): a task
|
|
37694
|
+
// whose blockers clear can start; a task whose required kind cannot route needs an operator to
|
|
37695
|
+
// configure the missing route before any retry would succeed.
|
|
37696
|
+
"capability_not_routed",
|
|
37663
37697
|
"unknown"
|
|
37664
37698
|
]);
|
|
37665
37699
|
var mrrlinExecutionArtifactKindSchema = external_exports.enum([
|
|
@@ -37740,6 +37774,13 @@ var mrrlinStopReasonSchema = external_exports.enum([
|
|
|
37740
37774
|
"consensus_disabled_spec_not_ready",
|
|
37741
37775
|
"spec_approval_pending",
|
|
37742
37776
|
"awaiting_handoff",
|
|
37777
|
+
// Крок 3 (delivery-as-capability-call), task 3.1: the parked reason for an open capability
|
|
37778
|
+
// question (origin: "capability"), the same shape as awaiting_clarification's own open gate
|
|
37779
|
+
// question (origin: "gate") one line above -- caught by the whole-change gate (task 9.3), not
|
|
37780
|
+
// task 3.1 itself: this schema and mrrlinSchedulerParkedReasonSchema are siblings apps/web's
|
|
37781
|
+
// autopilotQueue.ts assumes stay in lockstep (every parked reason not explicitly remapped is
|
|
37782
|
+
// used as a stop reason directly), and no per-package typecheck in this change ever ran apps/web.
|
|
37783
|
+
"awaiting_capability_decision",
|
|
37743
37784
|
"assigned_to_other",
|
|
37744
37785
|
"backlog",
|
|
37745
37786
|
"attempts_exhausted",
|
|
@@ -38923,7 +38964,11 @@ var mrrlinSchedulerParkedReasonSchema = external_exports.enum([
|
|
|
38923
38964
|
"awaiting_handoff",
|
|
38924
38965
|
"awaiting_clarification",
|
|
38925
38966
|
"spec_awaiting_approval",
|
|
38926
|
-
"blocked_by_active"
|
|
38967
|
+
"blocked_by_active",
|
|
38968
|
+
// Derived, not stored (design.md, "Parking is derived"): an open `question` inbox item with
|
|
38969
|
+
// `origin === "capability"` yields this reason, exactly as an `origin === "gate"` one already
|
|
38970
|
+
// yields `awaiting_clarification`. No column, and nobody but the derivation may set it.
|
|
38971
|
+
"awaiting_capability_decision"
|
|
38927
38972
|
]);
|
|
38928
38973
|
var mrrlinSchedulerParkedTaskSchema = external_exports.object({
|
|
38929
38974
|
task: mrrlinTaskSchema,
|
|
@@ -39262,6 +39307,16 @@ var capabilityRouteResponseSchema = external_exports.object({ data: CapabilityRo
|
|
|
39262
39307
|
var capabilityRouteListResponseSchema = external_exports.object({ data: external_exports.array(CapabilityRouteSchema) });
|
|
39263
39308
|
var capabilityToolClassResponseSchema = external_exports.object({ data: CapabilityToolClassSchema });
|
|
39264
39309
|
var capabilityUseListResponseSchema = external_exports.object({ data: external_exports.array(CapabilityUseSchema) });
|
|
39310
|
+
var capabilityUseResponseSchema = external_exports.object({ data: CapabilityUseSchema.nullable() });
|
|
39311
|
+
var capabilityUseCreateSchema = external_exports.object({
|
|
39312
|
+
serverId: capabilityServerIdSchema,
|
|
39313
|
+
toolName: capabilityToolNameSchema,
|
|
39314
|
+
taskId: mrrlinTaskIdSchema.nullable(),
|
|
39315
|
+
outcome: capabilityUseOutcomeSchema
|
|
39316
|
+
});
|
|
39317
|
+
var deliveryResolutionResponseSchema = external_exports.object({
|
|
39318
|
+
data: external_exports.object({ route: CapabilityRouteSchema, verdict: CapabilityGateVerdictSchema })
|
|
39319
|
+
});
|
|
39265
39320
|
|
|
39266
39321
|
// ../../packages/agent-client/dist/providers/codex/render-context-bundle.js
|
|
39267
39322
|
var DEFAULT_SPEC_BUDGET_CHARS = 6e3;
|
|
@@ -40551,6 +40606,12 @@ function createAgentTokenProvider(opts) {
|
|
|
40551
40606
|
}
|
|
40552
40607
|
|
|
40553
40608
|
// ../../packages/client/dist/index.js
|
|
40609
|
+
var CAPABILITY_ROUTE_RESOLUTION_REASON_BY_CODE = {
|
|
40610
|
+
NO_ROUTE: "no_route",
|
|
40611
|
+
NO_GRANT: "no_grant",
|
|
40612
|
+
PROJECT_MISMATCH: "project_mismatch",
|
|
40613
|
+
AMBIGUOUS_ROUTE: "ambiguous_route"
|
|
40614
|
+
};
|
|
40554
40615
|
function appendQuery(url2, params) {
|
|
40555
40616
|
const search = new URLSearchParams();
|
|
40556
40617
|
for (const [key, value] of Object.entries(params)) {
|
|
@@ -40601,18 +40662,18 @@ function createMrrlinClient(config2) {
|
|
|
40601
40662
|
const customFetch = config2.fetch ?? globalThis.fetch;
|
|
40602
40663
|
const baseUrl = config2.baseUrl.replace(/\/$/, "");
|
|
40603
40664
|
const token = config2.token;
|
|
40604
|
-
async function request(
|
|
40665
|
+
async function request(path23, init) {
|
|
40605
40666
|
const method = init?.method ?? "GET";
|
|
40606
40667
|
const headers = new Headers(init?.headers ?? {});
|
|
40607
40668
|
if (token && !headers.has("authorization")) {
|
|
40608
40669
|
headers.set("authorization", `Bearer ${token}`);
|
|
40609
40670
|
}
|
|
40610
|
-
const response = await customFetch(`${baseUrl}${
|
|
40671
|
+
const response = await customFetch(`${baseUrl}${path23}`, { ...init, headers });
|
|
40611
40672
|
if (!response.ok) {
|
|
40612
40673
|
const body = await response.text();
|
|
40613
40674
|
let code = `HTTP_${response.status}`;
|
|
40614
40675
|
let violations = null;
|
|
40615
|
-
let message = `Mrrlin API ${method} ${
|
|
40676
|
+
let message = `Mrrlin API ${method} ${path23} failed: ${response.status}`;
|
|
40616
40677
|
try {
|
|
40617
40678
|
const parsed = JSON.parse(body);
|
|
40618
40679
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -40632,7 +40693,7 @@ function createMrrlinClient(config2) {
|
|
|
40632
40693
|
throw new MrrlinApiError({
|
|
40633
40694
|
code,
|
|
40634
40695
|
method,
|
|
40635
|
-
path:
|
|
40696
|
+
path: path23,
|
|
40636
40697
|
responseBody: body,
|
|
40637
40698
|
status: response.status,
|
|
40638
40699
|
violations,
|
|
@@ -40641,18 +40702,18 @@ function createMrrlinClient(config2) {
|
|
|
40641
40702
|
}
|
|
40642
40703
|
return response.json();
|
|
40643
40704
|
}
|
|
40644
|
-
async function requestText(
|
|
40705
|
+
async function requestText(path23, init) {
|
|
40645
40706
|
const method = init?.method ?? "GET";
|
|
40646
40707
|
const headers = new Headers(init?.headers ?? {});
|
|
40647
40708
|
if (token && !headers.has("authorization")) {
|
|
40648
40709
|
headers.set("authorization", `Bearer ${token}`);
|
|
40649
40710
|
}
|
|
40650
|
-
const response = await customFetch(`${baseUrl}${
|
|
40711
|
+
const response = await customFetch(`${baseUrl}${path23}`, { ...init, headers });
|
|
40651
40712
|
if (!response.ok) {
|
|
40652
40713
|
const body = await response.text();
|
|
40653
40714
|
let code = `HTTP_${response.status}`;
|
|
40654
40715
|
let violations = null;
|
|
40655
|
-
let message = `Mrrlin API ${method} ${
|
|
40716
|
+
let message = `Mrrlin API ${method} ${path23} failed: ${response.status}`;
|
|
40656
40717
|
try {
|
|
40657
40718
|
const parsed = JSON.parse(body);
|
|
40658
40719
|
const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
|
|
@@ -40672,7 +40733,7 @@ function createMrrlinClient(config2) {
|
|
|
40672
40733
|
throw new MrrlinApiError({
|
|
40673
40734
|
code,
|
|
40674
40735
|
method,
|
|
40675
|
-
path:
|
|
40736
|
+
path: path23,
|
|
40676
40737
|
responseBody: body,
|
|
40677
40738
|
status: response.status,
|
|
40678
40739
|
violations,
|
|
@@ -40937,16 +40998,16 @@ function createMrrlinClient(config2) {
|
|
|
40937
40998
|
// rejected against the first, MrrlinTask[]-only overload) -- the `any` here is contained to
|
|
40938
40999
|
// this one implementation signature; MrrlinClient's declared overloads keep callers precise.
|
|
40939
41000
|
async listTasks(projectSlug, filters = {}, options) {
|
|
40940
|
-
const
|
|
40941
|
-
const body = await request(
|
|
41001
|
+
const path23 = buildTaskListPath(projectSlug, filters, options?.view);
|
|
41002
|
+
const body = await request(path23);
|
|
40942
41003
|
if (options?.view === "summary") {
|
|
40943
41004
|
return taskSummaryListResponseSchema.parse(body).data;
|
|
40944
41005
|
}
|
|
40945
41006
|
return taskListResponseSchema.parse(body).data;
|
|
40946
41007
|
},
|
|
40947
41008
|
async listTaskSummaries(projectSlug, filters = {}) {
|
|
40948
|
-
const
|
|
40949
|
-
const body = await request(
|
|
41009
|
+
const path23 = buildTaskListPath(projectSlug, filters, "summary");
|
|
41010
|
+
const body = await request(path23);
|
|
40950
41011
|
return taskSummaryListResponseSchema.parse(body).data;
|
|
40951
41012
|
},
|
|
40952
41013
|
async listTaxonomy(projectSlug) {
|
|
@@ -40954,22 +41015,22 @@ function createMrrlinClient(config2) {
|
|
|
40954
41015
|
return taxonomyListResponseSchema.parse(body).data;
|
|
40955
41016
|
},
|
|
40956
41017
|
async listWikiPages(projectSlug, filters = {}) {
|
|
40957
|
-
const
|
|
41018
|
+
const path23 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
|
|
40958
41019
|
folder: filters.folder,
|
|
40959
41020
|
q: filters.q,
|
|
40960
41021
|
taskId: filters.taskId
|
|
40961
41022
|
});
|
|
40962
|
-
const body = await request(
|
|
41023
|
+
const body = await request(path23);
|
|
40963
41024
|
return wikiPageListResponseSchema.parse(body).data;
|
|
40964
41025
|
},
|
|
40965
41026
|
async searchWikiPages(projectSlug, query) {
|
|
40966
|
-
const
|
|
41027
|
+
const path23 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
|
|
40967
41028
|
folder: query.folder,
|
|
40968
41029
|
limit: query.limit === void 0 ? void 0 : String(query.limit),
|
|
40969
41030
|
pathPrefix: query.pathPrefix,
|
|
40970
41031
|
q: query.q
|
|
40971
41032
|
});
|
|
40972
|
-
const body = await request(
|
|
41033
|
+
const body = await request(path23);
|
|
40973
41034
|
return wikiPageSearchResponseSchema.parse(body).data;
|
|
40974
41035
|
},
|
|
40975
41036
|
async updatePlan(projectSlug, planId, patch) {
|
|
@@ -41180,6 +41241,52 @@ function createMrrlinClient(config2) {
|
|
|
41180
41241
|
const body = await request(`${projectPath(projectSlug)}/capability-grants/${encodeURIComponent(serverId)}`, { method: "DELETE" });
|
|
41181
41242
|
return capabilityGrantResponseSchema.parse(body).data;
|
|
41182
41243
|
},
|
|
41244
|
+
async confirmFirstWrite(projectSlug, serverId) {
|
|
41245
|
+
try {
|
|
41246
|
+
const body = await request(`${projectPath(projectSlug)}/capability-grants/${encodeURIComponent(serverId)}/first-write-confirmation`, { method: "POST" });
|
|
41247
|
+
return capabilityGrantResponseSchema.parse(body).data;
|
|
41248
|
+
} catch (error51) {
|
|
41249
|
+
if (error51 instanceof MrrlinApiError && error51.code === "NO_GRANT")
|
|
41250
|
+
return null;
|
|
41251
|
+
throw error51;
|
|
41252
|
+
}
|
|
41253
|
+
},
|
|
41254
|
+
async resolveArtifactKindRoute(projectSlug, artifactKind, taskProjectSlug) {
|
|
41255
|
+
try {
|
|
41256
|
+
const body = await request(`${projectPath(projectSlug)}/artifact-kinds/${encodeURIComponent(artifactKind)}/resolution?taskProjectSlug=${encodeURIComponent(taskProjectSlug)}`, { method: "POST" });
|
|
41257
|
+
return { ok: true, route: capabilityRouteResponseSchema.parse(body).data };
|
|
41258
|
+
} catch (error51) {
|
|
41259
|
+
if (error51 instanceof MrrlinApiError) {
|
|
41260
|
+
const reason = CAPABILITY_ROUTE_RESOLUTION_REASON_BY_CODE[error51.code];
|
|
41261
|
+
if (reason)
|
|
41262
|
+
return { ok: false, reason, message: error51.message };
|
|
41263
|
+
}
|
|
41264
|
+
throw error51;
|
|
41265
|
+
}
|
|
41266
|
+
},
|
|
41267
|
+
async resolveDeliveryForArtifactKind(projectSlug, artifactKind, taskProjectSlug, taskId) {
|
|
41268
|
+
try {
|
|
41269
|
+
const url2 = appendQuery(`${projectPath(projectSlug)}/artifact-kinds/${encodeURIComponent(artifactKind)}/delivery-resolution`, { taskProjectSlug, taskId });
|
|
41270
|
+
const body = await request(url2, { method: "POST" });
|
|
41271
|
+
const { route, verdict } = deliveryResolutionResponseSchema.parse(body).data;
|
|
41272
|
+
return { ok: true, route, verdict };
|
|
41273
|
+
} catch (error51) {
|
|
41274
|
+
if (error51 instanceof MrrlinApiError) {
|
|
41275
|
+
const reason = CAPABILITY_ROUTE_RESOLUTION_REASON_BY_CODE[error51.code];
|
|
41276
|
+
if (reason)
|
|
41277
|
+
return { ok: false, reason, message: error51.message };
|
|
41278
|
+
}
|
|
41279
|
+
throw error51;
|
|
41280
|
+
}
|
|
41281
|
+
},
|
|
41282
|
+
async recordCapabilityUse(projectSlug, input) {
|
|
41283
|
+
const body = await request(`${projectPath(projectSlug)}/capability-uses`, {
|
|
41284
|
+
body: JSON.stringify(input),
|
|
41285
|
+
headers: { "content-type": "application/json" },
|
|
41286
|
+
method: "POST"
|
|
41287
|
+
});
|
|
41288
|
+
return capabilityUseResponseSchema.parse(body).data;
|
|
41289
|
+
},
|
|
41183
41290
|
async listInboxItems(projectSlug, filters = {}) {
|
|
41184
41291
|
const url2 = appendQuery(`${projectPath(projectSlug)}/inbox`, {
|
|
41185
41292
|
groupId: filters.groupId,
|
|
@@ -42188,7 +42295,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
42188
42295
|
}
|
|
42189
42296
|
|
|
42190
42297
|
// src/_generated/version.ts
|
|
42191
|
-
var PKG_VERSION = "0.4.
|
|
42298
|
+
var PKG_VERSION = "0.4.44";
|
|
42192
42299
|
|
|
42193
42300
|
// src/api-base-url-migrate.ts
|
|
42194
42301
|
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
@@ -44262,7 +44369,7 @@ function reviserIdentityInstructions(taskId, title) {
|
|
|
44262
44369
|
function gateCallRecorder(args) {
|
|
44263
44370
|
let round = 0;
|
|
44264
44371
|
let headSinceArbiter = false;
|
|
44265
|
-
return function record2(role, persona, agentId, startedAt, result) {
|
|
44372
|
+
return function record2(role, persona, agentId, startedAt, result, attribution) {
|
|
44266
44373
|
if (role === "head" && !headSinceArbiter) {
|
|
44267
44374
|
round += 1;
|
|
44268
44375
|
headSinceArbiter = true;
|
|
@@ -44277,7 +44384,15 @@ function gateCallRecorder(args) {
|
|
|
44277
44384
|
role,
|
|
44278
44385
|
persona,
|
|
44279
44386
|
agentId,
|
|
44280
|
-
|
|
44387
|
+
// `?? null` on the override's own value, not on the whole expression: an absent override must
|
|
44388
|
+
// still fall through to the factory's provider, and only a PRESENT one means "this call did
|
|
44389
|
+
// not run on the seat". The coalesce is future-proofing for a JavaScript consumer of the same
|
|
44390
|
+
// module, NOT a hole in the type — `{ provider: string | null }` makes `{}` a compile error
|
|
44391
|
+
// today, and both call sites are hard-coded `{ provider: null }` lambdas in this file. It is
|
|
44392
|
+
// worth the character because `provider: undefined` is not a missing provider, it is a key
|
|
44393
|
+
// `JSON.stringify` DROPS, so such a line would fail `gateCallRecordSchema` on ingest with
|
|
44394
|
+
// nothing at the write site to show why.
|
|
44395
|
+
provider: attribution ? attribution.provider ?? null : args.provider,
|
|
44281
44396
|
inputTokens: usage?.inputTokens ?? null,
|
|
44282
44397
|
cachedInputTokens: usage?.cachedInputTokens ?? null,
|
|
44283
44398
|
cacheWriteInputTokens: usage?.cacheWriteInputTokens ?? null,
|
|
@@ -44344,6 +44459,10 @@ function buildSpecGateDeps(args) {
|
|
|
44344
44459
|
return {
|
|
44345
44460
|
rounds,
|
|
44346
44461
|
maxHeadCalls,
|
|
44462
|
+
// The recorder a multi-LLM panel dispatches through when it replaces `runHead` below — see
|
|
44463
|
+
// GateHeadCallRecorder. `{ provider: null }` because a panel head runs on a pool agent, not on
|
|
44464
|
+
// this factory's seat.
|
|
44465
|
+
recordHeadCall: (persona, agentId, startedAt, result) => recordCost("head", persona, agentId, startedAt, result, { provider: null }),
|
|
44347
44466
|
async consensusEnabled() {
|
|
44348
44467
|
const config2 = await client.getConsensusConfig(projectSlug);
|
|
44349
44468
|
return config2.consensusEnabled;
|
|
@@ -44517,6 +44636,10 @@ function buildCodeGateDeps(args) {
|
|
|
44517
44636
|
rounds,
|
|
44518
44637
|
maxHeadCalls,
|
|
44519
44638
|
heads,
|
|
44639
|
+
// This is the gate that actually gets a panel today: tools.ts resolves one and calls
|
|
44640
|
+
// `applyActivePanel`, which replaces `runHead` below. Without this hook the panel's head calls
|
|
44641
|
+
// were recorded nowhere at all — see GateHeadCallRecorder.
|
|
44642
|
+
recordHeadCall: (persona, agentId, startedAt, result) => recordCost("head", persona, agentId, startedAt, result, { provider: null }),
|
|
44520
44643
|
async consensusEnabled() {
|
|
44521
44644
|
const config2 = await client.getConsensusConfig(projectSlug);
|
|
44522
44645
|
return config2.consensusEnabled;
|
|
@@ -44794,8 +44917,8 @@ You revise a deliverable to address the accepted issues so it satisfies the acce
|
|
|
44794
44917
|
function isRecord(v) {
|
|
44795
44918
|
return v !== null && typeof v === "object";
|
|
44796
44919
|
}
|
|
44797
|
-
function resolvePath(root,
|
|
44798
|
-
const parts =
|
|
44920
|
+
function resolvePath(root, path23) {
|
|
44921
|
+
const parts = path23.split(".");
|
|
44799
44922
|
let cur = root;
|
|
44800
44923
|
for (let i = 0; i < parts.length - 1; i += 1) {
|
|
44801
44924
|
const part = parts[i];
|
|
@@ -44863,9 +44986,9 @@ async function gate(artifact, prose, ctx) {
|
|
|
44863
44986
|
return { ok: true, gated: true, artifact: withheldExcerptClone(artifact) };
|
|
44864
44987
|
}
|
|
44865
44988
|
const maskedClone = typeof structuredClone === "function" ? structuredClone(artifact) : JSON.parse(JSON.stringify(artifact));
|
|
44866
|
-
for (const { path:
|
|
44867
|
-
const target = resolvePath(maskedClone,
|
|
44868
|
-
if (!target) throw new Error(`pii-gate: path "${
|
|
44989
|
+
for (const { path: path23, masked } of fields) {
|
|
44990
|
+
const target = resolvePath(maskedClone, path23);
|
|
44991
|
+
if (!target) throw new Error(`pii-gate: path "${path23}" failed to resolve on the clone after validating on the original`);
|
|
44869
44992
|
target.parent[target.key] = masked;
|
|
44870
44993
|
}
|
|
44871
44994
|
return { ok: true, gated: false, artifact: maskedClone };
|
|
@@ -44881,15 +45004,15 @@ var cache = /* @__PURE__ */ new Map();
|
|
|
44881
45004
|
function resolveInstallationId(stateDir) {
|
|
44882
45005
|
const cached2 = cache.get(stateDir);
|
|
44883
45006
|
if (cached2 !== void 0) return cached2;
|
|
44884
|
-
const
|
|
45007
|
+
const path23 = (0, import_node_path14.join)(stateDir, FILE_NAME);
|
|
44885
45008
|
let id;
|
|
44886
45009
|
try {
|
|
44887
|
-
id = (0, import_node_fs8.readFileSync)(
|
|
45010
|
+
id = (0, import_node_fs8.readFileSync)(path23, "utf8").trim();
|
|
44888
45011
|
if (!UUID.test(id)) throw new Error("unusable");
|
|
44889
45012
|
} catch {
|
|
44890
45013
|
id = (0, import_node_crypto5.randomUUID)();
|
|
44891
|
-
(0, import_node_fs8.mkdirSync)((0, import_node_path14.dirname)(
|
|
44892
|
-
(0, import_node_fs8.writeFileSync)(
|
|
45014
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path14.dirname)(path23), { recursive: true });
|
|
45015
|
+
(0, import_node_fs8.writeFileSync)(path23, `${id}
|
|
44893
45016
|
`, "utf8");
|
|
44894
45017
|
}
|
|
44895
45018
|
cache.set(stateDir, id);
|
|
@@ -47342,8 +47465,8 @@ function newArtifactId() {
|
|
|
47342
47465
|
return `EA-${import_node_crypto7.default.randomUUID()}`;
|
|
47343
47466
|
}
|
|
47344
47467
|
var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/src\/schema\.ts$/];
|
|
47345
|
-
function isBlastRadiusFloorPath(
|
|
47346
|
-
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(
|
|
47468
|
+
function isBlastRadiusFloorPath(path23) {
|
|
47469
|
+
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path23));
|
|
47347
47470
|
}
|
|
47348
47471
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process12.execFile);
|
|
47349
47472
|
async function defaultListRunDiffPaths(opts) {
|
|
@@ -47598,6 +47721,35 @@ async function driveRun(deps, projectSlug, runId) {
|
|
|
47598
47721
|
return legacy != null ? Math.min(legacy, remaining) : remaining;
|
|
47599
47722
|
};
|
|
47600
47723
|
const task = await deps.client.getTask(projectSlug, claimed.taskId);
|
|
47724
|
+
if (task.declaredOutcome != null) {
|
|
47725
|
+
for (const kind of task.declaredOutcome.requires) {
|
|
47726
|
+
if (resolveKindCapability(kind) === null) {
|
|
47727
|
+
await failRun(
|
|
47728
|
+
deps,
|
|
47729
|
+
projectSlug,
|
|
47730
|
+
task,
|
|
47731
|
+
runId,
|
|
47732
|
+
leaseId,
|
|
47733
|
+
`capability_not_routed: run ${runId} targets ${task.id}, which requires artifact kind "${kind}" -- that kind has no capability at all`,
|
|
47734
|
+
"capability_not_routed"
|
|
47735
|
+
);
|
|
47736
|
+
return;
|
|
47737
|
+
}
|
|
47738
|
+
const routeResolution = await deps.client.resolveArtifactKindRoute(projectSlug, kind, projectSlug);
|
|
47739
|
+
if (!routeResolution.ok) {
|
|
47740
|
+
await failRun(
|
|
47741
|
+
deps,
|
|
47742
|
+
projectSlug,
|
|
47743
|
+
task,
|
|
47744
|
+
runId,
|
|
47745
|
+
leaseId,
|
|
47746
|
+
`capability_not_routed: run ${runId} targets ${task.id}, which requires artifact kind "${kind}" -- no route (${routeResolution.reason})`,
|
|
47747
|
+
"capability_not_routed"
|
|
47748
|
+
);
|
|
47749
|
+
return;
|
|
47750
|
+
}
|
|
47751
|
+
}
|
|
47752
|
+
}
|
|
47601
47753
|
const blockerTasks = task.blockedBy.length ? await Promise.all(task.blockedBy.map((blockerTaskId) => deps.client.getTask(projectSlug, blockerTaskId))) : [];
|
|
47602
47754
|
const missingBlockers = task.blockedBy.filter((_, index) => !blockerTasks[index]);
|
|
47603
47755
|
if (missingBlockers.length > 0) {
|
|
@@ -49608,6 +49760,15 @@ async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJo
|
|
|
49608
49760
|
}
|
|
49609
49761
|
}
|
|
49610
49762
|
|
|
49763
|
+
// src/state-dir.ts
|
|
49764
|
+
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
49765
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
49766
|
+
function resolveStateDir(env = process.env) {
|
|
49767
|
+
const codexHome = env.CODEX_HOME;
|
|
49768
|
+
if (codexHome) return import_node_path20.default.join(codexHome, "mrrlin", "director-bridge");
|
|
49769
|
+
return import_node_path20.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
|
|
49770
|
+
}
|
|
49771
|
+
|
|
49611
49772
|
// src/consensus/deliverable-gate.ts
|
|
49612
49773
|
async function runDeliverableGate(target, deps) {
|
|
49613
49774
|
if (!await deps.consensusEnabled()) return { outcome: "SKIPPED" };
|
|
@@ -49862,14 +50023,14 @@ function agentIdleMs(provider) {
|
|
|
49862
50023
|
|
|
49863
50024
|
// src/operator-token.ts
|
|
49864
50025
|
var import_node_fs12 = require("node:fs");
|
|
49865
|
-
var
|
|
49866
|
-
var
|
|
50026
|
+
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
50027
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
49867
50028
|
function operatorDir() {
|
|
49868
|
-
const base = process.env.CODEX_HOME ?
|
|
50029
|
+
const base = process.env.CODEX_HOME ? import_node_path21.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path21.default.join(import_node_os9.default.homedir(), ".mrrlin");
|
|
49869
50030
|
return base;
|
|
49870
50031
|
}
|
|
49871
50032
|
function operatorTokenPath() {
|
|
49872
|
-
return
|
|
50033
|
+
return import_node_path21.default.join(operatorDir(), "operator-token");
|
|
49873
50034
|
}
|
|
49874
50035
|
function readOperatorToken() {
|
|
49875
50036
|
try {
|
|
@@ -49886,7 +50047,7 @@ function persistOperatorToken(token) {
|
|
|
49886
50047
|
`, { encoding: "utf8", mode: 384 });
|
|
49887
50048
|
}
|
|
49888
50049
|
function agentCredentialPath() {
|
|
49889
|
-
return
|
|
50050
|
+
return import_node_path21.default.join(operatorDir(), "agent-credential");
|
|
49890
50051
|
}
|
|
49891
50052
|
function persistAgentSecret(secret) {
|
|
49892
50053
|
const dir = operatorDir();
|
|
@@ -49907,9 +50068,9 @@ function readAgentSecret() {
|
|
|
49907
50068
|
|
|
49908
50069
|
// src/thread-index.ts
|
|
49909
50070
|
var import_node_fs13 = require("node:fs");
|
|
49910
|
-
var
|
|
50071
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
49911
50072
|
function threadIndexPath(stateDir) {
|
|
49912
|
-
return
|
|
50073
|
+
return import_node_path22.default.join(stateDir, "threads.json");
|
|
49913
50074
|
}
|
|
49914
50075
|
function loadThreadIndex(stateDir, ttlMs, now) {
|
|
49915
50076
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -50076,8 +50237,8 @@ function createToolBusyClock(opts) {
|
|
|
50076
50237
|
// src/worker-token.ts
|
|
50077
50238
|
var import_node_crypto10 = require("node:crypto");
|
|
50078
50239
|
var import_node_fs14 = require("node:fs");
|
|
50079
|
-
var
|
|
50080
|
-
var
|
|
50240
|
+
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
50241
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
50081
50242
|
var DEFAULT_WORKER_PORT = 8792;
|
|
50082
50243
|
function workerPort() {
|
|
50083
50244
|
const raw = process.env.MRRLIN_WORKER_PORT;
|
|
@@ -50086,11 +50247,11 @@ function workerPort() {
|
|
|
50086
50247
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_WORKER_PORT;
|
|
50087
50248
|
}
|
|
50088
50249
|
function workerDir() {
|
|
50089
|
-
const base = process.env.CODEX_HOME ?
|
|
50090
|
-
return
|
|
50250
|
+
const base = process.env.CODEX_HOME ? import_node_path23.default.join(process.env.CODEX_HOME, "mrrlin") : import_node_path23.default.join(import_node_os10.default.homedir(), ".mrrlin");
|
|
50251
|
+
return import_node_path23.default.join(base, "worker");
|
|
50091
50252
|
}
|
|
50092
50253
|
function workerTokenPath() {
|
|
50093
|
-
return
|
|
50254
|
+
return import_node_path23.default.join(workerDir(), "token");
|
|
50094
50255
|
}
|
|
50095
50256
|
function readWorkerToken() {
|
|
50096
50257
|
try {
|
|
@@ -50114,8 +50275,8 @@ function readOrCreateWorkerToken() {
|
|
|
50114
50275
|
// src/remote-phone-relay.ts
|
|
50115
50276
|
var import_node_events2 = require("node:events");
|
|
50116
50277
|
var import_node_fs15 = require("node:fs");
|
|
50117
|
-
var
|
|
50118
|
-
var
|
|
50278
|
+
var import_node_os11 = require("node:os");
|
|
50279
|
+
var import_node_path24 = require("node:path");
|
|
50119
50280
|
|
|
50120
50281
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
50121
50282
|
var nc = __toESM(require("node:crypto"), 1);
|
|
@@ -53686,9 +53847,9 @@ var DirectorRelay = class {
|
|
|
53686
53847
|
|
|
53687
53848
|
// src/remote-phone-relay.ts
|
|
53688
53849
|
function loadOrCreateAgentDeviceKey() {
|
|
53689
|
-
const
|
|
53850
|
+
const path23 = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin", "agent-device-key");
|
|
53690
53851
|
try {
|
|
53691
|
-
const raw = JSON.parse((0, import_node_fs15.readFileSync)(
|
|
53852
|
+
const raw = JSON.parse((0, import_node_fs15.readFileSync)(path23, "utf8"));
|
|
53692
53853
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
53693
53854
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
53694
53855
|
}
|
|
@@ -53696,9 +53857,9 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
53696
53857
|
}
|
|
53697
53858
|
const kp = generateIdentityKeyPair();
|
|
53698
53859
|
try {
|
|
53699
|
-
(0, import_node_fs15.mkdirSync)((0,
|
|
53860
|
+
(0, import_node_fs15.mkdirSync)((0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin"), { recursive: true });
|
|
53700
53861
|
(0, import_node_fs15.writeFileSync)(
|
|
53701
|
-
|
|
53862
|
+
path23,
|
|
53702
53863
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
53703
53864
|
{ mode: 384 }
|
|
53704
53865
|
);
|
|
@@ -53706,7 +53867,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
53706
53867
|
}
|
|
53707
53868
|
return kp;
|
|
53708
53869
|
}
|
|
53709
|
-
var AGENT_PAIRING_PATH = (0,
|
|
53870
|
+
var AGENT_PAIRING_PATH = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
53710
53871
|
function loadAgentPairing() {
|
|
53711
53872
|
try {
|
|
53712
53873
|
const raw = JSON.parse((0, import_node_fs15.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
@@ -53724,7 +53885,7 @@ function loadAgentPairing() {
|
|
|
53724
53885
|
}
|
|
53725
53886
|
function saveAgentPairing(record2) {
|
|
53726
53887
|
try {
|
|
53727
|
-
(0, import_node_fs15.mkdirSync)((0,
|
|
53888
|
+
(0, import_node_fs15.mkdirSync)((0, import_node_path24.join)((0, import_node_os11.homedir)(), ".mrrlin"), { recursive: true });
|
|
53728
53889
|
(0, import_node_fs15.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
53729
53890
|
} catch {
|
|
53730
53891
|
}
|
|
@@ -53904,11 +54065,11 @@ async function renderPairingQrSvg(payload) {
|
|
|
53904
54065
|
|
|
53905
54066
|
// src/checkout-registry.ts
|
|
53906
54067
|
var import_node_fs16 = require("node:fs");
|
|
53907
|
-
var
|
|
54068
|
+
var import_node_path25 = require("node:path");
|
|
53908
54069
|
var CheckoutRegistry = class {
|
|
53909
54070
|
file;
|
|
53910
54071
|
constructor(stateDir) {
|
|
53911
|
-
this.file = (0,
|
|
54072
|
+
this.file = (0, import_node_path25.join)(stateDir, "checkouts.json");
|
|
53912
54073
|
(0, import_node_fs16.mkdirSync)(stateDir, { recursive: true });
|
|
53913
54074
|
}
|
|
53914
54075
|
read() {
|
|
@@ -53922,9 +54083,9 @@ var CheckoutRegistry = class {
|
|
|
53922
54083
|
get(slug) {
|
|
53923
54084
|
return this.read()[slug] ?? null;
|
|
53924
54085
|
}
|
|
53925
|
-
confirm(slug,
|
|
54086
|
+
confirm(slug, path23, now) {
|
|
53926
54087
|
const all = this.read();
|
|
53927
|
-
all[slug] = { path:
|
|
54088
|
+
all[slug] = { path: path23, confirmedAt: now };
|
|
53928
54089
|
(0, import_node_fs16.writeFileSync)(this.file, JSON.stringify(all, null, 2));
|
|
53929
54090
|
}
|
|
53930
54091
|
};
|
|
@@ -54274,7 +54435,7 @@ function extractVerificationSection(markdown) {
|
|
|
54274
54435
|
// src/director-reseed.ts
|
|
54275
54436
|
var import_node_fs18 = require("node:fs");
|
|
54276
54437
|
var import_node_readline = require("node:readline");
|
|
54277
|
-
var
|
|
54438
|
+
var import_node_path26 = require("node:path");
|
|
54278
54439
|
function estimateTokens(s) {
|
|
54279
54440
|
return Buffer.byteLength(s, "utf8");
|
|
54280
54441
|
}
|
|
@@ -54406,7 +54567,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
54406
54567
|
const lines2 = [];
|
|
54407
54568
|
let missingFiles = 0;
|
|
54408
54569
|
for (const f of files) {
|
|
54409
|
-
const filePath = (0,
|
|
54570
|
+
const filePath = (0, import_node_path26.join)(logsDir, f);
|
|
54410
54571
|
try {
|
|
54411
54572
|
const stream = (0, import_node_fs18.createReadStream)(filePath, { encoding: "utf8" });
|
|
54412
54573
|
const rl = (0, import_node_readline.createInterface)({ input: stream, crlfDelay: Infinity });
|
|
@@ -54433,11 +54594,11 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
54433
54594
|
|
|
54434
54595
|
// src/external-agents-scrub.ts
|
|
54435
54596
|
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
54436
|
-
var
|
|
54437
|
-
var
|
|
54597
|
+
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
54598
|
+
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
54438
54599
|
var REDACTION = "[REDACTED]";
|
|
54439
54600
|
var SHORT_VALUE_THRESHOLD = 8;
|
|
54440
|
-
var KEYS_ENV_PATH = () =>
|
|
54601
|
+
var KEYS_ENV_PATH = () => import_node_path27.default.join(import_node_os12.default.homedir(), ".local", "state", "external-agents", "keys.env");
|
|
54441
54602
|
var keysEnvCache = null;
|
|
54442
54603
|
function readKeysEnv() {
|
|
54443
54604
|
const filePath = KEYS_ENV_PATH();
|
|
@@ -54881,9 +55042,9 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
54881
55042
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
54882
55043
|
}
|
|
54883
55044
|
function readCodexFallbackModels() {
|
|
54884
|
-
const codexHome = process.env.CODEX_HOME?.trim() ||
|
|
55045
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path28.default.join(import_node_os13.default.homedir(), ".codex");
|
|
54885
55046
|
const models = /* @__PURE__ */ new Map();
|
|
54886
|
-
const cachePath =
|
|
55047
|
+
const cachePath = import_node_path28.default.join(codexHome, "models_cache.json");
|
|
54887
55048
|
const cacheRaw = readTextIfExists(cachePath);
|
|
54888
55049
|
if (cacheRaw) {
|
|
54889
55050
|
try {
|
|
@@ -54933,7 +55094,7 @@ function readCodexFallbackModels() {
|
|
|
54933
55094
|
);
|
|
54934
55095
|
}
|
|
54935
55096
|
}
|
|
54936
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
55097
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path28.default.join(codexHome, "config.toml"))) {
|
|
54937
55098
|
addBridgeModel(
|
|
54938
55099
|
models,
|
|
54939
55100
|
mapBridgeModel({
|
|
@@ -54947,11 +55108,11 @@ function readCodexFallbackModels() {
|
|
|
54947
55108
|
})
|
|
54948
55109
|
);
|
|
54949
55110
|
}
|
|
54950
|
-
const automationsDir =
|
|
55111
|
+
const automationsDir = import_node_path28.default.join(codexHome, "automations");
|
|
54951
55112
|
try {
|
|
54952
55113
|
for (const entry of import_node_fs20.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
54953
55114
|
if (!entry.isDirectory()) continue;
|
|
54954
|
-
for (const slug of readKnownGptSlugsFromTomlFile(
|
|
55115
|
+
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path28.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
54955
55116
|
addBridgeModel(
|
|
54956
55117
|
models,
|
|
54957
55118
|
mapBridgeModel({
|
|
@@ -54977,7 +55138,7 @@ function selfUpdateInboxItemId(offeredVersion) {
|
|
|
54977
55138
|
return `II-MCPUPD-${offeredVersion.replace(/[^A-Za-z0-9._-]/g, "-")}-${hash3}`;
|
|
54978
55139
|
}
|
|
54979
55140
|
function neutralCheckoutCwd(stateDir) {
|
|
54980
|
-
const dir =
|
|
55141
|
+
const dir = import_node_path28.default.join(stateDir, "no-checkout");
|
|
54981
55142
|
try {
|
|
54982
55143
|
import_node_fs20.default.mkdirSync(dir, { recursive: true });
|
|
54983
55144
|
} catch {
|
|
@@ -55527,8 +55688,7 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
55527
55688
|
}
|
|
55528
55689
|
}
|
|
55529
55690
|
function readStateDir() {
|
|
55530
|
-
|
|
55531
|
-
return import_node_path27.default.join(import_node_os12.default.homedir(), ".mrrlin", "director-bridge");
|
|
55691
|
+
return resolveStateDir(process.env);
|
|
55532
55692
|
}
|
|
55533
55693
|
function readAllowedOrigins() {
|
|
55534
55694
|
const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
|
|
@@ -55964,7 +56124,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
55964
56124
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "invalid_input", fields: { projectSlug: "required" } } });
|
|
55965
56125
|
return;
|
|
55966
56126
|
}
|
|
55967
|
-
const state = readCheckoutState(deps.checkoutRegistry, projectSlug,
|
|
56127
|
+
const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os13.default.hostname());
|
|
55968
56128
|
if (!state) {
|
|
55969
56129
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "checkout_missing" } });
|
|
55970
56130
|
return;
|
|
@@ -55996,7 +56156,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
55996
56156
|
const result = registerCheckout(
|
|
55997
56157
|
deps.checkoutRegistry,
|
|
55998
56158
|
{ projectSlug, path: typeof msg.path === "string" ? msg.path : "", repo },
|
|
55999
|
-
|
|
56159
|
+
import_node_os13.default.hostname()
|
|
56000
56160
|
);
|
|
56001
56161
|
if (!result.ok) {
|
|
56002
56162
|
sendForSpan({ type: "checkout-register", ok: false, error: { code: result.code, detail: result.detail } });
|
|
@@ -57063,8 +57223,8 @@ async function startDirectorBridge() {
|
|
|
57063
57223
|
codexCwd: config2.codexCwd,
|
|
57064
57224
|
codexExecutable: config2.codexExecutable,
|
|
57065
57225
|
checkoutRegistry,
|
|
57066
|
-
worktreeRoot:
|
|
57067
|
-
locksDir:
|
|
57226
|
+
worktreeRoot: import_node_path28.default.join(config2.stateDir, "worktrees"),
|
|
57227
|
+
locksDir: import_node_path28.default.join(config2.stateDir, "locks"),
|
|
57068
57228
|
// Wire the executor server for code-execution runs. Each run gets its own provider process
|
|
57069
57229
|
// (app-server for codex, a resident CLI child for claude) at the run worktree, running
|
|
57070
57230
|
// UNRESTRICTED from the real operator config (owner no-sandbox decision — auth + mrrlin MCP
|
|
@@ -57108,7 +57268,7 @@ async function startDirectorBridge() {
|
|
|
57108
57268
|
// egressDomains is retained in the seam signature (verification-turn.ts still computes the
|
|
57109
57269
|
// env host) but no longer constrains anything — the executor is unrestricted.
|
|
57110
57270
|
startSandbox: async (_egressDomains, providerId) => {
|
|
57111
|
-
const cwd = import_node_fs20.default.mkdtempSync(
|
|
57271
|
+
const cwd = import_node_fs20.default.mkdtempSync(import_node_path28.default.join(import_node_os13.default.tmpdir(), "mrrlin-verify-"));
|
|
57112
57272
|
let executor;
|
|
57113
57273
|
try {
|
|
57114
57274
|
executor = await startExecutorServer({ worktree: cwd, provider: providerId });
|
|
@@ -57147,7 +57307,11 @@ async function startDirectorBridge() {
|
|
|
57147
57307
|
attemptOutcome,
|
|
57148
57308
|
cwd: config2.codexCwd ?? process.cwd(),
|
|
57149
57309
|
codexExecutable: config2.codexExecutable,
|
|
57150
|
-
runId
|
|
57310
|
+
runId,
|
|
57311
|
+
// Where this gate records what each of its provider calls cost. The same directory the
|
|
57312
|
+
// uploader reads from (`uploadPendingDays(config.stateDir, ...)` further down this file),
|
|
57313
|
+
// so a record written here is picked up by the very next telemetry tick.
|
|
57314
|
+
stateDir: config2.stateDir
|
|
57151
57315
|
});
|
|
57152
57316
|
return runDeliverableGate({ projectSlug, deliverablePageId, attemptOutcome }, gateDeps);
|
|
57153
57317
|
}
|
|
@@ -57305,7 +57469,7 @@ async function startDirectorBridge() {
|
|
|
57305
57469
|
const relayUrl = process.env.MRRLIN_RELAY_URL?.trim();
|
|
57306
57470
|
const relayConfigured = Boolean(agentSecret && relayUrl);
|
|
57307
57471
|
const buildReseedPrefix = async (args) => {
|
|
57308
|
-
const
|
|
57472
|
+
const refuse2 = (reason) => {
|
|
57309
57473
|
bridgeLogger.logOut({
|
|
57310
57474
|
spanId: "reseed",
|
|
57311
57475
|
sessionId: args.directorSessionId,
|
|
@@ -57314,8 +57478,8 @@ async function startDirectorBridge() {
|
|
|
57314
57478
|
});
|
|
57315
57479
|
return NO_HISTORY_BLOCK;
|
|
57316
57480
|
};
|
|
57317
|
-
if (!resolveBridgeLogEnabled()) return
|
|
57318
|
-
if (!resolvePromptsEnabled()) return
|
|
57481
|
+
if (!resolveBridgeLogEnabled()) return refuse2("log-disabled");
|
|
57482
|
+
if (!resolvePromptsEnabled()) return refuse2("prompts-not-logged");
|
|
57319
57483
|
const retentionWindowMs = readEnvInt("MRRLIN_LOG_RETENTION_AGE_DAYS", 30) * 864e5;
|
|
57320
57484
|
const reseedWindowMs = Math.min(config2.idleThreadTtlMs, retentionWindowMs);
|
|
57321
57485
|
if (reseedWindowMs < config2.idleThreadTtlMs) {
|
|
@@ -57332,15 +57496,15 @@ async function startDirectorBridge() {
|
|
|
57332
57496
|
}
|
|
57333
57497
|
const files = dayFilesInWindow(/* @__PURE__ */ new Date(), reseedWindowMs);
|
|
57334
57498
|
const sessionIds = [args.directorSessionId, ...args.priorSessionIds];
|
|
57335
|
-
const { lines: lines2, missingFiles } = await readSessionRows(
|
|
57499
|
+
const { lines: lines2, missingFiles } = await readSessionRows(import_node_path28.default.join(config2.stateDir, "logs"), files, sessionIds);
|
|
57336
57500
|
const { items, skipped: skipped2 } = extractItems(lines2, sessionIds);
|
|
57337
|
-
if (items.length === 0) return
|
|
57501
|
+
if (items.length === 0) return refuse2("no-rows");
|
|
57338
57502
|
const budget = Math.max(0, Math.min(config2.reseedMaxTokens, config2.turnMaxTokens - args.otherBytes));
|
|
57339
57503
|
const block = renderReseedBlock(items, {
|
|
57340
57504
|
maxTokens: budget,
|
|
57341
57505
|
minConversationalItems: config2.reseedMinItems
|
|
57342
57506
|
});
|
|
57343
|
-
if (!block) return
|
|
57507
|
+
if (!block) return refuse2("below-minimum-after-truncation");
|
|
57344
57508
|
bridgeLogger.logOut({
|
|
57345
57509
|
spanId: "reseed",
|
|
57346
57510
|
sessionId: args.directorSessionId,
|
|
@@ -57565,8 +57729,8 @@ async function startDirectorBridge() {
|
|
|
57565
57729
|
);
|
|
57566
57730
|
void runOrphanWorktreeSweep(client, {
|
|
57567
57731
|
checkoutRegistry,
|
|
57568
|
-
worktreeRoot:
|
|
57569
|
-
locksDir:
|
|
57732
|
+
worktreeRoot: import_node_path28.default.join(config2.stateDir, "worktrees"),
|
|
57733
|
+
locksDir: import_node_path28.default.join(config2.stateDir, "locks")
|
|
57570
57734
|
});
|
|
57571
57735
|
{
|
|
57572
57736
|
const { retainedBuffers, retainedBytes, tombstonesRemoved } = sweepReplayBuffers(threads, tombstones, {
|
|
@@ -57896,7 +58060,7 @@ function readDispatchBody(req) {
|
|
|
57896
58060
|
function readOrCreateBridgeToken(stateDir) {
|
|
57897
58061
|
const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
|
|
57898
58062
|
if (explicit) return explicit;
|
|
57899
|
-
const tokenPath =
|
|
58063
|
+
const tokenPath = import_node_path28.default.join(stateDir, "token.txt");
|
|
57900
58064
|
try {
|
|
57901
58065
|
const existing = import_node_fs20.default.readFileSync(tokenPath, "utf8").trim();
|
|
57902
58066
|
if (existing) return existing;
|
|
@@ -61294,15 +61458,15 @@ var StdioServerTransport = class {
|
|
|
61294
61458
|
// src/tools.ts
|
|
61295
61459
|
var import_node_crypto14 = require("node:crypto");
|
|
61296
61460
|
var import_promises10 = require("node:fs/promises");
|
|
61297
|
-
var
|
|
61298
|
-
var
|
|
61461
|
+
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
61462
|
+
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
61299
61463
|
|
|
61300
61464
|
// ../../packages/wiki/dist/index.js
|
|
61301
61465
|
var import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
61302
|
-
var
|
|
61466
|
+
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
61303
61467
|
var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
|
|
61304
61468
|
function toPosixPath(input) {
|
|
61305
|
-
return input.split(
|
|
61469
|
+
return input.split(import_node_path29.default.sep).join("/");
|
|
61306
61470
|
}
|
|
61307
61471
|
function slugifyWikiSegment(input) {
|
|
61308
61472
|
return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -61316,12 +61480,12 @@ async function pathExists3(input) {
|
|
|
61316
61480
|
}
|
|
61317
61481
|
}
|
|
61318
61482
|
async function findWorkspaceRoot(start = process.cwd()) {
|
|
61319
|
-
let current2 =
|
|
61483
|
+
let current2 = import_node_path29.default.resolve(start);
|
|
61320
61484
|
while (true) {
|
|
61321
|
-
if (await pathExists3(
|
|
61485
|
+
if (await pathExists3(import_node_path29.default.join(current2, "pnpm-workspace.yaml")) && await pathExists3(import_node_path29.default.join(current2, "docs"))) {
|
|
61322
61486
|
return current2;
|
|
61323
61487
|
}
|
|
61324
|
-
const parent =
|
|
61488
|
+
const parent = import_node_path29.default.dirname(current2);
|
|
61325
61489
|
if (parent === current2) {
|
|
61326
61490
|
throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
|
|
61327
61491
|
}
|
|
@@ -61330,28 +61494,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
|
|
|
61330
61494
|
}
|
|
61331
61495
|
async function resolveDocsRoot(input) {
|
|
61332
61496
|
if (input) {
|
|
61333
|
-
return
|
|
61497
|
+
return import_node_path29.default.resolve(input);
|
|
61334
61498
|
}
|
|
61335
61499
|
if (process.env.MRRLIN_DOCS_ROOT) {
|
|
61336
|
-
return
|
|
61500
|
+
return import_node_path29.default.resolve(process.env.MRRLIN_DOCS_ROOT);
|
|
61337
61501
|
}
|
|
61338
|
-
return
|
|
61502
|
+
return import_node_path29.default.join(await findWorkspaceRoot(), "docs");
|
|
61339
61503
|
}
|
|
61340
61504
|
async function resolveIndexPath(input) {
|
|
61341
61505
|
if (input) {
|
|
61342
|
-
return
|
|
61506
|
+
return import_node_path29.default.resolve(input);
|
|
61343
61507
|
}
|
|
61344
61508
|
if (process.env.MRRLIN_WIKI_INDEX_PATH) {
|
|
61345
|
-
return
|
|
61509
|
+
return import_node_path29.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
61346
61510
|
}
|
|
61347
61511
|
const workspaceRoot = await findWorkspaceRoot();
|
|
61348
|
-
return
|
|
61512
|
+
return import_node_path29.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
61349
61513
|
}
|
|
61350
61514
|
async function walkMarkdownFiles(root, dir = root) {
|
|
61351
61515
|
const entries = await import_promises8.default.readdir(dir, { withFileTypes: true });
|
|
61352
61516
|
const files = [];
|
|
61353
61517
|
for (const entry of entries) {
|
|
61354
|
-
const absolute =
|
|
61518
|
+
const absolute = import_node_path29.default.join(dir, entry.name);
|
|
61355
61519
|
if (entry.isDirectory()) {
|
|
61356
61520
|
files.push(...await walkMarkdownFiles(root, absolute));
|
|
61357
61521
|
continue;
|
|
@@ -61370,7 +61534,7 @@ function parseTitle(markdown, sourcePath) {
|
|
|
61370
61534
|
return title;
|
|
61371
61535
|
}
|
|
61372
61536
|
function documentFromFile(docsRoot, absolutePath, markdown) {
|
|
61373
|
-
const relativePath = toPosixPath(
|
|
61537
|
+
const relativePath = toPosixPath(import_node_path29.default.relative(docsRoot, absolutePath));
|
|
61374
61538
|
const [section, fileName] = relativePath.split("/");
|
|
61375
61539
|
if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
|
|
61376
61540
|
return null;
|
|
@@ -61813,7 +61977,12 @@ ${artifact}${dismissedBlock}` : `${artifact}${dismissedBlock}`;
|
|
|
61813
61977
|
const rePicked = await pickOnce();
|
|
61814
61978
|
if (!rePicked.ok || rePicked.agents.length <= built.agents.length) return { ok: false };
|
|
61815
61979
|
const rebuilt = buildFromAgents(rePicked.agents);
|
|
61816
|
-
return {
|
|
61980
|
+
return {
|
|
61981
|
+
ok: true,
|
|
61982
|
+
composition: rebuilt.composition,
|
|
61983
|
+
runHead: rebuilt.runHead,
|
|
61984
|
+
assignment: rebuilt.assignment
|
|
61985
|
+
};
|
|
61817
61986
|
};
|
|
61818
61987
|
return { ok: true, runner: { ...built, repick } };
|
|
61819
61988
|
}
|
|
@@ -61956,7 +62125,19 @@ function multiLlmActive(_env = process.env) {
|
|
|
61956
62125
|
}
|
|
61957
62126
|
function applyActivePanel(deps, panel) {
|
|
61958
62127
|
if (!panel) return;
|
|
61959
|
-
|
|
62128
|
+
const record2 = deps.recordHeadCall;
|
|
62129
|
+
deps.runHead = record2 === void 0 ? panel.runHead : async (persona, artifact, dismissed) => {
|
|
62130
|
+
const agentId = panel.assignment[persona] ?? null;
|
|
62131
|
+
const startedAt = Date.now();
|
|
62132
|
+
try {
|
|
62133
|
+
const result = await panel.runHead(persona, artifact, dismissed);
|
|
62134
|
+
record2(persona, agentId, startedAt, result);
|
|
62135
|
+
return result;
|
|
62136
|
+
} catch (error51) {
|
|
62137
|
+
record2(persona, agentId, startedAt, { ok: false, error: error51 instanceof Error ? error51.message : String(error51) });
|
|
62138
|
+
throw error51;
|
|
62139
|
+
}
|
|
62140
|
+
};
|
|
61960
62141
|
deps.panelComposition = panel.composition;
|
|
61961
62142
|
}
|
|
61962
62143
|
async function resolveActivePanel(input, deps) {
|
|
@@ -61991,11 +62172,254 @@ async function resolveActivePanel(input, deps) {
|
|
|
61991
62172
|
deps
|
|
61992
62173
|
);
|
|
61993
62174
|
if (!built.ok) return null;
|
|
61994
|
-
return {
|
|
62175
|
+
return {
|
|
62176
|
+
runHead: built.runner.runHead,
|
|
62177
|
+
composition: built.runner.composition,
|
|
62178
|
+
assignment: built.runner.assignment
|
|
62179
|
+
};
|
|
62180
|
+
} catch {
|
|
62181
|
+
return null;
|
|
62182
|
+
}
|
|
62183
|
+
}
|
|
62184
|
+
|
|
62185
|
+
// src/delivery/wiki.ts
|
|
62186
|
+
async function deliverToWiki(client, projectSlug, payload) {
|
|
62187
|
+
if (payload.operation === "create") return client.createWikiPage(projectSlug, payload.page);
|
|
62188
|
+
return client.updateWikiPage(projectSlug, payload.pageId, payload.patch);
|
|
62189
|
+
}
|
|
62190
|
+
|
|
62191
|
+
// src/delivery/git.ts
|
|
62192
|
+
async function deliverToGit(client, projectSlug, payload) {
|
|
62193
|
+
if (payload.operation === "branch") {
|
|
62194
|
+
return client.createGithubBranch(projectSlug, { baseBranch: payload.baseBranch, branchName: payload.branchName });
|
|
62195
|
+
}
|
|
62196
|
+
return client.createGithubPullRequest(projectSlug, {
|
|
62197
|
+
baseBranch: payload.baseBranch,
|
|
62198
|
+
body: payload.body,
|
|
62199
|
+
draft: payload.draft,
|
|
62200
|
+
headBranch: payload.headBranch,
|
|
62201
|
+
title: payload.title
|
|
62202
|
+
});
|
|
62203
|
+
}
|
|
62204
|
+
|
|
62205
|
+
// src/delivery/index.ts
|
|
62206
|
+
async function deliverThroughCapability(client, input) {
|
|
62207
|
+
if (resolveKindCapability(input.artifactKind) === null) {
|
|
62208
|
+
return { ok: false, reason: "blocked_kind" };
|
|
62209
|
+
}
|
|
62210
|
+
let resolution;
|
|
62211
|
+
try {
|
|
62212
|
+
resolution = await client.resolveDeliveryForArtifactKind(
|
|
62213
|
+
input.projectSlug,
|
|
62214
|
+
input.artifactKind,
|
|
62215
|
+
input.taskProjectSlug,
|
|
62216
|
+
input.taskId ?? void 0
|
|
62217
|
+
);
|
|
62218
|
+
} catch {
|
|
62219
|
+
return { ok: false, reason: "transport_error" };
|
|
62220
|
+
}
|
|
62221
|
+
if (!resolution.ok) {
|
|
62222
|
+
return { ok: false, reason: resolution.reason };
|
|
62223
|
+
}
|
|
62224
|
+
const { route, verdict } = resolution;
|
|
62225
|
+
if (verdict === "silent") {
|
|
62226
|
+
return proceedToDestination(client, route, input);
|
|
62227
|
+
}
|
|
62228
|
+
if (verdict === "ask_once") {
|
|
62229
|
+
return handleAskOnce(client, route, input);
|
|
62230
|
+
}
|
|
62231
|
+
if (verdict === "window") {
|
|
62232
|
+
return handleWindow(client, route, input);
|
|
62233
|
+
}
|
|
62234
|
+
if (verdict === "approval") {
|
|
62235
|
+
return handleApproval(client, route, input);
|
|
62236
|
+
}
|
|
62237
|
+
await recordUse(client, route, input, "refused");
|
|
62238
|
+
return { ok: false, reason: "gate_refused" };
|
|
62239
|
+
}
|
|
62240
|
+
async function proceedToDestination(client, route, input) {
|
|
62241
|
+
try {
|
|
62242
|
+
const result = await callDestination(client, input.taskProjectSlug, route.capability, input.payload);
|
|
62243
|
+
const recorded = await recordUse(client, route, input, "ok");
|
|
62244
|
+
return { ok: true, use: recorded, result };
|
|
62245
|
+
} catch {
|
|
62246
|
+
await recordUse(client, route, input, "error");
|
|
62247
|
+
return { ok: false, reason: "delivery_failed" };
|
|
62248
|
+
}
|
|
62249
|
+
}
|
|
62250
|
+
async function refuse(client, route, input) {
|
|
62251
|
+
await recordUse(client, route, input, "refused");
|
|
62252
|
+
return { ok: false, reason: "gate_refused" };
|
|
62253
|
+
}
|
|
62254
|
+
async function handleAskOnce(client, route, input) {
|
|
62255
|
+
const groupId = `capability:ask-once:${input.taskProjectSlug}:${route.serverId}`;
|
|
62256
|
+
try {
|
|
62257
|
+
await client.createInboxItem(input.taskProjectSlug, {
|
|
62258
|
+
id: `II-capability-ask-once-${input.taskProjectSlug}-${route.serverId}`,
|
|
62259
|
+
kind: "question",
|
|
62260
|
+
origin: "capability",
|
|
62261
|
+
groupId,
|
|
62262
|
+
body: `The first write to ${route.serverId} (via ${route.toolName}) needs a one-time confirmation before it can proceed.`,
|
|
62263
|
+
taskId: input.taskId
|
|
62264
|
+
});
|
|
62265
|
+
} catch {
|
|
62266
|
+
}
|
|
62267
|
+
return refuse(client, route, input);
|
|
62268
|
+
}
|
|
62269
|
+
async function alreadyConsumed(client, route, input, after) {
|
|
62270
|
+
let uses;
|
|
62271
|
+
try {
|
|
62272
|
+
uses = await client.listCapabilityUses(input.taskProjectSlug);
|
|
62273
|
+
} catch {
|
|
62274
|
+
return true;
|
|
62275
|
+
}
|
|
62276
|
+
const afterMs = Date.parse(after);
|
|
62277
|
+
if (!Number.isFinite(afterMs)) return true;
|
|
62278
|
+
return uses.some((use) => {
|
|
62279
|
+
if (use.serverId !== route.serverId || use.toolName !== route.toolName || use.taskId !== input.taskId || use.outcome !== "ok") {
|
|
62280
|
+
return false;
|
|
62281
|
+
}
|
|
62282
|
+
const useAtMs = Date.parse(use.at);
|
|
62283
|
+
if (!Number.isFinite(useAtMs)) return true;
|
|
62284
|
+
return useAtMs > afterMs;
|
|
62285
|
+
});
|
|
62286
|
+
}
|
|
62287
|
+
async function handleApproval(client, route, input) {
|
|
62288
|
+
const scopeId = input.runId ?? input.taskId;
|
|
62289
|
+
if (scopeId === null) {
|
|
62290
|
+
return refuse(client, route, input);
|
|
62291
|
+
}
|
|
62292
|
+
const groupId = `capability:approval:${scopeId}:${route.serverId}:${route.toolName}`;
|
|
62293
|
+
const id = `II-capability-approval-${scopeId}-${route.serverId}-${route.toolName}`;
|
|
62294
|
+
let items;
|
|
62295
|
+
try {
|
|
62296
|
+
items = await client.listInboxItems(input.taskProjectSlug, { groupId });
|
|
62297
|
+
} catch {
|
|
62298
|
+
return refuse(client, route, input);
|
|
62299
|
+
}
|
|
62300
|
+
const existing = items[0];
|
|
62301
|
+
if (!existing) {
|
|
62302
|
+
try {
|
|
62303
|
+
await client.createInboxItem(input.taskProjectSlug, {
|
|
62304
|
+
id,
|
|
62305
|
+
kind: "question",
|
|
62306
|
+
origin: "capability",
|
|
62307
|
+
groupId,
|
|
62308
|
+
body: `Approve ${route.toolName} on ${route.serverId}?`,
|
|
62309
|
+
taskId: input.taskId
|
|
62310
|
+
});
|
|
62311
|
+
} catch {
|
|
62312
|
+
}
|
|
62313
|
+
return refuse(client, route, input);
|
|
62314
|
+
}
|
|
62315
|
+
if (existing.status !== "approved") {
|
|
62316
|
+
return refuse(client, route, input);
|
|
62317
|
+
}
|
|
62318
|
+
if (existing.decidedAt === null) {
|
|
62319
|
+
return refuse(client, route, input);
|
|
62320
|
+
}
|
|
62321
|
+
if (await alreadyConsumed(client, route, input, existing.decidedAt)) {
|
|
62322
|
+
return refuse(client, route, input);
|
|
62323
|
+
}
|
|
62324
|
+
return proceedToDestination(client, route, input);
|
|
62325
|
+
}
|
|
62326
|
+
async function handleWindow(client, route, input) {
|
|
62327
|
+
if (input.taskId === null) {
|
|
62328
|
+
return refuse(client, route, input);
|
|
62329
|
+
}
|
|
62330
|
+
const taskId = input.taskId;
|
|
62331
|
+
const scopeId = input.runId ?? taskId;
|
|
62332
|
+
const groupId = `capability:window:${scopeId}:${route.serverId}:${route.toolName}`;
|
|
62333
|
+
const id = `II-capability-window-${scopeId}-${route.serverId}-${route.toolName}`;
|
|
62334
|
+
let items;
|
|
62335
|
+
try {
|
|
62336
|
+
items = await client.listInboxItems(input.taskProjectSlug, { groupId });
|
|
62337
|
+
} catch {
|
|
62338
|
+
return refuse(client, route, input);
|
|
62339
|
+
}
|
|
62340
|
+
const existing = items[0];
|
|
62341
|
+
if (!existing) {
|
|
62342
|
+
try {
|
|
62343
|
+
await client.createInboxItem(input.taskProjectSlug, {
|
|
62344
|
+
id,
|
|
62345
|
+
kind: "question",
|
|
62346
|
+
origin: "capability",
|
|
62347
|
+
groupId,
|
|
62348
|
+
body: `Waiting for the ${route.toolName} window on ${route.serverId} to elapse.`,
|
|
62349
|
+
taskId
|
|
62350
|
+
});
|
|
62351
|
+
} catch {
|
|
62352
|
+
}
|
|
62353
|
+
await extendFollowUpAt(client, input.taskProjectSlug, taskId);
|
|
62354
|
+
return refuse(client, route, input);
|
|
62355
|
+
}
|
|
62356
|
+
if (existing.status === "rejected") {
|
|
62357
|
+
return refuse(client, route, input);
|
|
62358
|
+
}
|
|
62359
|
+
let task;
|
|
62360
|
+
try {
|
|
62361
|
+
task = await client.getTask(input.taskProjectSlug, taskId);
|
|
62362
|
+
} catch {
|
|
62363
|
+
return refuse(client, route, input);
|
|
62364
|
+
}
|
|
62365
|
+
const elapsed = task.followUpAt !== null && Date.parse(task.followUpAt) <= Date.now();
|
|
62366
|
+
if (!elapsed) {
|
|
62367
|
+
return refuse(client, route, input);
|
|
62368
|
+
}
|
|
62369
|
+
if (await alreadyConsumed(client, route, input, existing.createdAt)) {
|
|
62370
|
+
return refuse(client, route, input);
|
|
62371
|
+
}
|
|
62372
|
+
const result = await proceedToDestination(client, route, input);
|
|
62373
|
+
if (result.ok) {
|
|
62374
|
+
try {
|
|
62375
|
+
await client.decideInboxItem(input.taskProjectSlug, existing.id, { verdict: "acknowledged", decidedBy: "system" });
|
|
62376
|
+
} catch {
|
|
62377
|
+
}
|
|
62378
|
+
}
|
|
62379
|
+
return result;
|
|
62380
|
+
}
|
|
62381
|
+
async function extendFollowUpAt(client, taskProjectSlug, taskId) {
|
|
62382
|
+
try {
|
|
62383
|
+
const task = await client.getTask(taskProjectSlug, taskId);
|
|
62384
|
+
const existingMs = task.followUpAt !== null ? Date.parse(task.followUpAt) : -Infinity;
|
|
62385
|
+
const candidateMs = Date.now() + 5 * 60 * 1e3;
|
|
62386
|
+
if (candidateMs > existingMs) {
|
|
62387
|
+
await client.updateTask(taskProjectSlug, taskId, { followUpAt: new Date(candidateMs).toISOString() });
|
|
62388
|
+
}
|
|
62389
|
+
} catch {
|
|
62390
|
+
}
|
|
62391
|
+
}
|
|
62392
|
+
async function recordUse(client, route, input, outcome) {
|
|
62393
|
+
try {
|
|
62394
|
+
return await client.recordCapabilityUse(input.taskProjectSlug, {
|
|
62395
|
+
serverId: route.serverId,
|
|
62396
|
+
toolName: route.toolName,
|
|
62397
|
+
taskId: input.taskId,
|
|
62398
|
+
outcome
|
|
62399
|
+
});
|
|
61995
62400
|
} catch {
|
|
61996
62401
|
return null;
|
|
61997
62402
|
}
|
|
61998
62403
|
}
|
|
62404
|
+
async function callDestination(client, projectSlug, capability, payload) {
|
|
62405
|
+
const operation = isRecord4(payload) ? payload.operation : void 0;
|
|
62406
|
+
if (capability === "wiki") {
|
|
62407
|
+
if (operation !== "create" && operation !== "update") {
|
|
62408
|
+
throw new Error(`callDestination: payload.operation "${String(operation)}" is not valid for wiki`);
|
|
62409
|
+
}
|
|
62410
|
+
return deliverToWiki(client, projectSlug, payload);
|
|
62411
|
+
}
|
|
62412
|
+
if (capability === "git") {
|
|
62413
|
+
if (operation !== "branch" && operation !== "pull_request") {
|
|
62414
|
+
throw new Error(`callDestination: payload.operation "${String(operation)}" is not valid for git`);
|
|
62415
|
+
}
|
|
62416
|
+
return deliverToGit(client, projectSlug, payload);
|
|
62417
|
+
}
|
|
62418
|
+
throw new Error(`callDestination: no destination wired for capability "${capability}"`);
|
|
62419
|
+
}
|
|
62420
|
+
function isRecord4(value) {
|
|
62421
|
+
return typeof value === "object" && value !== null;
|
|
62422
|
+
}
|
|
61999
62423
|
|
|
62000
62424
|
// src/decision-consensus.ts
|
|
62001
62425
|
var ANCHOR_TIMEOUT_MS = Number(process.env["MRRLIN_DECISION_TIMEOUT_MS"] ?? 9e4);
|
|
@@ -62334,9 +62758,9 @@ async function runNativeSpecGate(ctx, input, builders = defaultNativeSpecGateBui
|
|
|
62334
62758
|
specPageId: input.pageId,
|
|
62335
62759
|
cwd: ctx.cwd,
|
|
62336
62760
|
codexExecutable: ctx.codexExecutable,
|
|
62337
|
-
// Where the gate records what each of its provider calls cost.
|
|
62338
|
-
// four gate-deps call sites
|
|
62339
|
-
//
|
|
62761
|
+
// Where the gate records what each of its provider calls cost. Without it the recorder is a
|
|
62762
|
+
// no-op, which is how three of the four gate-deps call sites once ran silent; all four pass one
|
|
62763
|
+
// now, and `consensus/gate-cost-call-sites.test.ts` fails if a fifth appears without it.
|
|
62340
62764
|
stateDir: ctx.stateDir,
|
|
62341
62765
|
extraHeadCount: input.extraHeads?.length ?? 0,
|
|
62342
62766
|
// model-tier-planning-and-arbiter task 1.21: the seat minted at the async-job claim.
|
|
@@ -62782,6 +63206,9 @@ async function run2(ctx, input) {
|
|
|
62782
63206
|
deliverablePageId: input.pageId,
|
|
62783
63207
|
cwd: ctx.cwd,
|
|
62784
63208
|
codexExecutable: ctx.codexExecutable,
|
|
63209
|
+
// Where the gate records what each of its provider calls cost — the same `ctx.stateDir` the
|
|
63210
|
+
// spec gate next door already passes.
|
|
63211
|
+
stateDir: ctx.stateDir,
|
|
62785
63212
|
// model-tier-planning-and-arbiter task 1.21: the seat minted at the async-job claim.
|
|
62786
63213
|
seat: ctx.seat
|
|
62787
63214
|
});
|
|
@@ -63036,17 +63463,17 @@ var intentCheckDescriptor = createIntentCheckDescriptor();
|
|
|
63036
63463
|
|
|
63037
63464
|
// src/evidence/assembler.ts
|
|
63038
63465
|
var import_promises9 = require("node:fs/promises");
|
|
63039
|
-
var
|
|
63466
|
+
var import_node_path30 = require("node:path");
|
|
63040
63467
|
function evidenceDedupKey(sessionId, reportId) {
|
|
63041
63468
|
return `${sessionId}:${reportId}`;
|
|
63042
63469
|
}
|
|
63043
|
-
function
|
|
63470
|
+
function isRecord5(v) {
|
|
63044
63471
|
return v !== null && typeof v === "object";
|
|
63045
63472
|
}
|
|
63046
63473
|
async function readDayLines(stateDir, day, sessionId) {
|
|
63047
63474
|
let raw;
|
|
63048
63475
|
try {
|
|
63049
|
-
raw = await (0, import_promises9.readFile)((0,
|
|
63476
|
+
raw = await (0, import_promises9.readFile)((0, import_node_path30.join)(stateDir, "logs", `bridge-${day}.jsonl`), "utf8");
|
|
63050
63477
|
} catch {
|
|
63051
63478
|
return [];
|
|
63052
63479
|
}
|
|
@@ -63059,7 +63486,7 @@ async function readDayLines(stateDir, day, sessionId) {
|
|
|
63059
63486
|
} catch {
|
|
63060
63487
|
continue;
|
|
63061
63488
|
}
|
|
63062
|
-
if (!
|
|
63489
|
+
if (!isRecord5(rec) || !isRecord5(rec.payload)) continue;
|
|
63063
63490
|
if (rec.payload.directorSessionId !== sessionId) continue;
|
|
63064
63491
|
kept.push(rec);
|
|
63065
63492
|
}
|
|
@@ -63120,7 +63547,7 @@ async function assembleEvidence(stateDir, sessionId, reportId, gateCtx) {
|
|
|
63120
63547
|
}
|
|
63121
63548
|
let windowPruned = false;
|
|
63122
63549
|
try {
|
|
63123
|
-
const raw = await (0, import_promises9.readFile)((0,
|
|
63550
|
+
const raw = await (0, import_promises9.readFile)((0, import_node_path30.join)(stateDir, "logs", ".pruned.jsonl"), "utf8");
|
|
63124
63551
|
outer: for (const line of raw.split("\n")) {
|
|
63125
63552
|
if (!line.trim()) continue;
|
|
63126
63553
|
let rec;
|
|
@@ -63129,7 +63556,7 @@ async function assembleEvidence(stateDir, sessionId, reportId, gateCtx) {
|
|
|
63129
63556
|
} catch {
|
|
63130
63557
|
continue;
|
|
63131
63558
|
}
|
|
63132
|
-
if (!
|
|
63559
|
+
if (!isRecord5(rec) || !Array.isArray(rec.daysRemoved)) continue;
|
|
63133
63560
|
for (const removedDay of rec.daysRemoved) {
|
|
63134
63561
|
if (daysRead.includes(removedDay)) {
|
|
63135
63562
|
windowPruned = true;
|
|
@@ -64231,6 +64658,20 @@ function pingAsyncWorkerDispatch(projectSlug, jobId) {
|
|
|
64231
64658
|
}).catch(() => {
|
|
64232
64659
|
});
|
|
64233
64660
|
}
|
|
64661
|
+
async function deliverBuiltIn(client, projectSlug, artifactKind, payload) {
|
|
64662
|
+
const result = await deliverThroughCapability(client, {
|
|
64663
|
+
projectSlug,
|
|
64664
|
+
taskProjectSlug: projectSlug,
|
|
64665
|
+
artifactKind,
|
|
64666
|
+
taskId: null,
|
|
64667
|
+
runId: null,
|
|
64668
|
+
payload
|
|
64669
|
+
});
|
|
64670
|
+
if (!result.ok) {
|
|
64671
|
+
throw new McpToolCodedError(`CAPABILITY_${result.reason.toUpperCase()}`, `Delivery refused: ${result.reason}`);
|
|
64672
|
+
}
|
|
64673
|
+
return result.result;
|
|
64674
|
+
}
|
|
64234
64675
|
function makeTool(client, name, fallbackCode, fallbackMessage, handler) {
|
|
64235
64676
|
return {
|
|
64236
64677
|
description: mcpToolDescriptions[name],
|
|
@@ -64400,19 +64841,24 @@ function createMrrlinTools(options) {
|
|
|
64400
64841
|
"Unable to bind project repository.",
|
|
64401
64842
|
async (c, { projectSlug, ...input }) => await c.bindProjectGithubRepo(projectSlug, input)
|
|
64402
64843
|
),
|
|
64844
|
+
// Task 8.2: routed through deliverBuiltIn, not c.createGithubBranch directly. artifactKind
|
|
64845
|
+
// "code_change" (not "page"): this tool is a generic git operation, not specifically about
|
|
64846
|
+
// publishing a website page (design.md, "`page` routes to git, not the wiki") -- there is no
|
|
64847
|
+
// dedicated page-publishing tool in this change's scope, so a task requiring "page" has no path
|
|
64848
|
+
// through these generic tools today, an accepted limitation of the current scope.
|
|
64403
64849
|
[mcpToolNames.createGithubBranch]: makeTool(
|
|
64404
64850
|
client,
|
|
64405
64851
|
mcpToolNames.createGithubBranch,
|
|
64406
64852
|
"GITHUB_BRANCH_CREATE_FAILED",
|
|
64407
64853
|
"Unable to create GitHub branch.",
|
|
64408
|
-
async (c, { projectSlug, ...input }) => await c
|
|
64854
|
+
async (c, { projectSlug, ...input }) => await deliverBuiltIn(c, projectSlug, "code_change", { operation: "branch", ...input })
|
|
64409
64855
|
),
|
|
64410
64856
|
[mcpToolNames.createGithubPullRequest]: makeTool(
|
|
64411
64857
|
client,
|
|
64412
64858
|
mcpToolNames.createGithubPullRequest,
|
|
64413
64859
|
"GITHUB_PULL_REQUEST_CREATE_FAILED",
|
|
64414
64860
|
"Unable to create GitHub pull request.",
|
|
64415
|
-
async (c, { projectSlug, ...input }) => await c
|
|
64861
|
+
async (c, { projectSlug, ...input }) => await deliverBuiltIn(c, projectSlug, "code_change", { operation: "pull_request", ...input })
|
|
64416
64862
|
),
|
|
64417
64863
|
[mcpToolNames.createPlan]: makeTool(
|
|
64418
64864
|
client,
|
|
@@ -64477,12 +64923,13 @@ function createMrrlinTools(options) {
|
|
|
64477
64923
|
"Unable to append task event.",
|
|
64478
64924
|
async (c, { projectSlug, taskId, ...input }) => await c.appendTaskEvent(projectSlug, taskId, input)
|
|
64479
64925
|
),
|
|
64926
|
+
// Task 8.2: routed through deliverBuiltIn, not c.createWikiPage directly.
|
|
64480
64927
|
[mcpToolNames.createWikiPage]: makeTool(
|
|
64481
64928
|
client,
|
|
64482
64929
|
mcpToolNames.createWikiPage,
|
|
64483
64930
|
"WIKI_PAGE_CREATE_FAILED",
|
|
64484
64931
|
"Unable to create wiki page.",
|
|
64485
|
-
async (c, { projectSlug, ...input }) => await c
|
|
64932
|
+
async (c, { projectSlug, ...input }) => await deliverBuiltIn(c, projectSlug, "document", { operation: "create", page: input })
|
|
64486
64933
|
),
|
|
64487
64934
|
[mcpToolNames.deleteTaskDependency]: makeTool(
|
|
64488
64935
|
client,
|
|
@@ -64665,12 +65112,13 @@ function createMrrlinTools(options) {
|
|
|
64665
65112
|
"Unable to close task as won't-do.",
|
|
64666
65113
|
async (c, { projectSlug, taskId, reason }) => await c.closeTaskAsWontDo(projectSlug, taskId, reason)
|
|
64667
65114
|
),
|
|
65115
|
+
// Task 8.2: routed through deliverBuiltIn, not c.updateWikiPage directly.
|
|
64668
65116
|
[mcpToolNames.updateWikiPage]: makeTool(
|
|
64669
65117
|
client,
|
|
64670
65118
|
mcpToolNames.updateWikiPage,
|
|
64671
65119
|
"WIKI_PAGE_UPDATE_FAILED",
|
|
64672
65120
|
"Unable to update wiki page.",
|
|
64673
|
-
async (c, { projectSlug, pageId, ...patch }) => await c
|
|
65121
|
+
async (c, { projectSlug, pageId, ...patch }) => await deliverBuiltIn(c, projectSlug, "document", { operation: "update", pageId, patch })
|
|
64674
65122
|
),
|
|
64675
65123
|
[mcpToolNames.markSpecReady]: makeTool(
|
|
64676
65124
|
client,
|
|
@@ -64771,7 +65219,12 @@ function createMrrlinTools(options) {
|
|
|
64771
65219
|
baseRef,
|
|
64772
65220
|
cwd: process.cwd(),
|
|
64773
65221
|
codexExecutable: process.env.MRRLIN_DIRECTOR_BRIDGE_CODEX_BIN?.trim() || void 0,
|
|
64774
|
-
extraHeads
|
|
65222
|
+
extraHeads,
|
|
65223
|
+
// Where this gate records what each of its provider calls cost. Unlike the two async
|
|
65224
|
+
// gates, this handler runs in the `serve` process, which holds no config object — so the
|
|
65225
|
+
// directory is resolved from the same env fact the bridge resolves it from, which is why
|
|
65226
|
+
// that fact now lives in one module instead of three copies.
|
|
65227
|
+
stateDir: resolveStateDir()
|
|
64775
65228
|
});
|
|
64776
65229
|
const persistedProvider = await getAgentProviderForPanel(c);
|
|
64777
65230
|
let activeCodePanel = null;
|
|
@@ -64933,7 +65386,7 @@ function createMrrlinTools(options) {
|
|
|
64933
65386
|
"ARTIFACT_FILE_UPLOAD_FAILED",
|
|
64934
65387
|
"Unable to upload artifact file.",
|
|
64935
65388
|
async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
|
|
64936
|
-
const extension2 =
|
|
65389
|
+
const extension2 = import_node_path31.default.extname(filePath).toLowerCase();
|
|
64937
65390
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
64938
65391
|
if (!contentType) {
|
|
64939
65392
|
throw new McpToolCodedError(
|
|
@@ -64961,7 +65414,7 @@ function createMrrlinTools(options) {
|
|
|
64961
65414
|
"Artifact exceeds 5MB; split or summarize instead."
|
|
64962
65415
|
);
|
|
64963
65416
|
}
|
|
64964
|
-
const filename =
|
|
65417
|
+
const filename = import_node_path31.default.basename(filePath);
|
|
64965
65418
|
return uploadArtifactBytes(c, {
|
|
64966
65419
|
bytes: bytes3,
|
|
64967
65420
|
class: artifactClass,
|
|
@@ -64986,7 +65439,7 @@ function createMrrlinTools(options) {
|
|
|
64986
65439
|
`Invalid filename '${filename}'; provide a bare filename with no path separators or '..'.`
|
|
64987
65440
|
);
|
|
64988
65441
|
}
|
|
64989
|
-
const extension2 =
|
|
65442
|
+
const extension2 = import_node_path31.default.extname(filename).toLowerCase();
|
|
64990
65443
|
const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
|
|
64991
65444
|
if (!contentType) {
|
|
64992
65445
|
throw new McpToolCodedError(
|
|
@@ -65060,9 +65513,8 @@ function createMrrlinTools(options) {
|
|
|
65060
65513
|
"LOCAL_CHECKOUT_REGISTER_FAILED",
|
|
65061
65514
|
"Unable to register local checkout.",
|
|
65062
65515
|
async (_c, { projectSlug, path: checkoutPath, repo }) => {
|
|
65063
|
-
const
|
|
65064
|
-
const
|
|
65065
|
-
const result = registerCheckout(registry3, { projectSlug, path: checkoutPath, repo }, import_node_os13.default.hostname());
|
|
65516
|
+
const registry3 = new CheckoutRegistry(resolveStateDir());
|
|
65517
|
+
const result = registerCheckout(registry3, { projectSlug, path: checkoutPath, repo }, import_node_os14.default.hostname());
|
|
65066
65518
|
if (!result.ok) {
|
|
65067
65519
|
const codeMap = {
|
|
65068
65520
|
not_absolute: "LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
|
|
@@ -65299,9 +65751,9 @@ function runSetCredential(args) {
|
|
|
65299
65751
|
}
|
|
65300
65752
|
|
|
65301
65753
|
// src/install-service.ts
|
|
65302
|
-
var
|
|
65754
|
+
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
65303
65755
|
var import_node_fs21 = require("node:fs");
|
|
65304
|
-
var
|
|
65756
|
+
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
65305
65757
|
var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
|
|
65306
65758
|
function defaultHomeOwnerUid(home) {
|
|
65307
65759
|
try {
|
|
@@ -65346,11 +65798,11 @@ function installService(deps) {
|
|
|
65346
65798
|
deps.log(resolved.reason);
|
|
65347
65799
|
return { ok: false };
|
|
65348
65800
|
}
|
|
65349
|
-
const home = deps.env.HOME ??
|
|
65801
|
+
const home = deps.env.HOME ?? import_node_os15.default.homedir();
|
|
65350
65802
|
const user = resolveBridgeUser({
|
|
65351
65803
|
env: deps.env,
|
|
65352
65804
|
home,
|
|
65353
|
-
userInfo: deps.userInfo ?? (() =>
|
|
65805
|
+
userInfo: deps.userInfo ?? (() => import_node_os15.default.userInfo()),
|
|
65354
65806
|
homeOwnerUid: deps.homeOwnerUid ?? defaultHomeOwnerUid,
|
|
65355
65807
|
log: deps.log
|
|
65356
65808
|
});
|
|
@@ -65366,7 +65818,7 @@ function installService(deps) {
|
|
|
65366
65818
|
const claudeBin = deps.which("claude");
|
|
65367
65819
|
const resolvedBins = [...bins, claudeBin].filter((b) => b !== null);
|
|
65368
65820
|
const pathEnv = Array.from(
|
|
65369
|
-
/* @__PURE__ */ new Set([...resolvedBins.map((b) =>
|
|
65821
|
+
/* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path32.default.dirname(b)), ...SYSTEM_PATH_DIRS])
|
|
65370
65822
|
).join(":");
|
|
65371
65823
|
const apiBaseUrl = deps.env.MRRLIN_API_BASE_URL?.trim() || void 0;
|
|
65372
65824
|
const staging = deps.env.MRRLIN_STAGING === "1" || !apiBaseUrl && bridgeUrlImpliesStaging(deps.env.MRRLIN_BRIDGE_URL);
|
|
@@ -65379,7 +65831,7 @@ function installService(deps) {
|
|
|
65379
65831
|
staging,
|
|
65380
65832
|
apiBaseUrl
|
|
65381
65833
|
});
|
|
65382
|
-
const ecoPath =
|
|
65834
|
+
const ecoPath = import_node_path32.default.join(home, ".mrrlin", "ecosystem.config.cjs");
|
|
65383
65835
|
deps.writeFile(ecoPath, text);
|
|
65384
65836
|
const start = deps.runPm2(["startOrReload", ecoPath]);
|
|
65385
65837
|
if (start.code !== 0) {
|
|
@@ -65431,13 +65883,13 @@ function uninstallService(deps) {
|
|
|
65431
65883
|
|
|
65432
65884
|
// src/uninstall-codex.ts
|
|
65433
65885
|
var import_promises11 = __toESM(require("node:fs/promises"), 1);
|
|
65434
|
-
var
|
|
65435
|
-
var
|
|
65886
|
+
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
65887
|
+
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
65436
65888
|
var toml3 = __toESM(require_toml(), 1);
|
|
65437
65889
|
function resolveCodexHome3(options) {
|
|
65438
65890
|
if (options.codexHome) return options.codexHome;
|
|
65439
65891
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
65440
|
-
return
|
|
65892
|
+
return import_node_path33.default.join(options.homeDir ?? import_node_os16.default.homedir(), ".codex");
|
|
65441
65893
|
}
|
|
65442
65894
|
async function pathExists4(target) {
|
|
65443
65895
|
try {
|
|
@@ -65450,7 +65902,7 @@ async function pathExists4(target) {
|
|
|
65450
65902
|
var MRRLIN_BLOCK_RE = /(^|\n)\[mcp_servers\.(?:mrrlin(?:-browser)?|external-agents)(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
|
|
65451
65903
|
async function uninstallCodex(options = {}) {
|
|
65452
65904
|
const codexHome = resolveCodexHome3(options);
|
|
65453
|
-
const configPath =
|
|
65905
|
+
const configPath = import_node_path33.default.join(codexHome, "config.toml");
|
|
65454
65906
|
const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
|
|
65455
65907
|
if (!await pathExists4(configPath)) {
|
|
65456
65908
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
@@ -65478,10 +65930,10 @@ async function uninstallCodex(options = {}) {
|
|
|
65478
65930
|
}
|
|
65479
65931
|
async function uninstallPrompts(codexHome, names) {
|
|
65480
65932
|
if (names.length === 0) return [];
|
|
65481
|
-
const promptsDir =
|
|
65933
|
+
const promptsDir = import_node_path33.default.join(codexHome, "prompts");
|
|
65482
65934
|
const out = [];
|
|
65483
65935
|
for (const name of names) {
|
|
65484
|
-
const promptPath =
|
|
65936
|
+
const promptPath = import_node_path33.default.join(promptsDir, `${name}.md`);
|
|
65485
65937
|
try {
|
|
65486
65938
|
await import_promises11.default.unlink(promptPath);
|
|
65487
65939
|
out.push({ name, action: "removed", promptPath });
|
|
@@ -65499,7 +65951,7 @@ async function uninstallPrompts(codexHome, names) {
|
|
|
65499
65951
|
|
|
65500
65952
|
// src/extract/command.ts
|
|
65501
65953
|
var import_promises12 = require("node:fs/promises");
|
|
65502
|
-
var
|
|
65954
|
+
var import_node_path34 = require("node:path");
|
|
65503
65955
|
function parseArgs(args) {
|
|
65504
65956
|
const map2 = /* @__PURE__ */ new Map();
|
|
65505
65957
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -65515,7 +65967,7 @@ function parseArgs(args) {
|
|
|
65515
65967
|
}
|
|
65516
65968
|
return map2;
|
|
65517
65969
|
}
|
|
65518
|
-
function
|
|
65970
|
+
function isRecord6(v) {
|
|
65519
65971
|
return v !== null && typeof v === "object";
|
|
65520
65972
|
}
|
|
65521
65973
|
async function runExtract(args, deps) {
|
|
@@ -65536,7 +65988,7 @@ Missing required flag(s): ${missing.join(
|
|
|
65536
65988
|
const days = await findSessionDays(deps.stateDir, sessionId);
|
|
65537
65989
|
const matchingLines = [];
|
|
65538
65990
|
for (const day of days) {
|
|
65539
|
-
const logPath = (0,
|
|
65991
|
+
const logPath = (0, import_node_path34.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
|
|
65540
65992
|
let raw;
|
|
65541
65993
|
try {
|
|
65542
65994
|
raw = await (0, import_promises12.readFile)(logPath, "utf8");
|
|
@@ -65552,8 +66004,8 @@ Missing required flag(s): ${missing.join(
|
|
|
65552
66004
|
} catch {
|
|
65553
66005
|
continue;
|
|
65554
66006
|
}
|
|
65555
|
-
const payload =
|
|
65556
|
-
if (
|
|
66007
|
+
const payload = isRecord6(parsed) ? parsed.payload : void 0;
|
|
66008
|
+
if (isRecord6(payload) && payload.directorSessionId === sessionId) {
|
|
65557
66009
|
matchingLines.push(line);
|
|
65558
66010
|
}
|
|
65559
66011
|
}
|
|
@@ -65636,11 +66088,11 @@ function bootHookStatus() {
|
|
|
65636
66088
|
if (process.platform !== "darwin") return { status: "unknown" };
|
|
65637
66089
|
const uid = process.getuid?.();
|
|
65638
66090
|
if (uid === void 0 || uid === 0) return { status: "unknown" };
|
|
65639
|
-
const home = process.env.HOME ?? (0,
|
|
65640
|
-
const agents =
|
|
66091
|
+
const home = process.env.HOME ?? (0, import_node_os17.homedir)();
|
|
66092
|
+
const agents = import_node_path36.default.join(home, "Library", "LaunchAgents");
|
|
65641
66093
|
const candidates = [
|
|
65642
|
-
{ label: "com.mrrlin.director-bridge", plist:
|
|
65643
|
-
{ label: "com.PM2", plist:
|
|
66094
|
+
{ label: "com.mrrlin.director-bridge", plist: import_node_path36.default.join(agents, "com.mrrlin.director-bridge.plist") },
|
|
66095
|
+
{ label: "com.PM2", plist: import_node_path36.default.join(agents, `pm2.${(0, import_node_os17.userInfo)().username}.plist`) }
|
|
65644
66096
|
];
|
|
65645
66097
|
for (const candidate of candidates) {
|
|
65646
66098
|
const printed = (0, import_node_child_process18.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
@@ -65928,8 +66380,8 @@ async function main() {
|
|
|
65928
66380
|
}
|
|
65929
66381
|
}
|
|
65930
66382
|
try {
|
|
65931
|
-
const codexHome = process.env.CODEX_HOME ??
|
|
65932
|
-
(0, import_node_fs22.rmSync)(
|
|
66383
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path36.default.join(process.env.HOME ?? (0, import_node_os17.homedir)(), ".codex");
|
|
66384
|
+
(0, import_node_fs22.rmSync)(import_node_path36.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
65933
66385
|
} catch {
|
|
65934
66386
|
}
|
|
65935
66387
|
const claudeResult = await installClaude({ binPath, force, serveEnv });
|
|
@@ -65990,7 +66442,7 @@ async function main() {
|
|
|
65990
66442
|
env: process.env,
|
|
65991
66443
|
cwd: process.cwd(),
|
|
65992
66444
|
writeFile: (p, c) => {
|
|
65993
|
-
(0, import_node_fs22.mkdirSync)(
|
|
66445
|
+
(0, import_node_fs22.mkdirSync)(import_node_path36.default.dirname(p), { recursive: true, mode: 448 });
|
|
65994
66446
|
(0, import_node_fs22.writeFileSync)(p, c, { mode: 384 });
|
|
65995
66447
|
},
|
|
65996
66448
|
runPm2: pm2Runner,
|
|
@@ -66016,14 +66468,14 @@ async function main() {
|
|
|
66016
66468
|
purgeSecret: purge,
|
|
66017
66469
|
secretPath: agentCredentialPath(),
|
|
66018
66470
|
tokenPath: operatorTokenPath(),
|
|
66019
|
-
ecoPath:
|
|
66471
|
+
ecoPath: import_node_path36.default.join(process.env.HOME ?? (0, import_node_os17.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
66020
66472
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
66021
66473
|
`)
|
|
66022
66474
|
});
|
|
66023
66475
|
return;
|
|
66024
66476
|
}
|
|
66025
66477
|
case "uninstall": {
|
|
66026
|
-
const home = process.env.HOME ?? (0,
|
|
66478
|
+
const home = process.env.HOME ?? (0, import_node_os17.homedir)();
|
|
66027
66479
|
const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
|
|
66028
66480
|
`);
|
|
66029
66481
|
uninstallService({
|
|
@@ -66037,7 +66489,7 @@ async function main() {
|
|
|
66037
66489
|
purgeSecret: true,
|
|
66038
66490
|
secretPath: agentCredentialPath(),
|
|
66039
66491
|
tokenPath: operatorTokenPath(),
|
|
66040
|
-
ecoPath:
|
|
66492
|
+
ecoPath: import_node_path36.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
|
|
66041
66493
|
log
|
|
66042
66494
|
});
|
|
66043
66495
|
let codexOk = true;
|
|
@@ -66057,7 +66509,7 @@ async function main() {
|
|
|
66057
66509
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
66058
66510
|
}
|
|
66059
66511
|
try {
|
|
66060
|
-
(0, import_node_fs22.rmSync)(
|
|
66512
|
+
(0, import_node_fs22.rmSync)(import_node_path36.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
66061
66513
|
} catch {
|
|
66062
66514
|
}
|
|
66063
66515
|
log("removed ~/.mrrlin");
|
|
@@ -66098,7 +66550,7 @@ ${HELP_TEXT}`);
|
|
|
66098
66550
|
}
|
|
66099
66551
|
}
|
|
66100
66552
|
function resolveSelfBinPath() {
|
|
66101
|
-
return
|
|
66553
|
+
return import_node_path35.default.resolve(process.argv[1] ?? process.execPath);
|
|
66102
66554
|
}
|
|
66103
66555
|
main().catch((error51) => {
|
|
66104
66556
|
process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}
|