@mrrlin-dev/mcp 0.4.214 → 0.4.216
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 +656 -335
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -2406,11 +2406,11 @@ var require_codegen = __commonJS({
|
|
|
2406
2406
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
2407
2407
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
2408
2408
|
}
|
|
2409
|
-
optimizeNames(names,
|
|
2409
|
+
optimizeNames(names, constants3) {
|
|
2410
2410
|
if (!names[this.name.str])
|
|
2411
2411
|
return;
|
|
2412
2412
|
if (this.rhs)
|
|
2413
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
2413
|
+
this.rhs = optimizeExpr(this.rhs, names, constants3);
|
|
2414
2414
|
return this;
|
|
2415
2415
|
}
|
|
2416
2416
|
get names() {
|
|
@@ -2427,10 +2427,10 @@ var require_codegen = __commonJS({
|
|
|
2427
2427
|
render({ _n }) {
|
|
2428
2428
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
2429
2429
|
}
|
|
2430
|
-
optimizeNames(names,
|
|
2430
|
+
optimizeNames(names, constants3) {
|
|
2431
2431
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
2432
2432
|
return;
|
|
2433
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
2433
|
+
this.rhs = optimizeExpr(this.rhs, names, constants3);
|
|
2434
2434
|
return this;
|
|
2435
2435
|
}
|
|
2436
2436
|
get names() {
|
|
@@ -2491,8 +2491,8 @@ var require_codegen = __commonJS({
|
|
|
2491
2491
|
optimizeNodes() {
|
|
2492
2492
|
return `${this.code}` ? this : void 0;
|
|
2493
2493
|
}
|
|
2494
|
-
optimizeNames(names,
|
|
2495
|
-
this.code = optimizeExpr(this.code, names,
|
|
2494
|
+
optimizeNames(names, constants3) {
|
|
2495
|
+
this.code = optimizeExpr(this.code, names, constants3);
|
|
2496
2496
|
return this;
|
|
2497
2497
|
}
|
|
2498
2498
|
get names() {
|
|
@@ -2521,12 +2521,12 @@ var require_codegen = __commonJS({
|
|
|
2521
2521
|
}
|
|
2522
2522
|
return nodes.length > 0 ? this : void 0;
|
|
2523
2523
|
}
|
|
2524
|
-
optimizeNames(names,
|
|
2524
|
+
optimizeNames(names, constants3) {
|
|
2525
2525
|
const { nodes } = this;
|
|
2526
2526
|
let i = nodes.length;
|
|
2527
2527
|
while (i--) {
|
|
2528
2528
|
const n = nodes[i];
|
|
2529
|
-
if (n.optimizeNames(names,
|
|
2529
|
+
if (n.optimizeNames(names, constants3))
|
|
2530
2530
|
continue;
|
|
2531
2531
|
subtractNames(names, n.names);
|
|
2532
2532
|
nodes.splice(i, 1);
|
|
@@ -2579,12 +2579,12 @@ var require_codegen = __commonJS({
|
|
|
2579
2579
|
return void 0;
|
|
2580
2580
|
return this;
|
|
2581
2581
|
}
|
|
2582
|
-
optimizeNames(names,
|
|
2582
|
+
optimizeNames(names, constants3) {
|
|
2583
2583
|
var _a3;
|
|
2584
|
-
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
2585
|
-
if (!(super.optimizeNames(names,
|
|
2584
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
|
|
2585
|
+
if (!(super.optimizeNames(names, constants3) || this.else))
|
|
2586
2586
|
return;
|
|
2587
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
2587
|
+
this.condition = optimizeExpr(this.condition, names, constants3);
|
|
2588
2588
|
return this;
|
|
2589
2589
|
}
|
|
2590
2590
|
get names() {
|
|
@@ -2607,10 +2607,10 @@ var require_codegen = __commonJS({
|
|
|
2607
2607
|
render(opts) {
|
|
2608
2608
|
return `for(${this.iteration})` + super.render(opts);
|
|
2609
2609
|
}
|
|
2610
|
-
optimizeNames(names,
|
|
2611
|
-
if (!super.optimizeNames(names,
|
|
2610
|
+
optimizeNames(names, constants3) {
|
|
2611
|
+
if (!super.optimizeNames(names, constants3))
|
|
2612
2612
|
return;
|
|
2613
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
2613
|
+
this.iteration = optimizeExpr(this.iteration, names, constants3);
|
|
2614
2614
|
return this;
|
|
2615
2615
|
}
|
|
2616
2616
|
get names() {
|
|
@@ -2646,10 +2646,10 @@ var require_codegen = __commonJS({
|
|
|
2646
2646
|
render(opts) {
|
|
2647
2647
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
2648
2648
|
}
|
|
2649
|
-
optimizeNames(names,
|
|
2650
|
-
if (!super.optimizeNames(names,
|
|
2649
|
+
optimizeNames(names, constants3) {
|
|
2650
|
+
if (!super.optimizeNames(names, constants3))
|
|
2651
2651
|
return;
|
|
2652
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
2652
|
+
this.iterable = optimizeExpr(this.iterable, names, constants3);
|
|
2653
2653
|
return this;
|
|
2654
2654
|
}
|
|
2655
2655
|
get names() {
|
|
@@ -2691,11 +2691,11 @@ var require_codegen = __commonJS({
|
|
|
2691
2691
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
2692
2692
|
return this;
|
|
2693
2693
|
}
|
|
2694
|
-
optimizeNames(names,
|
|
2694
|
+
optimizeNames(names, constants3) {
|
|
2695
2695
|
var _a3, _b;
|
|
2696
|
-
super.optimizeNames(names,
|
|
2697
|
-
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names,
|
|
2698
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
2696
|
+
super.optimizeNames(names, constants3);
|
|
2697
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
|
|
2698
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants3);
|
|
2699
2699
|
return this;
|
|
2700
2700
|
}
|
|
2701
2701
|
get names() {
|
|
@@ -2996,7 +2996,7 @@ var require_codegen = __commonJS({
|
|
|
2996
2996
|
function addExprNames(names, from) {
|
|
2997
2997
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
2998
2998
|
}
|
|
2999
|
-
function optimizeExpr(expr, names,
|
|
2999
|
+
function optimizeExpr(expr, names, constants3) {
|
|
3000
3000
|
if (expr instanceof code_1.Name)
|
|
3001
3001
|
return replaceName(expr);
|
|
3002
3002
|
if (!canOptimize(expr))
|
|
@@ -3011,14 +3011,14 @@ var require_codegen = __commonJS({
|
|
|
3011
3011
|
return items;
|
|
3012
3012
|
}, []));
|
|
3013
3013
|
function replaceName(n) {
|
|
3014
|
-
const c =
|
|
3014
|
+
const c = constants3[n.str];
|
|
3015
3015
|
if (c === void 0 || names[n.str] !== 1)
|
|
3016
3016
|
return n;
|
|
3017
3017
|
delete names[n.str];
|
|
3018
3018
|
return c;
|
|
3019
3019
|
}
|
|
3020
3020
|
function canOptimize(e) {
|
|
3021
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
3021
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants3[c.str] !== void 0);
|
|
3022
3022
|
}
|
|
3023
3023
|
}
|
|
3024
3024
|
function subtractNames(names, from) {
|
|
@@ -9799,7 +9799,7 @@ var require_cross_spawn = __commonJS({
|
|
|
9799
9799
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
9800
9800
|
var require_polyfills = __commonJS({
|
|
9801
9801
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
|
9802
|
-
var
|
|
9802
|
+
var constants3 = require("constants");
|
|
9803
9803
|
var origCwd = process.cwd;
|
|
9804
9804
|
var cwd = null;
|
|
9805
9805
|
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
@@ -9823,7 +9823,7 @@ var require_polyfills = __commonJS({
|
|
|
9823
9823
|
var chdir;
|
|
9824
9824
|
module2.exports = patch;
|
|
9825
9825
|
function patch(fs18) {
|
|
9826
|
-
if (
|
|
9826
|
+
if (constants3.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
9827
9827
|
patchLchmod(fs18);
|
|
9828
9828
|
}
|
|
9829
9829
|
if (!fs18.lutimes) {
|
|
@@ -9925,7 +9925,7 @@ var require_polyfills = __commonJS({
|
|
|
9925
9925
|
fs19.lchmod = function(path40, mode, callback) {
|
|
9926
9926
|
fs19.open(
|
|
9927
9927
|
path40,
|
|
9928
|
-
|
|
9928
|
+
constants3.O_WRONLY | constants3.O_SYMLINK,
|
|
9929
9929
|
mode,
|
|
9930
9930
|
function(err, fd) {
|
|
9931
9931
|
if (err) {
|
|
@@ -9941,7 +9941,7 @@ var require_polyfills = __commonJS({
|
|
|
9941
9941
|
);
|
|
9942
9942
|
};
|
|
9943
9943
|
fs19.lchmodSync = function(path40, mode) {
|
|
9944
|
-
var fd = fs19.openSync(path40,
|
|
9944
|
+
var fd = fs19.openSync(path40, constants3.O_WRONLY | constants3.O_SYMLINK, mode);
|
|
9945
9945
|
var threw = true;
|
|
9946
9946
|
var ret;
|
|
9947
9947
|
try {
|
|
@@ -9961,9 +9961,9 @@ var require_polyfills = __commonJS({
|
|
|
9961
9961
|
};
|
|
9962
9962
|
}
|
|
9963
9963
|
function patchLutimes(fs19) {
|
|
9964
|
-
if (
|
|
9964
|
+
if (constants3.hasOwnProperty("O_SYMLINK") && fs19.futimes) {
|
|
9965
9965
|
fs19.lutimes = function(path40, at, mt, cb) {
|
|
9966
|
-
fs19.open(path40,
|
|
9966
|
+
fs19.open(path40, constants3.O_SYMLINK, function(er, fd) {
|
|
9967
9967
|
if (er) {
|
|
9968
9968
|
if (cb) cb(er);
|
|
9969
9969
|
return;
|
|
@@ -9976,7 +9976,7 @@ var require_polyfills = __commonJS({
|
|
|
9976
9976
|
});
|
|
9977
9977
|
};
|
|
9978
9978
|
fs19.lutimesSync = function(path40, at, mt) {
|
|
9979
|
-
var fd = fs19.openSync(path40,
|
|
9979
|
+
var fd = fs19.openSync(path40, constants3.O_SYMLINK);
|
|
9980
9980
|
var ret;
|
|
9981
9981
|
var threw = true;
|
|
9982
9982
|
try {
|
|
@@ -10465,7 +10465,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10465
10465
|
}
|
|
10466
10466
|
function ReadStream$open() {
|
|
10467
10467
|
var that = this;
|
|
10468
|
-
|
|
10468
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
10469
10469
|
if (err) {
|
|
10470
10470
|
if (that.autoClose)
|
|
10471
10471
|
that.destroy();
|
|
@@ -10485,7 +10485,7 @@ var require_graceful_fs = __commonJS({
|
|
|
10485
10485
|
}
|
|
10486
10486
|
function WriteStream$open() {
|
|
10487
10487
|
var that = this;
|
|
10488
|
-
|
|
10488
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
10489
10489
|
if (err) {
|
|
10490
10490
|
that.destroy();
|
|
10491
10491
|
that.emit("error", err);
|
|
@@ -10502,8 +10502,8 @@ var require_graceful_fs = __commonJS({
|
|
|
10502
10502
|
return new fs19.WriteStream(path40, options);
|
|
10503
10503
|
}
|
|
10504
10504
|
var fs$open = fs19.open;
|
|
10505
|
-
fs19.open =
|
|
10506
|
-
function
|
|
10505
|
+
fs19.open = open2;
|
|
10506
|
+
function open2(path40, flags, mode, cb) {
|
|
10507
10507
|
if (typeof mode === "function")
|
|
10508
10508
|
cb = mode, mode = null;
|
|
10509
10509
|
return go$open(path40, flags, mode, cb);
|
|
@@ -12210,10 +12210,10 @@ var require_truncate = __commonJS({
|
|
|
12210
12210
|
"../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/truncate.js"(exports2, module2) {
|
|
12211
12211
|
"use strict";
|
|
12212
12212
|
var parse9 = require_parse3();
|
|
12213
|
-
var
|
|
12213
|
+
var constants3 = require_constants();
|
|
12214
12214
|
var SemVer = require_semver();
|
|
12215
12215
|
var truncate3 = (version2, truncation, options) => {
|
|
12216
|
-
if (!
|
|
12216
|
+
if (!constants3.RELEASE_TYPES.includes(truncation)) {
|
|
12217
12217
|
return null;
|
|
12218
12218
|
}
|
|
12219
12219
|
const clonedVersion = cloneInputVersion(version2, options);
|
|
@@ -13254,7 +13254,7 @@ var require_semver2 = __commonJS({
|
|
|
13254
13254
|
"../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/index.js"(exports2, module2) {
|
|
13255
13255
|
"use strict";
|
|
13256
13256
|
var internalRe = require_re();
|
|
13257
|
-
var
|
|
13257
|
+
var constants3 = require_constants();
|
|
13258
13258
|
var SemVer = require_semver();
|
|
13259
13259
|
var identifiers = require_identifiers();
|
|
13260
13260
|
var parse9 = require_parse3();
|
|
@@ -13338,8 +13338,8 @@ var require_semver2 = __commonJS({
|
|
|
13338
13338
|
re: internalRe.re,
|
|
13339
13339
|
src: internalRe.src,
|
|
13340
13340
|
tokens: internalRe.t,
|
|
13341
|
-
SEMVER_SPEC_VERSION:
|
|
13342
|
-
RELEASE_TYPES:
|
|
13341
|
+
SEMVER_SPEC_VERSION: constants3.SEMVER_SPEC_VERSION,
|
|
13342
|
+
RELEASE_TYPES: constants3.RELEASE_TYPES,
|
|
13343
13343
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
13344
13344
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
13345
13345
|
};
|
|
@@ -14706,7 +14706,7 @@ var require_util2 = __commonJS({
|
|
|
14706
14706
|
function isFormDataLike(object3) {
|
|
14707
14707
|
return object3 && typeof object3 === "object" && typeof object3.append === "function" && typeof object3.delete === "function" && typeof object3.get === "function" && typeof object3.getAll === "function" && typeof object3.has === "function" && typeof object3.set === "function" && object3[Symbol.toStringTag] === "FormData";
|
|
14708
14708
|
}
|
|
14709
|
-
function
|
|
14709
|
+
function addAbortListener7(signal, listener) {
|
|
14710
14710
|
if ("addEventListener" in signal) {
|
|
14711
14711
|
signal.addEventListener("abort", listener, { once: true });
|
|
14712
14712
|
return () => signal.removeEventListener("abort", listener);
|
|
@@ -15151,7 +15151,7 @@ var require_util2 = __commonJS({
|
|
|
15151
15151
|
isFormDataLike,
|
|
15152
15152
|
pathHasQueryOrFragment,
|
|
15153
15153
|
serializePathWithQuery,
|
|
15154
|
-
addAbortListener:
|
|
15154
|
+
addAbortListener: addAbortListener7,
|
|
15155
15155
|
isValidHTTPToken,
|
|
15156
15156
|
isValidHeaderValue,
|
|
15157
15157
|
isTokenCharCode,
|
|
@@ -19990,7 +19990,7 @@ var require_client_h1 = __commonJS({
|
|
|
19990
19990
|
kHTTPContext,
|
|
19991
19991
|
kClosed
|
|
19992
19992
|
} = require_symbols();
|
|
19993
|
-
var
|
|
19993
|
+
var constants3 = require_constants3();
|
|
19994
19994
|
var EMPTY_BUF = Buffer.alloc(0);
|
|
19995
19995
|
var FastBuffer = Buffer[Symbol.species];
|
|
19996
19996
|
var removeAllListeners = util.removeAllListeners;
|
|
@@ -20126,7 +20126,7 @@ var require_client_h1 = __commonJS({
|
|
|
20126
20126
|
*/
|
|
20127
20127
|
constructor(client, socket, { exports: exports3 }) {
|
|
20128
20128
|
this.llhttp = exports3;
|
|
20129
|
-
this.ptr = this.llhttp.llhttp_alloc(
|
|
20129
|
+
this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
|
|
20130
20130
|
this.client = client;
|
|
20131
20131
|
this.socket = socket;
|
|
20132
20132
|
this.timeout = null;
|
|
@@ -20222,11 +20222,11 @@ var require_client_h1 = __commonJS({
|
|
|
20222
20222
|
currentParser = null;
|
|
20223
20223
|
currentBufferRef = null;
|
|
20224
20224
|
}
|
|
20225
|
-
if (ret !==
|
|
20225
|
+
if (ret !== constants3.ERROR.OK) {
|
|
20226
20226
|
const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
|
|
20227
|
-
if (ret ===
|
|
20227
|
+
if (ret === constants3.ERROR.PAUSED_UPGRADE) {
|
|
20228
20228
|
this.onUpgrade(data);
|
|
20229
|
-
} else if (ret ===
|
|
20229
|
+
} else if (ret === constants3.ERROR.PAUSED) {
|
|
20230
20230
|
this.paused = true;
|
|
20231
20231
|
socket.unshift(data);
|
|
20232
20232
|
} else {
|
|
@@ -20249,10 +20249,10 @@ var require_client_h1 = __commonJS({
|
|
|
20249
20249
|
} finally {
|
|
20250
20250
|
currentParser = null;
|
|
20251
20251
|
}
|
|
20252
|
-
if (ret ===
|
|
20252
|
+
if (ret === constants3.ERROR.OK) {
|
|
20253
20253
|
return null;
|
|
20254
20254
|
}
|
|
20255
|
-
if (ret ===
|
|
20255
|
+
if (ret === constants3.ERROR.PAUSED || ret === constants3.ERROR.PAUSED_UPGRADE) {
|
|
20256
20256
|
this.paused = true;
|
|
20257
20257
|
return null;
|
|
20258
20258
|
}
|
|
@@ -20269,7 +20269,7 @@ var require_client_h1 = __commonJS({
|
|
|
20269
20269
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
20270
20270
|
message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
20271
20271
|
}
|
|
20272
|
-
return new HTTPParserError(message,
|
|
20272
|
+
return new HTTPParserError(message, constants3.ERROR[ret], data);
|
|
20273
20273
|
}
|
|
20274
20274
|
destroy() {
|
|
20275
20275
|
assert2(currentParser === null);
|
|
@@ -20480,7 +20480,7 @@ var require_client_h1 = __commonJS({
|
|
|
20480
20480
|
socket[kBlocking] = false;
|
|
20481
20481
|
client[kResume]();
|
|
20482
20482
|
}
|
|
20483
|
-
return pause ?
|
|
20483
|
+
return pause ? constants3.ERROR.PAUSED : 0;
|
|
20484
20484
|
}
|
|
20485
20485
|
/**
|
|
20486
20486
|
* @param {Buffer} buf
|
|
@@ -20506,7 +20506,7 @@ var require_client_h1 = __commonJS({
|
|
|
20506
20506
|
}
|
|
20507
20507
|
this.bytesRead += buf.length;
|
|
20508
20508
|
if (request.onData(buf) === false) {
|
|
20509
|
-
return
|
|
20509
|
+
return constants3.ERROR.PAUSED;
|
|
20510
20510
|
}
|
|
20511
20511
|
return 0;
|
|
20512
20512
|
}
|
|
@@ -20546,13 +20546,13 @@ var require_client_h1 = __commonJS({
|
|
|
20546
20546
|
if (socket[kWriting]) {
|
|
20547
20547
|
assert2(client[kRunning] === 0);
|
|
20548
20548
|
util.destroy(socket, new InformationalError("reset"));
|
|
20549
|
-
return
|
|
20549
|
+
return constants3.ERROR.PAUSED;
|
|
20550
20550
|
} else if (!shouldKeepAlive) {
|
|
20551
20551
|
util.destroy(socket, new InformationalError("reset"));
|
|
20552
|
-
return
|
|
20552
|
+
return constants3.ERROR.PAUSED;
|
|
20553
20553
|
} else if (socket[kReset] && client[kRunning] === 0) {
|
|
20554
20554
|
util.destroy(socket, new InformationalError("reset"));
|
|
20555
|
-
return
|
|
20555
|
+
return constants3.ERROR.PAUSED;
|
|
20556
20556
|
} else if (client[kPipelining] == null || client[kPipelining] === 1) {
|
|
20557
20557
|
setImmediate(client[kResume]);
|
|
20558
20558
|
} else {
|
|
@@ -25420,7 +25420,7 @@ var require_api_request = __commonJS({
|
|
|
25420
25420
|
var require_abort_signal = __commonJS({
|
|
25421
25421
|
"../../node_modules/.pnpm/undici@7.30.2/node_modules/undici/lib/api/abort-signal.js"(exports2, module2) {
|
|
25422
25422
|
"use strict";
|
|
25423
|
-
var { addAbortListener:
|
|
25423
|
+
var { addAbortListener: addAbortListener7 } = require_util2();
|
|
25424
25424
|
var { RequestAbortedError } = require_errors2();
|
|
25425
25425
|
var kListener = Symbol("kListener");
|
|
25426
25426
|
var kSignal = Symbol("kSignal");
|
|
@@ -25447,7 +25447,7 @@ var require_abort_signal = __commonJS({
|
|
|
25447
25447
|
self[kListener] = () => {
|
|
25448
25448
|
abort(self);
|
|
25449
25449
|
};
|
|
25450
|
-
|
|
25450
|
+
addAbortListener7(self[kSignal], self[kListener]);
|
|
25451
25451
|
}
|
|
25452
25452
|
function removeSignal(self) {
|
|
25453
25453
|
if (!self[kSignal]) {
|
|
@@ -34581,7 +34581,7 @@ var require_fetch = __commonJS({
|
|
|
34581
34581
|
} = require_constants4();
|
|
34582
34582
|
var EE = require("node:events");
|
|
34583
34583
|
var { Readable: Readable2, pipeline, finished, isErrored, isReadable } = require("node:stream");
|
|
34584
|
-
var { addAbortListener:
|
|
34584
|
+
var { addAbortListener: addAbortListener7, bufferToLowerCasedHeaderName } = require_util2();
|
|
34585
34585
|
var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
|
|
34586
34586
|
var { getGlobalDispatcher } = require_global2();
|
|
34587
34587
|
var { webidl } = require_webidl();
|
|
@@ -34649,7 +34649,7 @@ var require_fetch = __commonJS({
|
|
|
34649
34649
|
let responseObject = null;
|
|
34650
34650
|
let locallyAborted = false;
|
|
34651
34651
|
let controller = null;
|
|
34652
|
-
|
|
34652
|
+
addAbortListener7(
|
|
34653
34653
|
requestObject.signal,
|
|
34654
34654
|
() => {
|
|
34655
34655
|
locallyAborted = true;
|
|
@@ -43176,7 +43176,7 @@ var require_stream = __commonJS({
|
|
|
43176
43176
|
};
|
|
43177
43177
|
duplex._final = function(callback) {
|
|
43178
43178
|
if (ws.readyState === ws.CONNECTING) {
|
|
43179
|
-
ws.once("open", function
|
|
43179
|
+
ws.once("open", function open2() {
|
|
43180
43180
|
duplex._final(callback);
|
|
43181
43181
|
});
|
|
43182
43182
|
return;
|
|
@@ -43197,7 +43197,7 @@ var require_stream = __commonJS({
|
|
|
43197
43197
|
};
|
|
43198
43198
|
duplex._write = function(chunk, encoding, callback) {
|
|
43199
43199
|
if (ws.readyState === ws.CONNECTING) {
|
|
43200
|
-
ws.once("open", function
|
|
43200
|
+
ws.once("open", function open2() {
|
|
43201
43201
|
duplex._write(chunk, encoding, callback);
|
|
43202
43202
|
});
|
|
43203
43203
|
return;
|
|
@@ -45207,11 +45207,11 @@ var require_dijkstra = __commonJS({
|
|
|
45207
45207
|
var predecessors = {};
|
|
45208
45208
|
var costs = {};
|
|
45209
45209
|
costs[s] = 0;
|
|
45210
|
-
var
|
|
45211
|
-
|
|
45210
|
+
var open2 = dijkstra.PriorityQueue.make();
|
|
45211
|
+
open2.push(s, 0);
|
|
45212
45212
|
var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
|
|
45213
|
-
while (!
|
|
45214
|
-
closest =
|
|
45213
|
+
while (!open2.empty()) {
|
|
45214
|
+
closest = open2.pop();
|
|
45215
45215
|
u = closest.value;
|
|
45216
45216
|
cost_of_s_to_u = closest.cost;
|
|
45217
45217
|
adjacent_nodes = graph[u] || {};
|
|
@@ -45223,7 +45223,7 @@ var require_dijkstra = __commonJS({
|
|
|
45223
45223
|
first_visit = typeof costs[v] === "undefined";
|
|
45224
45224
|
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
45225
45225
|
costs[v] = cost_of_s_to_u_plus_cost_of_e;
|
|
45226
|
-
|
|
45226
|
+
open2.push(v, cost_of_s_to_u_plus_cost_of_e);
|
|
45227
45227
|
predecessors[v] = u;
|
|
45228
45228
|
}
|
|
45229
45229
|
}
|
|
@@ -46233,7 +46233,7 @@ var require_crc = __commonJS({
|
|
|
46233
46233
|
var require_parser2 = __commonJS({
|
|
46234
46234
|
"../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"(exports2, module2) {
|
|
46235
46235
|
"use strict";
|
|
46236
|
-
var
|
|
46236
|
+
var constants3 = require_constants8();
|
|
46237
46237
|
var CrcCalculator = require_crc();
|
|
46238
46238
|
var Parser = module2.exports = function(options, dependencies) {
|
|
46239
46239
|
this._options = options;
|
|
@@ -46244,12 +46244,12 @@ var require_parser2 = __commonJS({
|
|
|
46244
46244
|
this._palette = [];
|
|
46245
46245
|
this._colorType = 0;
|
|
46246
46246
|
this._chunks = {};
|
|
46247
|
-
this._chunks[
|
|
46248
|
-
this._chunks[
|
|
46249
|
-
this._chunks[
|
|
46250
|
-
this._chunks[
|
|
46251
|
-
this._chunks[
|
|
46252
|
-
this._chunks[
|
|
46247
|
+
this._chunks[constants3.TYPE_IHDR] = this._handleIHDR.bind(this);
|
|
46248
|
+
this._chunks[constants3.TYPE_IEND] = this._handleIEND.bind(this);
|
|
46249
|
+
this._chunks[constants3.TYPE_IDAT] = this._handleIDAT.bind(this);
|
|
46250
|
+
this._chunks[constants3.TYPE_PLTE] = this._handlePLTE.bind(this);
|
|
46251
|
+
this._chunks[constants3.TYPE_tRNS] = this._handleTRNS.bind(this);
|
|
46252
|
+
this._chunks[constants3.TYPE_gAMA] = this._handleGAMA.bind(this);
|
|
46253
46253
|
this.read = dependencies.read;
|
|
46254
46254
|
this.error = dependencies.error;
|
|
46255
46255
|
this.metadata = dependencies.metadata;
|
|
@@ -46264,10 +46264,10 @@ var require_parser2 = __commonJS({
|
|
|
46264
46264
|
};
|
|
46265
46265
|
};
|
|
46266
46266
|
Parser.prototype.start = function() {
|
|
46267
|
-
this.read(
|
|
46267
|
+
this.read(constants3.PNG_SIGNATURE.length, this._parseSignature.bind(this));
|
|
46268
46268
|
};
|
|
46269
46269
|
Parser.prototype._parseSignature = function(data) {
|
|
46270
|
-
let signature =
|
|
46270
|
+
let signature = constants3.PNG_SIGNATURE;
|
|
46271
46271
|
for (let i = 0; i < signature.length; i++) {
|
|
46272
46272
|
if (data[i] !== signature[i]) {
|
|
46273
46273
|
this.error(new Error("Invalid file signature"));
|
|
@@ -46284,7 +46284,7 @@ var require_parser2 = __commonJS({
|
|
|
46284
46284
|
name += String.fromCharCode(data[i]);
|
|
46285
46285
|
}
|
|
46286
46286
|
let ancillary = Boolean(data[4] & 32);
|
|
46287
|
-
if (!this._hasIHDR && type !==
|
|
46287
|
+
if (!this._hasIHDR && type !== constants3.TYPE_IHDR) {
|
|
46288
46288
|
this.error(new Error("Expected IHDR on beggining"));
|
|
46289
46289
|
return;
|
|
46290
46290
|
}
|
|
@@ -46332,7 +46332,7 @@ var require_parser2 = __commonJS({
|
|
|
46332
46332
|
this.error(new Error("Unsupported bit depth " + depth));
|
|
46333
46333
|
return;
|
|
46334
46334
|
}
|
|
46335
|
-
if (!(colorType in
|
|
46335
|
+
if (!(colorType in constants3.COLORTYPE_TO_BPP_MAP)) {
|
|
46336
46336
|
this.error(new Error("Unsupported color type"));
|
|
46337
46337
|
return;
|
|
46338
46338
|
}
|
|
@@ -46349,16 +46349,16 @@ var require_parser2 = __commonJS({
|
|
|
46349
46349
|
return;
|
|
46350
46350
|
}
|
|
46351
46351
|
this._colorType = colorType;
|
|
46352
|
-
let bpp =
|
|
46352
|
+
let bpp = constants3.COLORTYPE_TO_BPP_MAP[this._colorType];
|
|
46353
46353
|
this._hasIHDR = true;
|
|
46354
46354
|
this.metadata({
|
|
46355
46355
|
width,
|
|
46356
46356
|
height,
|
|
46357
46357
|
depth,
|
|
46358
46358
|
interlace: Boolean(interlace),
|
|
46359
|
-
palette: Boolean(colorType &
|
|
46360
|
-
color: Boolean(colorType &
|
|
46361
|
-
alpha: Boolean(colorType &
|
|
46359
|
+
palette: Boolean(colorType & constants3.COLORTYPE_PALETTE),
|
|
46360
|
+
color: Boolean(colorType & constants3.COLORTYPE_COLOR),
|
|
46361
|
+
alpha: Boolean(colorType & constants3.COLORTYPE_ALPHA),
|
|
46362
46362
|
bpp,
|
|
46363
46363
|
colorType
|
|
46364
46364
|
});
|
|
@@ -46382,7 +46382,7 @@ var require_parser2 = __commonJS({
|
|
|
46382
46382
|
};
|
|
46383
46383
|
Parser.prototype._parseTRNS = function(data) {
|
|
46384
46384
|
this._crc.write(data);
|
|
46385
|
-
if (this._colorType ===
|
|
46385
|
+
if (this._colorType === constants3.COLORTYPE_PALETTE_COLOR) {
|
|
46386
46386
|
if (this._palette.length === 0) {
|
|
46387
46387
|
this.error(new Error("Transparency chunk must be after palette"));
|
|
46388
46388
|
return;
|
|
@@ -46396,10 +46396,10 @@ var require_parser2 = __commonJS({
|
|
|
46396
46396
|
}
|
|
46397
46397
|
this.palette(this._palette);
|
|
46398
46398
|
}
|
|
46399
|
-
if (this._colorType ===
|
|
46399
|
+
if (this._colorType === constants3.COLORTYPE_GRAYSCALE) {
|
|
46400
46400
|
this.transColor([data.readUInt16BE(0)]);
|
|
46401
46401
|
}
|
|
46402
|
-
if (this._colorType ===
|
|
46402
|
+
if (this._colorType === constants3.COLORTYPE_COLOR) {
|
|
46403
46403
|
this.transColor([
|
|
46404
46404
|
data.readUInt16BE(0),
|
|
46405
46405
|
data.readUInt16BE(2),
|
|
@@ -46413,7 +46413,7 @@ var require_parser2 = __commonJS({
|
|
|
46413
46413
|
};
|
|
46414
46414
|
Parser.prototype._parseGAMA = function(data) {
|
|
46415
46415
|
this._crc.write(data);
|
|
46416
|
-
this.gamma(data.readUInt32BE(0) /
|
|
46416
|
+
this.gamma(data.readUInt32BE(0) / constants3.GAMMA_DIVISION);
|
|
46417
46417
|
this._handleChunkEnd();
|
|
46418
46418
|
};
|
|
46419
46419
|
Parser.prototype._handleIDAT = function(length) {
|
|
@@ -46425,7 +46425,7 @@ var require_parser2 = __commonJS({
|
|
|
46425
46425
|
};
|
|
46426
46426
|
Parser.prototype._parseIDAT = function(length, data) {
|
|
46427
46427
|
this._crc.write(data);
|
|
46428
|
-
if (this._colorType ===
|
|
46428
|
+
if (this._colorType === constants3.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) {
|
|
46429
46429
|
throw new Error("Expected palette not found");
|
|
46430
46430
|
}
|
|
46431
46431
|
this.inflateData(data);
|
|
@@ -46909,9 +46909,9 @@ var require_parser_async = __commonJS({
|
|
|
46909
46909
|
var require_bitpacker = __commonJS({
|
|
46910
46910
|
"../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"(exports2, module2) {
|
|
46911
46911
|
"use strict";
|
|
46912
|
-
var
|
|
46912
|
+
var constants3 = require_constants8();
|
|
46913
46913
|
module2.exports = function(dataIn, width, height, options) {
|
|
46914
|
-
let outHasAlpha = [
|
|
46914
|
+
let outHasAlpha = [constants3.COLORTYPE_COLOR_ALPHA, constants3.COLORTYPE_ALPHA].indexOf(
|
|
46915
46915
|
options.colorType
|
|
46916
46916
|
) !== -1;
|
|
46917
46917
|
if (options.colorType === options.inputColorType) {
|
|
@@ -46931,11 +46931,11 @@ var require_bitpacker = __commonJS({
|
|
|
46931
46931
|
}
|
|
46932
46932
|
let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer);
|
|
46933
46933
|
let maxValue = 255;
|
|
46934
|
-
let inBpp =
|
|
46934
|
+
let inBpp = constants3.COLORTYPE_TO_BPP_MAP[options.inputColorType];
|
|
46935
46935
|
if (inBpp === 4 && !options.inputHasAlpha) {
|
|
46936
46936
|
inBpp = 3;
|
|
46937
46937
|
}
|
|
46938
|
-
let outBpp =
|
|
46938
|
+
let outBpp = constants3.COLORTYPE_TO_BPP_MAP[options.colorType];
|
|
46939
46939
|
if (options.bitDepth === 16) {
|
|
46940
46940
|
maxValue = 65535;
|
|
46941
46941
|
outBpp *= 2;
|
|
@@ -46959,24 +46959,24 @@ var require_bitpacker = __commonJS({
|
|
|
46959
46959
|
let blue;
|
|
46960
46960
|
let alpha = maxValue;
|
|
46961
46961
|
switch (options.inputColorType) {
|
|
46962
|
-
case
|
|
46962
|
+
case constants3.COLORTYPE_COLOR_ALPHA:
|
|
46963
46963
|
alpha = data[inIndex + 3];
|
|
46964
46964
|
red = data[inIndex];
|
|
46965
46965
|
green = data[inIndex + 1];
|
|
46966
46966
|
blue = data[inIndex + 2];
|
|
46967
46967
|
break;
|
|
46968
|
-
case
|
|
46968
|
+
case constants3.COLORTYPE_COLOR:
|
|
46969
46969
|
red = data[inIndex];
|
|
46970
46970
|
green = data[inIndex + 1];
|
|
46971
46971
|
blue = data[inIndex + 2];
|
|
46972
46972
|
break;
|
|
46973
|
-
case
|
|
46973
|
+
case constants3.COLORTYPE_ALPHA:
|
|
46974
46974
|
alpha = data[inIndex + 1];
|
|
46975
46975
|
red = data[inIndex];
|
|
46976
46976
|
green = red;
|
|
46977
46977
|
blue = red;
|
|
46978
46978
|
break;
|
|
46979
|
-
case
|
|
46979
|
+
case constants3.COLORTYPE_GRAYSCALE:
|
|
46980
46980
|
red = data[inIndex];
|
|
46981
46981
|
green = red;
|
|
46982
46982
|
blue = red;
|
|
@@ -47009,8 +47009,8 @@ var require_bitpacker = __commonJS({
|
|
|
47009
47009
|
for (let x = 0; x < width; x++) {
|
|
47010
47010
|
let rgba = getRGBA(data, inIndex);
|
|
47011
47011
|
switch (options.colorType) {
|
|
47012
|
-
case
|
|
47013
|
-
case
|
|
47012
|
+
case constants3.COLORTYPE_COLOR_ALPHA:
|
|
47013
|
+
case constants3.COLORTYPE_COLOR:
|
|
47014
47014
|
if (options.bitDepth === 8) {
|
|
47015
47015
|
outData[outIndex] = rgba.red;
|
|
47016
47016
|
outData[outIndex + 1] = rgba.green;
|
|
@@ -47027,8 +47027,8 @@ var require_bitpacker = __commonJS({
|
|
|
47027
47027
|
}
|
|
47028
47028
|
}
|
|
47029
47029
|
break;
|
|
47030
|
-
case
|
|
47031
|
-
case
|
|
47030
|
+
case constants3.COLORTYPE_ALPHA:
|
|
47031
|
+
case constants3.COLORTYPE_GRAYSCALE: {
|
|
47032
47032
|
let grayscale = (rgba.red + rgba.green + rgba.blue) / 3;
|
|
47033
47033
|
if (options.bitDepth === 8) {
|
|
47034
47034
|
outData[outIndex] = grayscale;
|
|
@@ -47201,7 +47201,7 @@ var require_filter_pack = __commonJS({
|
|
|
47201
47201
|
var require_packer = __commonJS({
|
|
47202
47202
|
"../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"(exports2, module2) {
|
|
47203
47203
|
"use strict";
|
|
47204
|
-
var
|
|
47204
|
+
var constants3 = require_constants8();
|
|
47205
47205
|
var CrcStream = require_crc();
|
|
47206
47206
|
var bitPacker = require_bitpacker();
|
|
47207
47207
|
var filter = require_filter_pack();
|
|
@@ -47214,23 +47214,23 @@ var require_packer = __commonJS({
|
|
|
47214
47214
|
options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true;
|
|
47215
47215
|
options.deflateFactory = options.deflateFactory || zlib2.createDeflate;
|
|
47216
47216
|
options.bitDepth = options.bitDepth || 8;
|
|
47217
|
-
options.colorType = typeof options.colorType === "number" ? options.colorType :
|
|
47218
|
-
options.inputColorType = typeof options.inputColorType === "number" ? options.inputColorType :
|
|
47217
|
+
options.colorType = typeof options.colorType === "number" ? options.colorType : constants3.COLORTYPE_COLOR_ALPHA;
|
|
47218
|
+
options.inputColorType = typeof options.inputColorType === "number" ? options.inputColorType : constants3.COLORTYPE_COLOR_ALPHA;
|
|
47219
47219
|
if ([
|
|
47220
|
-
|
|
47221
|
-
|
|
47222
|
-
|
|
47223
|
-
|
|
47220
|
+
constants3.COLORTYPE_GRAYSCALE,
|
|
47221
|
+
constants3.COLORTYPE_COLOR,
|
|
47222
|
+
constants3.COLORTYPE_COLOR_ALPHA,
|
|
47223
|
+
constants3.COLORTYPE_ALPHA
|
|
47224
47224
|
].indexOf(options.colorType) === -1) {
|
|
47225
47225
|
throw new Error(
|
|
47226
47226
|
"option color type:" + options.colorType + " is not supported at present"
|
|
47227
47227
|
);
|
|
47228
47228
|
}
|
|
47229
47229
|
if ([
|
|
47230
|
-
|
|
47231
|
-
|
|
47232
|
-
|
|
47233
|
-
|
|
47230
|
+
constants3.COLORTYPE_GRAYSCALE,
|
|
47231
|
+
constants3.COLORTYPE_COLOR,
|
|
47232
|
+
constants3.COLORTYPE_COLOR_ALPHA,
|
|
47233
|
+
constants3.COLORTYPE_ALPHA
|
|
47234
47234
|
].indexOf(options.inputColorType) === -1) {
|
|
47235
47235
|
throw new Error(
|
|
47236
47236
|
"option input color type:" + options.inputColorType + " is not supported at present"
|
|
@@ -47254,7 +47254,7 @@ var require_packer = __commonJS({
|
|
|
47254
47254
|
};
|
|
47255
47255
|
Packer.prototype.filterData = function(data, width, height) {
|
|
47256
47256
|
let packedData = bitPacker(data, width, height, this._options);
|
|
47257
|
-
let bpp =
|
|
47257
|
+
let bpp = constants3.COLORTYPE_TO_BPP_MAP[this._options.colorType];
|
|
47258
47258
|
let filteredData = filter(packedData, width, height, this._options, bpp);
|
|
47259
47259
|
return filteredData;
|
|
47260
47260
|
};
|
|
@@ -47274,8 +47274,8 @@ var require_packer = __commonJS({
|
|
|
47274
47274
|
};
|
|
47275
47275
|
Packer.prototype.packGAMA = function(gamma) {
|
|
47276
47276
|
let buf = Buffer.alloc(4);
|
|
47277
|
-
buf.writeUInt32BE(Math.floor(gamma *
|
|
47278
|
-
return this._packChunk(
|
|
47277
|
+
buf.writeUInt32BE(Math.floor(gamma * constants3.GAMMA_DIVISION), 0);
|
|
47278
|
+
return this._packChunk(constants3.TYPE_gAMA, buf);
|
|
47279
47279
|
};
|
|
47280
47280
|
Packer.prototype.packIHDR = function(width, height) {
|
|
47281
47281
|
let buf = Buffer.alloc(13);
|
|
@@ -47286,13 +47286,13 @@ var require_packer = __commonJS({
|
|
|
47286
47286
|
buf[10] = 0;
|
|
47287
47287
|
buf[11] = 0;
|
|
47288
47288
|
buf[12] = 0;
|
|
47289
|
-
return this._packChunk(
|
|
47289
|
+
return this._packChunk(constants3.TYPE_IHDR, buf);
|
|
47290
47290
|
};
|
|
47291
47291
|
Packer.prototype.packIDAT = function(data) {
|
|
47292
|
-
return this._packChunk(
|
|
47292
|
+
return this._packChunk(constants3.TYPE_IDAT, data);
|
|
47293
47293
|
};
|
|
47294
47294
|
Packer.prototype.packIEND = function() {
|
|
47295
|
-
return this._packChunk(
|
|
47295
|
+
return this._packChunk(constants3.TYPE_IEND, null);
|
|
47296
47296
|
};
|
|
47297
47297
|
}
|
|
47298
47298
|
});
|
|
@@ -47303,7 +47303,7 @@ var require_packer_async = __commonJS({
|
|
|
47303
47303
|
"use strict";
|
|
47304
47304
|
var util = require("util");
|
|
47305
47305
|
var Stream = require("stream");
|
|
47306
|
-
var
|
|
47306
|
+
var constants3 = require_constants8();
|
|
47307
47307
|
var Packer = require_packer();
|
|
47308
47308
|
var PackerAsync = module2.exports = function(opt) {
|
|
47309
47309
|
Stream.call(this);
|
|
@@ -47314,7 +47314,7 @@ var require_packer_async = __commonJS({
|
|
|
47314
47314
|
};
|
|
47315
47315
|
util.inherits(PackerAsync, Stream);
|
|
47316
47316
|
PackerAsync.prototype.pack = function(data, width, height, gamma) {
|
|
47317
|
-
this.emit("data", Buffer.from(
|
|
47317
|
+
this.emit("data", Buffer.from(constants3.PNG_SIGNATURE));
|
|
47318
47318
|
this.emit("data", this._packer.packIHDR(width, height));
|
|
47319
47319
|
if (gamma) {
|
|
47320
47320
|
this.emit("data", this._packer.packGAMA(gamma));
|
|
@@ -47638,7 +47638,7 @@ var require_packer_sync = __commonJS({
|
|
|
47638
47638
|
if (!zlib2.deflateSync) {
|
|
47639
47639
|
hasSyncZlib = false;
|
|
47640
47640
|
}
|
|
47641
|
-
var
|
|
47641
|
+
var constants3 = require_constants8();
|
|
47642
47642
|
var Packer = require_packer();
|
|
47643
47643
|
module2.exports = function(metaData, opt) {
|
|
47644
47644
|
if (!hasSyncZlib) {
|
|
@@ -47649,7 +47649,7 @@ var require_packer_sync = __commonJS({
|
|
|
47649
47649
|
let options = opt || {};
|
|
47650
47650
|
let packer = new Packer(options);
|
|
47651
47651
|
let chunks = [];
|
|
47652
|
-
chunks.push(Buffer.from(
|
|
47652
|
+
chunks.push(Buffer.from(constants3.PNG_SIGNATURE));
|
|
47653
47653
|
chunks.push(packer.packIHDR(metaData.width, metaData.height));
|
|
47654
47654
|
if (metaData.gamma) {
|
|
47655
47655
|
chunks.push(packer.packGAMA(metaData.gamma));
|
|
@@ -48470,7 +48470,7 @@ __export(bin_exports, {
|
|
|
48470
48470
|
module.exports = __toCommonJS(bin_exports);
|
|
48471
48471
|
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
48472
48472
|
var import_node_child_process30 = require("node:child_process");
|
|
48473
|
-
var
|
|
48473
|
+
var import_node_fs38 = require("node:fs");
|
|
48474
48474
|
var import_node_os28 = require("node:os");
|
|
48475
48475
|
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
48476
48476
|
|
|
@@ -64344,6 +64344,7 @@ var openApiOperationIds = {
|
|
|
64344
64344
|
getTaskState: "getTaskState",
|
|
64345
64345
|
upsertTaskState: "upsertTaskState",
|
|
64346
64346
|
beginColdWork: "beginColdWork",
|
|
64347
|
+
beginColdWorkV2: "beginColdWorkV2",
|
|
64347
64348
|
parkColdWork: "parkColdWork",
|
|
64348
64349
|
restartReconciledColdWork: "restartReconciledColdWork",
|
|
64349
64350
|
publishExecutorThread: "publishExecutorThread",
|
|
@@ -69070,7 +69071,7 @@ function createMrrlinClient(config2) {
|
|
|
69070
69071
|
const signals = [callerSignal, operationSignal].filter((value) => Boolean(value));
|
|
69071
69072
|
return { operation, signal: signals.length ? AbortSignal.any(signals) : void 0 };
|
|
69072
69073
|
}
|
|
69073
|
-
async function executeFetch(path40, init, { operation, signal }
|
|
69074
|
+
async function executeFetch(path40, init, { operation, signal }) {
|
|
69074
69075
|
const method = (init?.method ?? "GET").toUpperCase();
|
|
69075
69076
|
if (signal?.aborted)
|
|
69076
69077
|
throw new DOMException("The user aborted a request.", "AbortError");
|
|
@@ -69108,7 +69109,7 @@ function createMrrlinClient(config2) {
|
|
|
69108
69109
|
}
|
|
69109
69110
|
return response;
|
|
69110
69111
|
} catch (err) {
|
|
69111
|
-
if (signal?.aborted || err?.name === "AbortError") {
|
|
69112
|
+
if (signal?.aborted || err?.name === "AbortError" || operation?.shouldRetryError?.(err) === false) {
|
|
69112
69113
|
throw err;
|
|
69113
69114
|
}
|
|
69114
69115
|
if (isIdempotent && attempt < maxAttempts - 1) {
|
|
@@ -69121,8 +69122,24 @@ function createMrrlinClient(config2) {
|
|
|
69121
69122
|
}
|
|
69122
69123
|
throw new Error(`Failed to execute ${method} ${path40}`);
|
|
69123
69124
|
}
|
|
69124
|
-
|
|
69125
|
-
|
|
69125
|
+
function ownedDeadlineExpired({ operation, signal }) {
|
|
69126
|
+
const deadline = operation?.deadlineSignal;
|
|
69127
|
+
if (!deadline)
|
|
69128
|
+
return false;
|
|
69129
|
+
if (signal?.aborted)
|
|
69130
|
+
return deadline.aborted && signal.reason === deadline.reason;
|
|
69131
|
+
return performance.now() >= (operation.deadlineAt ?? Number.POSITIVE_INFINITY);
|
|
69132
|
+
}
|
|
69133
|
+
async function handleResponseError(response, method, path40, scope) {
|
|
69134
|
+
let body;
|
|
69135
|
+
try {
|
|
69136
|
+
body = await response.text();
|
|
69137
|
+
} catch (error51) {
|
|
69138
|
+
if (!(error51 instanceof MrrlinResponseTooLargeError) && !ownedDeadlineExpired(scope))
|
|
69139
|
+
throw error51;
|
|
69140
|
+
body = "";
|
|
69141
|
+
}
|
|
69142
|
+
return throwResponseError(response, method, path40, body);
|
|
69126
69143
|
}
|
|
69127
69144
|
function throwResponseError(response, method, path40, body) {
|
|
69128
69145
|
let code = `HTTP_${response.status}`;
|
|
@@ -69162,8 +69179,12 @@ function createMrrlinClient(config2) {
|
|
|
69162
69179
|
const scope = createFetchScope(callerSignal);
|
|
69163
69180
|
const signal = scope.signal ?? callerSignal;
|
|
69164
69181
|
const operationDeadlineAt = scope.operation?.deadlineAt ?? Number.POSITIVE_INFINITY;
|
|
69165
|
-
const expired = () =>
|
|
69166
|
-
|
|
69182
|
+
const expired = () => {
|
|
69183
|
+
if (scope.operation?.deadlineSignal && signal.aborted) {
|
|
69184
|
+
return deadline.aborted && signal.reason === deadline.reason || ownedDeadlineExpired(scope);
|
|
69185
|
+
}
|
|
69186
|
+
return performance.now() >= Math.min(deadlineAt, operationDeadlineAt) || deadline.aborted || signal.aborted && signal.reason instanceof DOMException && signal.reason.name === "TimeoutError";
|
|
69187
|
+
};
|
|
69167
69188
|
const pending = executeFetch(path40, init, scope);
|
|
69168
69189
|
void pending.then((response) => {
|
|
69169
69190
|
if (signal.aborted)
|
|
@@ -69171,42 +69192,54 @@ function createMrrlinClient(config2) {
|
|
|
69171
69192
|
});
|
|
69172
69193
|
}, () => {
|
|
69173
69194
|
});
|
|
69174
|
-
return { pending: withinBoundedReadDeadline(pending, signal), signal, expired };
|
|
69195
|
+
return { pending: withinBoundedReadDeadline(pending, signal), signal, expired, close: scope.operation?.close };
|
|
69175
69196
|
}
|
|
69176
69197
|
async function requestBoundedJson(path40, maxBytes, caller) {
|
|
69177
|
-
const { pending, signal } = startBoundedGet(path40, caller, { cache: "no-store" });
|
|
69178
|
-
|
|
69179
|
-
|
|
69180
|
-
|
|
69181
|
-
|
|
69182
|
-
|
|
69183
|
-
|
|
69184
|
-
|
|
69185
|
-
|
|
69186
|
-
|
|
69187
|
-
|
|
69188
|
-
|
|
69189
|
-
|
|
69190
|
-
|
|
69198
|
+
const { pending, signal, close } = startBoundedGet(path40, caller, { cache: "no-store" });
|
|
69199
|
+
try {
|
|
69200
|
+
const response = await pending;
|
|
69201
|
+
if (response.status !== 200) {
|
|
69202
|
+
void response.body?.cancel().catch(() => {
|
|
69203
|
+
});
|
|
69204
|
+
throw new MrrlinApiError({
|
|
69205
|
+
code: `HTTP_${response.status}`,
|
|
69206
|
+
status: response.status,
|
|
69207
|
+
method: "GET",
|
|
69208
|
+
path: path40,
|
|
69209
|
+
message: `Bounded read request failed: ${response.status}`,
|
|
69210
|
+
responseBody: "",
|
|
69211
|
+
retryAfterMs: parseRetryAfter(response) ?? void 0,
|
|
69212
|
+
violations: null
|
|
69213
|
+
});
|
|
69214
|
+
}
|
|
69215
|
+
const bytes3 = await readBoundedBody(response, signal, maxBytes);
|
|
69216
|
+
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes3));
|
|
69217
|
+
} finally {
|
|
69218
|
+
close?.();
|
|
69191
69219
|
}
|
|
69192
|
-
const bytes3 = await readBoundedBody(response, signal, maxBytes);
|
|
69193
|
-
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes3));
|
|
69194
69220
|
}
|
|
69195
|
-
async function
|
|
69196
|
-
const
|
|
69197
|
-
|
|
69198
|
-
|
|
69199
|
-
await
|
|
69221
|
+
async function consumeResponse(path40, init, consume) {
|
|
69222
|
+
const scope = createFetchScope(init?.signal);
|
|
69223
|
+
try {
|
|
69224
|
+
const response = await executeFetch(path40, init, scope);
|
|
69225
|
+
return await consume(response, scope);
|
|
69226
|
+
} finally {
|
|
69227
|
+
scope.operation?.close?.();
|
|
69200
69228
|
}
|
|
69201
|
-
return response.json();
|
|
69202
69229
|
}
|
|
69203
|
-
|
|
69204
|
-
|
|
69205
|
-
|
|
69206
|
-
|
|
69207
|
-
|
|
69208
|
-
}
|
|
69209
|
-
|
|
69230
|
+
function request(path40, init) {
|
|
69231
|
+
return consumeResponse(path40, init, async (response, scope) => {
|
|
69232
|
+
if (!response.ok)
|
|
69233
|
+
await handleResponseError(response, init?.method ?? "GET", path40, scope);
|
|
69234
|
+
return response.json();
|
|
69235
|
+
});
|
|
69236
|
+
}
|
|
69237
|
+
function requestText(path40, init) {
|
|
69238
|
+
return consumeResponse(path40, init, async (response, scope) => {
|
|
69239
|
+
if (!response.ok)
|
|
69240
|
+
await handleResponseError(response, init?.method ?? "GET", path40, scope);
|
|
69241
|
+
return response.text();
|
|
69242
|
+
});
|
|
69210
69243
|
}
|
|
69211
69244
|
return {
|
|
69212
69245
|
withExecutionAuthority(runId, leaseId, signal, assertActive) {
|
|
@@ -69394,37 +69427,41 @@ function createMrrlinClient(config2) {
|
|
|
69394
69427
|
const path40 = `${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}`;
|
|
69395
69428
|
if (!options?.boundedResponse)
|
|
69396
69429
|
return taskResponseSchema.parse(await request(path40)).data;
|
|
69397
|
-
const { pending, signal, expired } = startBoundedGet(path40, options.signal);
|
|
69398
|
-
let response;
|
|
69430
|
+
const { pending, signal, expired, close } = startBoundedGet(path40, options.signal);
|
|
69399
69431
|
try {
|
|
69400
|
-
response
|
|
69401
|
-
|
|
69402
|
-
|
|
69403
|
-
|
|
69404
|
-
|
|
69405
|
-
|
|
69406
|
-
|
|
69407
|
-
|
|
69408
|
-
let body = "";
|
|
69409
|
-
try {
|
|
69410
|
-
if (response.body)
|
|
69411
|
-
body = new TextDecoder().decode(await readBoundedBody(response, signal, maxBytes));
|
|
69412
|
-
signal.throwIfAborted();
|
|
69413
|
-
if (expired())
|
|
69414
|
-
throw new DOMException("Bounded read deadline expired", "TimeoutError");
|
|
69415
|
-
} catch (error51) {
|
|
69416
|
-
options.signal?.throwIfAborted();
|
|
69417
|
-
const timedOut = expired();
|
|
69418
|
-
if (!response.ok && (error51 instanceof MrrlinResponseTooLargeError || timedOut)) {
|
|
69419
|
-
throwResponseError(response, "GET", path40, "");
|
|
69432
|
+
let response;
|
|
69433
|
+
try {
|
|
69434
|
+
response = await pending;
|
|
69435
|
+
} catch (error51) {
|
|
69436
|
+
options.signal?.throwIfAborted();
|
|
69437
|
+
if (expired())
|
|
69438
|
+
throw new DOMException("Bounded read deadline expired", "TimeoutError");
|
|
69439
|
+
throw error51;
|
|
69420
69440
|
}
|
|
69421
|
-
|
|
69422
|
-
|
|
69423
|
-
|
|
69441
|
+
const maxBytes = response.ok ? 8 * 1024 * 1024 : 64 * 1024;
|
|
69442
|
+
let body = "";
|
|
69443
|
+
try {
|
|
69444
|
+
if (response.body)
|
|
69445
|
+
body = new TextDecoder().decode(await readBoundedBody(response, signal, maxBytes));
|
|
69446
|
+
signal.throwIfAborted();
|
|
69447
|
+
if (expired())
|
|
69448
|
+
throw new DOMException("Bounded read deadline expired", "TimeoutError");
|
|
69449
|
+
} catch (error51) {
|
|
69450
|
+
options.signal?.throwIfAborted();
|
|
69451
|
+
const timedOut = expired();
|
|
69452
|
+
if (!response.ok && (error51 instanceof MrrlinResponseTooLargeError || timedOut)) {
|
|
69453
|
+
throwResponseError(response, "GET", path40, "");
|
|
69454
|
+
}
|
|
69455
|
+
if (timedOut)
|
|
69456
|
+
throw new DOMException("Bounded read deadline expired", "TimeoutError");
|
|
69457
|
+
throw error51;
|
|
69458
|
+
}
|
|
69459
|
+
if (!response.ok)
|
|
69460
|
+
throwResponseError(response, "GET", path40, body);
|
|
69461
|
+
return taskResponseSchema.parse(JSON.parse(body)).data;
|
|
69462
|
+
} finally {
|
|
69463
|
+
close?.();
|
|
69424
69464
|
}
|
|
69425
|
-
if (!response.ok)
|
|
69426
|
-
throwResponseError(response, "GET", path40, body);
|
|
69427
|
-
return taskResponseSchema.parse(JSON.parse(body)).data;
|
|
69428
69465
|
},
|
|
69429
69466
|
async getTaskBlockerStatusV1(projectSlug, taskIds, options) {
|
|
69430
69467
|
const ids = blockerTaskIdsSchema.parse(taskIds);
|
|
@@ -69443,10 +69480,11 @@ function createMrrlinClient(config2) {
|
|
|
69443
69480
|
},
|
|
69444
69481
|
async getWikiPageLinkedTaskV1(projectSlug, pageId) {
|
|
69445
69482
|
const path40 = `${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}/linked-task/v1`;
|
|
69446
|
-
|
|
69447
|
-
|
|
69448
|
-
|
|
69449
|
-
|
|
69483
|
+
return consumeResponse(path40, void 0, async (response, scope) => {
|
|
69484
|
+
if (response.status !== 200)
|
|
69485
|
+
await handleResponseError(response, "GET", path40, scope);
|
|
69486
|
+
return linkedTaskResponseSchema.parse(await response.json()).taskId;
|
|
69487
|
+
});
|
|
69450
69488
|
},
|
|
69451
69489
|
async getWikiPage(projectSlug, pageId) {
|
|
69452
69490
|
const body = await request(`${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}`);
|
|
@@ -70150,6 +70188,18 @@ function createMrrlinClient(config2) {
|
|
|
70150
70188
|
});
|
|
70151
70189
|
return body?.data?.applied === true;
|
|
70152
70190
|
},
|
|
70191
|
+
async beginColdWorkV2(projectSlug, taskId, runId, leaseId, threadId, expectedWorktreeId, options) {
|
|
70192
|
+
const body = await request(`${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}/begin-cold-work-v2`, {
|
|
70193
|
+
method: "POST",
|
|
70194
|
+
headers: { "content-type": "application/json" },
|
|
70195
|
+
body: JSON.stringify({ runId, leaseId, threadId, expectedWorktreeId }),
|
|
70196
|
+
signal: options?.signal
|
|
70197
|
+
});
|
|
70198
|
+
const applied = body?.data?.applied;
|
|
70199
|
+
if (typeof applied !== "boolean")
|
|
70200
|
+
throw new Error("Invalid cold-work reservation response");
|
|
70201
|
+
return applied;
|
|
70202
|
+
},
|
|
70153
70203
|
async parkColdWork(projectSlug, runId, leaseId) {
|
|
70154
70204
|
const body = await request(`${projectPath(projectSlug)}/execution-runs/${encodeURIComponent(runId)}/park-cold-work`, {
|
|
70155
70205
|
method: "POST",
|
|
@@ -72411,14 +72461,14 @@ async function runCodeGate(_target, deps) {
|
|
|
72411
72461
|
return await deps.readReviewArtifact();
|
|
72412
72462
|
}
|
|
72413
72463
|
});
|
|
72414
|
-
const
|
|
72464
|
+
const open2 = result.outcome === "CONVERGED" ? [] : result.unresolved.map(({ category, text }) => ({ category, text }));
|
|
72415
72465
|
return {
|
|
72416
72466
|
outcome: result.outcome,
|
|
72417
72467
|
rounds: result.rounds,
|
|
72418
72468
|
arbiterInfo: result.arbiterInfo,
|
|
72419
72469
|
panelComposition: result.panelComposition,
|
|
72420
72470
|
sufficiencyVerdict: result.sufficiencyVerdict,
|
|
72421
|
-
...
|
|
72471
|
+
...open2.length > 0 ? { unresolved: open2 } : {}
|
|
72422
72472
|
};
|
|
72423
72473
|
} catch (err) {
|
|
72424
72474
|
if (err instanceof CodeGateUnfixableError) {
|
|
@@ -94888,7 +94938,7 @@ async function getAgentProviderForPanel(client, opts = {}) {
|
|
|
94888
94938
|
}
|
|
94889
94939
|
}
|
|
94890
94940
|
function createMrrlinTools(options) {
|
|
94891
|
-
const client = createMrrlinClient(withAuth(options));
|
|
94941
|
+
const client = createMrrlinClient({ ...withAuth(options), createOperation: options.fetch ? void 0 : options.createOperation });
|
|
94892
94942
|
async function resolveBoundSlug() {
|
|
94893
94943
|
if (process.env.MRRLIN_PROJECT_BINDING === "none") return void 0;
|
|
94894
94944
|
if (options.activeProjectSlug !== void 0) return options.activeProjectSlug;
|
|
@@ -97556,101 +97606,118 @@ function createOwnedStreamingFetch(scope, origin) {
|
|
|
97556
97606
|
throw new TypeError("Invalid streaming transport origin");
|
|
97557
97607
|
}
|
|
97558
97608
|
return async (input) => {
|
|
97559
|
-
const { deadlineAt, deadlineSignal, signal, method } = input;
|
|
97560
|
-
const url2 = new URL(input.url);
|
|
97561
|
-
if (url2.origin !== expected.origin || url2.username || url2.password || url2.hash || !["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"].includes(method) || input.body !== void 0 && (typeof input.body !== "string" && !(input.body instanceof Uint8Array) || method === "GET" || method === "HEAD")) {
|
|
97562
|
-
throw new TypeError("Unsupported streaming request");
|
|
97563
|
-
}
|
|
97564
|
-
const aborted2 = () => new DOMException("Streaming request canceled", "AbortError");
|
|
97565
|
-
const budget = new AbortController();
|
|
97566
|
-
const expire = () => budget.abort(aborted2());
|
|
97567
|
-
const remaining = deadlineAt - performance.now();
|
|
97568
|
-
if (!Number.isFinite(remaining) || remaining <= 0 || remaining > 2147483647 || signal?.aborted) throw aborted2();
|
|
97569
|
-
let onDeadline = expire;
|
|
97570
|
-
const timer = setTimeout(() => onDeadline(), Math.ceil(remaining));
|
|
97571
|
-
let canceledBeforeDeadline = false;
|
|
97572
|
-
const caller = signal ? (0, import_node_events3.addAbortListener)(signal, () => {
|
|
97573
|
-
if (deadlineSignal?.aborted && signal.reason === deadlineSignal.reason) onDeadline();
|
|
97574
|
-
else {
|
|
97575
|
-
canceledBeforeDeadline = performance.now() < deadlineAt;
|
|
97576
|
-
expire();
|
|
97577
|
-
}
|
|
97578
|
-
}) : void 0;
|
|
97579
97609
|
let retained = false;
|
|
97580
|
-
|
|
97581
|
-
|
|
97582
|
-
|
|
97610
|
+
let notified = false;
|
|
97611
|
+
const notifyReleased = () => {
|
|
97612
|
+
if (notified) return;
|
|
97613
|
+
notified = true;
|
|
97614
|
+
input.onReleased?.();
|
|
97583
97615
|
};
|
|
97584
97616
|
try {
|
|
97585
|
-
|
|
97586
|
-
|
|
97587
|
-
|
|
97588
|
-
|
|
97589
|
-
|
|
97590
|
-
|
|
97591
|
-
|
|
97592
|
-
|
|
97593
|
-
|
|
97594
|
-
|
|
97595
|
-
|
|
97596
|
-
|
|
97597
|
-
|
|
97598
|
-
|
|
97599
|
-
|
|
97600
|
-
|
|
97617
|
+
const { deadlineAt, deadlineSignal, signal, method } = input;
|
|
97618
|
+
const url2 = new URL(input.url);
|
|
97619
|
+
if (url2.origin !== expected.origin || url2.username || url2.password || url2.hash || !["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"].includes(method) || input.body !== void 0 && (typeof input.body !== "string" && !(input.body instanceof Uint8Array) || method === "GET" || method === "HEAD")) {
|
|
97620
|
+
throw new TypeError("Unsupported streaming request");
|
|
97621
|
+
}
|
|
97622
|
+
const aborted2 = () => new DOMException("Streaming request canceled", "AbortError");
|
|
97623
|
+
const budget = new AbortController();
|
|
97624
|
+
const expire = () => budget.abort(aborted2());
|
|
97625
|
+
const remaining = deadlineAt - performance.now();
|
|
97626
|
+
if (!Number.isFinite(remaining) || remaining <= 0 || remaining > 2147483647 || signal?.aborted) throw aborted2();
|
|
97627
|
+
let onDeadline = expire;
|
|
97628
|
+
const timer = setTimeout(() => onDeadline(), Math.ceil(remaining));
|
|
97629
|
+
let canceledBeforeDeadline = false;
|
|
97630
|
+
const caller = signal ? (0, import_node_events3.addAbortListener)(signal, () => {
|
|
97631
|
+
if (deadlineSignal?.aborted && signal.reason === deadlineSignal.reason) onDeadline();
|
|
97632
|
+
else {
|
|
97633
|
+
canceledBeforeDeadline = performance.now() < deadlineAt;
|
|
97601
97634
|
expire();
|
|
97602
|
-
slot?.cancel();
|
|
97603
|
-
};
|
|
97604
|
-
const physicalAbort = (0, import_node_events3.addAbortListener)(budget.signal, cancel);
|
|
97605
|
-
void released.then(() => {
|
|
97606
|
-
physicalAbort[Symbol.dispose]();
|
|
97607
|
-
cleanup();
|
|
97608
|
-
});
|
|
97609
|
-
try {
|
|
97610
|
-
operation.retainResource({ deadlineAt, cancel, released });
|
|
97611
|
-
retained = true;
|
|
97612
|
-
budget.signal.throwIfAborted();
|
|
97613
|
-
slot = operation.generation.openOrdinarySlot({
|
|
97614
|
-
deadlineAt,
|
|
97615
|
-
signal: budget.signal,
|
|
97616
|
-
singleHop: true,
|
|
97617
|
-
onPreWrite: () => {
|
|
97618
|
-
waitingForHeaders = true;
|
|
97619
|
-
},
|
|
97620
|
-
onFinalHeaders: () => {
|
|
97621
|
-
waitingForHeaders = false;
|
|
97622
|
-
},
|
|
97623
|
-
onTerminal: () => slot?.close()
|
|
97624
|
-
});
|
|
97625
|
-
} catch (error51) {
|
|
97626
|
-
if (error51 instanceof BridgeSchedulerSlotOpenError) void error51.released.then(done);
|
|
97627
|
-
else done();
|
|
97628
|
-
throw error51;
|
|
97629
97635
|
}
|
|
97630
|
-
|
|
97631
|
-
|
|
97632
|
-
|
|
97633
|
-
|
|
97634
|
-
|
|
97635
|
-
|
|
97636
|
-
|
|
97637
|
-
|
|
97638
|
-
|
|
97639
|
-
|
|
97636
|
+
}) : void 0;
|
|
97637
|
+
const cleanup = () => {
|
|
97638
|
+
clearTimeout(timer);
|
|
97639
|
+
caller?.[Symbol.dispose]();
|
|
97640
|
+
};
|
|
97641
|
+
try {
|
|
97642
|
+
return await scope.run("ordinary", { signal: budget.signal, deadlineAt }, async (operation) => {
|
|
97643
|
+
let slot;
|
|
97644
|
+
let done;
|
|
97645
|
+
const released = new Promise((resolve3) => {
|
|
97646
|
+
done = resolve3;
|
|
97640
97647
|
});
|
|
97641
|
-
|
|
97642
|
-
|
|
97643
|
-
|
|
97644
|
-
|
|
97645
|
-
|
|
97646
|
-
|
|
97647
|
-
|
|
97648
|
-
|
|
97649
|
-
|
|
97650
|
-
|
|
97651
|
-
|
|
97648
|
+
let waitingForHeaders = false;
|
|
97649
|
+
const rotate = () => {
|
|
97650
|
+
if (waitingForHeaders && !canceledBeforeDeadline) input.rotateOnHeaderTimeout?.rotate(operation.generation);
|
|
97651
|
+
};
|
|
97652
|
+
onDeadline = () => {
|
|
97653
|
+
rotate();
|
|
97654
|
+
expire();
|
|
97655
|
+
};
|
|
97656
|
+
const cancel = () => {
|
|
97657
|
+
if (performance.now() >= deadlineAt) rotate();
|
|
97658
|
+
expire();
|
|
97659
|
+
slot?.cancel();
|
|
97660
|
+
};
|
|
97661
|
+
const physicalAbort = (0, import_node_events3.addAbortListener)(budget.signal, cancel);
|
|
97662
|
+
void released.then(() => {
|
|
97663
|
+
physicalAbort[Symbol.dispose]();
|
|
97664
|
+
cleanup();
|
|
97665
|
+
notifyReleased();
|
|
97666
|
+
});
|
|
97667
|
+
try {
|
|
97668
|
+
operation.retainResource({ deadlineAt, cancel, released });
|
|
97669
|
+
retained = true;
|
|
97670
|
+
budget.signal.throwIfAborted();
|
|
97671
|
+
slot = operation.generation.openOrdinarySlot({
|
|
97672
|
+
deadlineAt,
|
|
97673
|
+
signal: budget.signal,
|
|
97674
|
+
singleHop: true,
|
|
97675
|
+
onDispatch: input.onGeneration && (() => input.onGeneration?.(operation.generation.id)),
|
|
97676
|
+
onPreWrite: () => {
|
|
97677
|
+
waitingForHeaders = true;
|
|
97678
|
+
},
|
|
97679
|
+
onFinalHeaders: () => {
|
|
97680
|
+
waitingForHeaders = false;
|
|
97681
|
+
},
|
|
97682
|
+
onTerminal: () => slot?.close()
|
|
97683
|
+
});
|
|
97684
|
+
} catch (error51) {
|
|
97685
|
+
if (error51 instanceof BridgeSchedulerSlotOpenError) void error51.released.then(done);
|
|
97686
|
+
else done();
|
|
97687
|
+
throw error51;
|
|
97688
|
+
}
|
|
97689
|
+
void slot.released.then(done);
|
|
97690
|
+
try {
|
|
97691
|
+
if (budget.signal.aborted || performance.now() >= deadlineAt) throw aborted2();
|
|
97692
|
+
const response = await (0, import_undici3.fetch)(url2, {
|
|
97693
|
+
method,
|
|
97694
|
+
headers: input.headers,
|
|
97695
|
+
body: input.body instanceof Uint8Array ? Buffer.from(input.body) : input.body,
|
|
97696
|
+
redirect: input.rejectRedirect ? "manual" : "error",
|
|
97697
|
+
dispatcher: slot.dispatcher,
|
|
97698
|
+
signal: budget.signal
|
|
97699
|
+
});
|
|
97700
|
+
if (budget.signal.aborted || performance.now() >= deadlineAt) throw aborted2();
|
|
97701
|
+
if (input.rejectRedirect && [301, 302, 303, 307, 308].includes(response.status)) {
|
|
97702
|
+
void response.body?.cancel().catch(() => {
|
|
97703
|
+
});
|
|
97704
|
+
throw input.rejectRedirect();
|
|
97705
|
+
}
|
|
97706
|
+
return response;
|
|
97707
|
+
} catch (error51) {
|
|
97708
|
+
if (errorKind(error51) === "UND_ERR_HEADERS_TIMEOUT") rotate();
|
|
97709
|
+
slot.cancel();
|
|
97710
|
+
throw error51;
|
|
97711
|
+
}
|
|
97712
|
+
});
|
|
97713
|
+
} catch (error51) {
|
|
97714
|
+
if (budget.signal.aborted || performance.now() >= deadlineAt) throw aborted2();
|
|
97715
|
+
throw error51;
|
|
97716
|
+
} finally {
|
|
97717
|
+
if (!retained) cleanup();
|
|
97718
|
+
}
|
|
97652
97719
|
} finally {
|
|
97653
|
-
if (!retained)
|
|
97720
|
+
if (!retained) notifyReleased();
|
|
97654
97721
|
}
|
|
97655
97722
|
};
|
|
97656
97723
|
}
|
|
@@ -99586,7 +99653,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99586
99653
|
}
|
|
99587
99654
|
|
|
99588
99655
|
// src/_generated/version.ts
|
|
99589
|
-
var PKG_VERSION = "0.4.
|
|
99656
|
+
var PKG_VERSION = "0.4.216";
|
|
99590
99657
|
|
|
99591
99658
|
// src/bridge-allowed-origins.ts
|
|
99592
99659
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -104874,11 +104941,12 @@ async function driveTurn(deps, codex, projectSlug, runId, leaseId, threadId, inp
|
|
|
104874
104941
|
if (available <= 0 || dispatchBudgetMs && dispatchBudgetMs(Date.now()) <= 0) return notStarted();
|
|
104875
104942
|
const timeoutMs = Math.min(available, 3e3);
|
|
104876
104943
|
const deadlineAt = Date.now() + timeoutMs;
|
|
104944
|
+
const reservationDeadline = import_node_perf_hooks.performance.now() + timeoutMs;
|
|
104877
104945
|
const preflight = new AbortController();
|
|
104878
104946
|
const preflightSignal = guard ? AbortSignal.any([guard.signal, preflight.signal]) : preflight.signal;
|
|
104879
104947
|
const checkDeadline = () => {
|
|
104880
104948
|
preflightSignal.throwIfAborted();
|
|
104881
|
-
if (Date.now() >= deadlineAt || workPreflight.remainingBudgetMs() <= 0) {
|
|
104949
|
+
if (Date.now() >= deadlineAt || import_node_perf_hooks.performance.now() >= reservationDeadline || workPreflight.remainingBudgetMs() <= 0) {
|
|
104882
104950
|
throw new WorkLeaseUnavailableError();
|
|
104883
104951
|
}
|
|
104884
104952
|
};
|
|
@@ -104887,7 +104955,9 @@ async function driveTurn(deps, codex, projectSlug, runId, leaseId, threadId, inp
|
|
|
104887
104955
|
timeoutMs,
|
|
104888
104956
|
"Execution lease preflight timed out"
|
|
104889
104957
|
).catch(() => false).finally(() => preflight.abort());
|
|
104890
|
-
if (!eligible
|
|
104958
|
+
if (!eligible || workPreflight.begin && import_node_perf_hooks.performance.now() >= reservationDeadline) {
|
|
104959
|
+
throw new WorkLeaseUnavailableError();
|
|
104960
|
+
}
|
|
104891
104961
|
workPreflight.onReserved?.();
|
|
104892
104962
|
overallMs = workPreflight.remainingBudgetMs();
|
|
104893
104963
|
if (overallMs <= 0) return notStarted();
|
|
@@ -105654,6 +105724,7 @@ ${renderTaskStateSection(taskState)}`;
|
|
|
105654
105724
|
let resolvedDefaultBranch = null;
|
|
105655
105725
|
let useExecutor = false;
|
|
105656
105726
|
let coldWorkReserved = false;
|
|
105727
|
+
const coldReservation = { outcome: "not_sent" };
|
|
105657
105728
|
let skipRunWrites = false;
|
|
105658
105729
|
const parkUnconfirmedWork = async (stopExecutor = deps.activeLease !== void 0) => {
|
|
105659
105730
|
if (stopExecutor) disposeRunAgent();
|
|
@@ -106198,15 +106269,29 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
106198
106269
|
...needsColdPublication ? {
|
|
106199
106270
|
begin: async (preflightSignal, checkDeadline) => {
|
|
106200
106271
|
checkDeadline();
|
|
106272
|
+
if (!deps.client.beginColdWorkV2) return false;
|
|
106201
106273
|
if (worktreePath) {
|
|
106202
106274
|
await preserveColdWorkRoot(deps.worktreeRoot ?? "/tmp/mrrlin-worktrees", preflightSignal, checkDeadline);
|
|
106203
106275
|
checkDeadline();
|
|
106204
106276
|
await (deps.lockColdWorkWorktree ?? lockColdWorkWorktreeWithGit)(worktreePath, preflightSignal);
|
|
106205
106277
|
}
|
|
106206
106278
|
checkDeadline();
|
|
106207
|
-
|
|
106279
|
+
coldReservation.outcome = "unknown";
|
|
106280
|
+
const applied = await deps.client.beginColdWorkV2(
|
|
106281
|
+
projectSlug,
|
|
106282
|
+
task.id,
|
|
106283
|
+
runId,
|
|
106284
|
+
leaseId,
|
|
106285
|
+
threadId,
|
|
106286
|
+
worktreePath,
|
|
106287
|
+
{ signal: preflightSignal }
|
|
106288
|
+
);
|
|
106289
|
+
preflightSignal.throwIfAborted();
|
|
106290
|
+
if (applied === false) coldReservation.outcome = "refused";
|
|
106291
|
+
return applied === true;
|
|
106208
106292
|
},
|
|
106209
106293
|
onReserved: () => {
|
|
106294
|
+
coldReservation.outcome = "accepted";
|
|
106210
106295
|
coldWorkReserved = true;
|
|
106211
106296
|
}
|
|
106212
106297
|
} : {}
|
|
@@ -106684,11 +106769,14 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
106684
106769
|
});
|
|
106685
106770
|
}
|
|
106686
106771
|
} catch (error51) {
|
|
106687
|
-
if (leaseSignal?.aborted) return;
|
|
106688
106772
|
if (error51 instanceof WorkLeaseUnavailableError) {
|
|
106689
106773
|
skipRunWrites = true;
|
|
106774
|
+
if (coldReservation.outcome === "unknown") {
|
|
106775
|
+
console.warn(JSON.stringify({ event: "executor_cold_work_reservation_unknown", projectSlug, runId }));
|
|
106776
|
+
}
|
|
106690
106777
|
return;
|
|
106691
106778
|
}
|
|
106779
|
+
if (leaseSignal?.aborted) return;
|
|
106692
106780
|
const approvalError = guard?.signal.reason instanceof MixedCodeApprovalError ? guard.signal.reason : error51 instanceof MixedCodeApprovalError ? error51 : void 0;
|
|
106693
106781
|
if (approvalError) {
|
|
106694
106782
|
if (coldWorkReserved) {
|
|
@@ -111121,21 +111209,21 @@ function chatTurnMaxMs() {
|
|
|
111121
111209
|
// src/tool-busy.ts
|
|
111122
111210
|
function createToolBusyClock(opts) {
|
|
111123
111211
|
const now = opts?.now ?? Date.now;
|
|
111124
|
-
const
|
|
111212
|
+
const open2 = /* @__PURE__ */ new Set();
|
|
111125
111213
|
let total = 0;
|
|
111126
111214
|
let segmentStart = null;
|
|
111127
111215
|
function start(itemId) {
|
|
111128
|
-
if (!
|
|
111129
|
-
|
|
111130
|
-
if (
|
|
111216
|
+
if (!open2.has(itemId)) {
|
|
111217
|
+
open2.add(itemId);
|
|
111218
|
+
if (open2.size === 1) {
|
|
111131
111219
|
segmentStart = now();
|
|
111132
111220
|
}
|
|
111133
111221
|
}
|
|
111134
111222
|
}
|
|
111135
111223
|
function end(itemId) {
|
|
111136
|
-
if (
|
|
111137
|
-
|
|
111138
|
-
if (
|
|
111224
|
+
if (open2.has(itemId)) {
|
|
111225
|
+
open2.delete(itemId);
|
|
111226
|
+
if (open2.size === 0) {
|
|
111139
111227
|
const nowVal = now();
|
|
111140
111228
|
if (segmentStart !== null) {
|
|
111141
111229
|
total += nowVal - segmentStart;
|
|
@@ -111145,18 +111233,18 @@ function createToolBusyClock(opts) {
|
|
|
111145
111233
|
}
|
|
111146
111234
|
}
|
|
111147
111235
|
function endAll() {
|
|
111148
|
-
if (
|
|
111236
|
+
if (open2.size > 0) {
|
|
111149
111237
|
const nowVal = now();
|
|
111150
111238
|
if (segmentStart !== null) {
|
|
111151
111239
|
total += nowVal - segmentStart;
|
|
111152
111240
|
segmentStart = null;
|
|
111153
111241
|
}
|
|
111154
|
-
|
|
111242
|
+
open2.clear();
|
|
111155
111243
|
}
|
|
111156
111244
|
}
|
|
111157
111245
|
function ms() {
|
|
111158
111246
|
const nowVal = now();
|
|
111159
|
-
if (
|
|
111247
|
+
if (open2.size > 0 && segmentStart !== null) {
|
|
111160
111248
|
return total + (nowVal - segmentStart);
|
|
111161
111249
|
}
|
|
111162
111250
|
return total;
|
|
@@ -121776,6 +121864,202 @@ function assertToolContractCoverage(publicNames, registry3, schemaMap, toolMap)
|
|
|
121776
121864
|
}
|
|
121777
121865
|
}
|
|
121778
121866
|
|
|
121867
|
+
// src/stdio-owned-transport.ts
|
|
121868
|
+
var import_node_async_hooks = require("node:async_hooks");
|
|
121869
|
+
var import_node_events9 = require("node:events");
|
|
121870
|
+
var import_node_fs35 = require("node:fs");
|
|
121871
|
+
var import_promises25 = require("node:fs/promises");
|
|
121872
|
+
var TOKEN_LIMIT = 32 * 1024;
|
|
121873
|
+
var LOGICAL_LIMIT = 20;
|
|
121874
|
+
var HTTP_METHODS = ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"];
|
|
121875
|
+
var StdioLocalError = class extends Error {
|
|
121876
|
+
};
|
|
121877
|
+
function parseUrl(value) {
|
|
121878
|
+
try {
|
|
121879
|
+
return new URL(value);
|
|
121880
|
+
} catch {
|
|
121881
|
+
throw new StdioLocalError("STDIO_UNSUPPORTED_REQUEST");
|
|
121882
|
+
}
|
|
121883
|
+
}
|
|
121884
|
+
async function readCredential(path40) {
|
|
121885
|
+
if (process.platform === "win32") throw new StdioLocalError("STDIO_CREDENTIAL_FILE_PLATFORM_UNVERIFIED");
|
|
121886
|
+
const handle = await (0, import_promises25.open)(path40, import_node_fs35.constants.O_RDONLY | import_node_fs35.constants.O_NONBLOCK);
|
|
121887
|
+
try {
|
|
121888
|
+
if (!(await handle.stat()).isFile()) throw new StdioLocalError("STDIO_CREDENTIAL_NOT_REGULAR");
|
|
121889
|
+
const bytes3 = Buffer.alloc(TOKEN_LIMIT + 1);
|
|
121890
|
+
let count2 = 0;
|
|
121891
|
+
while (count2 < bytes3.length) {
|
|
121892
|
+
const result = await handle.read(bytes3, count2, bytes3.length - count2);
|
|
121893
|
+
if (result.bytesRead === 0) break;
|
|
121894
|
+
count2 += result.bytesRead;
|
|
121895
|
+
}
|
|
121896
|
+
if (count2 > TOKEN_LIMIT) throw new StdioLocalError("STDIO_CREDENTIAL_TOO_LARGE");
|
|
121897
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes3.subarray(0, count2)).trim() || void 0;
|
|
121898
|
+
} finally {
|
|
121899
|
+
await handle.close();
|
|
121900
|
+
}
|
|
121901
|
+
}
|
|
121902
|
+
async function resolveBearer(explicitToken) {
|
|
121903
|
+
const file2 = process.env.MRRLIN_EXECUTOR_BEARER_FILE;
|
|
121904
|
+
if (isExecutorThread() && (file2 || process.env.MRRLIN_EXECUTOR_RUN_ID || process.env.MRRLIN_EXECUTOR_LEASE_ID || process.env.MRRLIN_F54_PROGRESS_LEASE === "1")) {
|
|
121905
|
+
if (!file2) throw new StdioLocalError("STDIO_EXECUTOR_CREDENTIAL_UNAVAILABLE");
|
|
121906
|
+
const token = await readCredential(file2);
|
|
121907
|
+
if (!token?.startsWith("mrrlin_executor_v1.")) throw new StdioLocalError("STDIO_EXECUTOR_CREDENTIAL_UNAVAILABLE");
|
|
121908
|
+
return { token, executor: true };
|
|
121909
|
+
}
|
|
121910
|
+
const configured = explicitToken ?? process.env.MRRLIN_TOKEN;
|
|
121911
|
+
if (configured !== void 0) return { token: configured };
|
|
121912
|
+
try {
|
|
121913
|
+
return { token: await readCredential(operatorTokenPath()) };
|
|
121914
|
+
} catch (error51) {
|
|
121915
|
+
if (error51?.code === "ENOENT") return {};
|
|
121916
|
+
throw error51;
|
|
121917
|
+
}
|
|
121918
|
+
}
|
|
121919
|
+
async function untilCanceled(pending, signal) {
|
|
121920
|
+
if (signal.aborted) {
|
|
121921
|
+
void pending.catch(() => {
|
|
121922
|
+
});
|
|
121923
|
+
signal.throwIfAborted();
|
|
121924
|
+
}
|
|
121925
|
+
let subscription;
|
|
121926
|
+
try {
|
|
121927
|
+
return await Promise.race([pending, new Promise((_, reject) => {
|
|
121928
|
+
subscription = (0, import_node_events9.addAbortListener)(signal, () => reject(signal.reason));
|
|
121929
|
+
})]);
|
|
121930
|
+
} finally {
|
|
121931
|
+
subscription?.[Symbol.dispose]();
|
|
121932
|
+
}
|
|
121933
|
+
}
|
|
121934
|
+
function boundedResponse(response, relativePath) {
|
|
121935
|
+
if (!response.body) return response;
|
|
121936
|
+
const artifact = /^\/projects\/[^/]+\/artifact-files\/[^/]+\/content$/u.test(relativePath);
|
|
121937
|
+
const limit = !response.ok ? 64 * 1024 : artifact ? MRRLIN_ARTIFACT_INLINE_MAX_BYTES : 8 * 1024 * 1024;
|
|
121938
|
+
let size = 0;
|
|
121939
|
+
const body = response.body.pipeThrough(new TransformStream({
|
|
121940
|
+
transform(chunk, controller) {
|
|
121941
|
+
size += chunk.byteLength;
|
|
121942
|
+
if (size > limit) throw new MrrlinResponseTooLargeError(limit);
|
|
121943
|
+
controller.enqueue(chunk);
|
|
121944
|
+
}
|
|
121945
|
+
}));
|
|
121946
|
+
const bounded = new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers });
|
|
121947
|
+
return new Proxy(bounded, {
|
|
121948
|
+
get(target, key) {
|
|
121949
|
+
if (key === "url") return response.url;
|
|
121950
|
+
const value = Reflect.get(target, key, target);
|
|
121951
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
121952
|
+
}
|
|
121953
|
+
});
|
|
121954
|
+
}
|
|
121955
|
+
function createStdioOwnedTransport(options, dependencies = {}) {
|
|
121956
|
+
const base = parseUrl(options.apiBaseUrl);
|
|
121957
|
+
if (!["http:", "https:"].includes(base.protocol) || base.username || base.password || base.hash || base.search) {
|
|
121958
|
+
throw new StdioLocalError("STDIO_INVALID_API_BASE");
|
|
121959
|
+
}
|
|
121960
|
+
const prefix = base.pathname.replace(/\/$/u, "");
|
|
121961
|
+
const generations = new BridgeGenerationManager(base.origin, { ownedOrdinary: true });
|
|
121962
|
+
const scope = new BridgeOperationScope(generations);
|
|
121963
|
+
const attempts = new BridgeHttpAdmission({ limits: {
|
|
121964
|
+
ordinary: { active: 4, waiting: 16 },
|
|
121965
|
+
heartbeat: { active: 1, waiting: 0 },
|
|
121966
|
+
scheduler: { active: 1, waiting: 0 },
|
|
121967
|
+
refresh: { active: 1, waiting: 0 }
|
|
121968
|
+
} });
|
|
121969
|
+
const stream = createOwnedStreamingFetch(scope, base.origin);
|
|
121970
|
+
const shutdown = new AbortController();
|
|
121971
|
+
const invocations = new import_node_async_hooks.AsyncLocalStorage();
|
|
121972
|
+
const readBearer = dependencies.readBearer ?? resolveBearer;
|
|
121973
|
+
let logical = 0;
|
|
121974
|
+
generations.start();
|
|
121975
|
+
const createOperation = () => {
|
|
121976
|
+
if (shutdown.signal.aborted) throw new StdioLocalError("STDIO_TRANSPORT_CLOSED");
|
|
121977
|
+
const invocation = invocations.getStore();
|
|
121978
|
+
invocation?.throwIfAborted();
|
|
121979
|
+
if (logical >= LOGICAL_LIMIT) throw new StdioLocalError("STDIO_LOGICAL_OVERLOAD");
|
|
121980
|
+
logical++;
|
|
121981
|
+
const timeoutMs = dependencies.timeoutMs ?? DEFAULT_OPERATION_TIMEOUT_MS;
|
|
121982
|
+
const deadlineAt = performance.now() + timeoutMs;
|
|
121983
|
+
const deadlineSignal = AbortSignal.timeout(timeoutMs);
|
|
121984
|
+
const signals = invocation ? [deadlineSignal, shutdown.signal, invocation] : [deadlineSignal, shutdown.signal];
|
|
121985
|
+
const signal = AbortSignal.any(signals);
|
|
121986
|
+
let closed = false;
|
|
121987
|
+
return {
|
|
121988
|
+
signal,
|
|
121989
|
+
deadlineAt,
|
|
121990
|
+
deadlineSignal,
|
|
121991
|
+
close() {
|
|
121992
|
+
if (!closed) {
|
|
121993
|
+
closed = true;
|
|
121994
|
+
logical--;
|
|
121995
|
+
}
|
|
121996
|
+
},
|
|
121997
|
+
shouldRetryError: (error51) => !(error51 instanceof StdioLocalError || error51 instanceof BridgeAdmissionError),
|
|
121998
|
+
fetch: async (input, init) => {
|
|
121999
|
+
if (typeof input !== "string") throw new StdioLocalError("STDIO_UNSUPPORTED_REQUEST");
|
|
122000
|
+
const url2 = parseUrl(input);
|
|
122001
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
122002
|
+
const body = init?.body;
|
|
122003
|
+
if (url2.origin !== base.origin || url2.username || url2.password || url2.hash || !url2.pathname.startsWith(prefix + "/") || /%2f|%5c/iu.test(url2.pathname) || !HTTP_METHODS.includes(method) || body != null && (!(typeof body === "string" || body instanceof Uint8Array) || method === "GET" || method === "HEAD")) {
|
|
122004
|
+
throw new StdioLocalError("STDIO_UNSUPPORTED_REQUEST");
|
|
122005
|
+
}
|
|
122006
|
+
const attemptSignal = init?.signal ? AbortSignal.any([init.signal, signal]) : signal;
|
|
122007
|
+
const admission = attempts.acquire("ordinary", { signal: attemptSignal, deadline: deadlineAt });
|
|
122008
|
+
if (dependencies.onAttemptQueued) {
|
|
122009
|
+
const { waiting } = attempts.counts("ordinary");
|
|
122010
|
+
if (waiting > 0) dependencies.onAttemptQueued(waiting);
|
|
122011
|
+
}
|
|
122012
|
+
const permit = await admission;
|
|
122013
|
+
const pending = (async () => {
|
|
122014
|
+
let dispatched = false;
|
|
122015
|
+
try {
|
|
122016
|
+
attemptSignal.throwIfAborted();
|
|
122017
|
+
const headers = new Headers(init?.headers);
|
|
122018
|
+
try {
|
|
122019
|
+
const { token, executor } = await readBearer(options.token);
|
|
122020
|
+
if (token && (executor || !headers.has("authorization"))) headers.set("authorization", "Bearer " + token);
|
|
122021
|
+
} catch {
|
|
122022
|
+
throw new StdioLocalError("STDIO_CREDENTIAL_UNAVAILABLE");
|
|
122023
|
+
}
|
|
122024
|
+
attemptSignal.throwIfAborted();
|
|
122025
|
+
if (performance.now() >= deadlineAt) throw new DOMException("Request expired", "AbortError");
|
|
122026
|
+
dispatched = true;
|
|
122027
|
+
const response = await stream({
|
|
122028
|
+
url: url2.href,
|
|
122029
|
+
method,
|
|
122030
|
+
body: body ?? void 0,
|
|
122031
|
+
headers: Object.fromEntries(headers),
|
|
122032
|
+
deadlineAt,
|
|
122033
|
+
deadlineSignal,
|
|
122034
|
+
signal: attemptSignal,
|
|
122035
|
+
rotateOnHeaderTimeout: generations,
|
|
122036
|
+
onReleased: permit.release,
|
|
122037
|
+
onGeneration: dependencies.onGeneration,
|
|
122038
|
+
rejectRedirect: () => new StdioLocalError("STDIO_REDIRECT_REFUSED")
|
|
122039
|
+
});
|
|
122040
|
+
return boundedResponse(response, url2.pathname.slice(prefix.length));
|
|
122041
|
+
} finally {
|
|
122042
|
+
if (!dispatched) permit.release();
|
|
122043
|
+
}
|
|
122044
|
+
})();
|
|
122045
|
+
return untilCanceled(pending, attemptSignal);
|
|
122046
|
+
}
|
|
122047
|
+
};
|
|
122048
|
+
};
|
|
122049
|
+
return {
|
|
122050
|
+
createOperation,
|
|
122051
|
+
runInvocation(signal, invoke2) {
|
|
122052
|
+
return invocations.run(signal, invoke2);
|
|
122053
|
+
},
|
|
122054
|
+
dispose() {
|
|
122055
|
+
shutdown.abort(new DOMException("Stdio transport closed", "AbortError"));
|
|
122056
|
+
attempts.dispose();
|
|
122057
|
+
scope.dispose();
|
|
122058
|
+
return generations.dispose();
|
|
122059
|
+
}
|
|
122060
|
+
};
|
|
122061
|
+
}
|
|
122062
|
+
|
|
121779
122063
|
// src/server.ts
|
|
121780
122064
|
function redactUrlForLog(value) {
|
|
121781
122065
|
try {
|
|
@@ -121790,6 +122074,7 @@ function resolveServerOptions(input = {}) {
|
|
|
121790
122074
|
return {
|
|
121791
122075
|
apiBaseUrl,
|
|
121792
122076
|
fetch: input.fetch,
|
|
122077
|
+
createOperation: input.createOperation,
|
|
121793
122078
|
dispatchExecutionRun: input.dispatchExecutionRun,
|
|
121794
122079
|
remoteAllowed: true,
|
|
121795
122080
|
// Deliberately do NOT bake process.env.MRRLIN_TOKEN in here: withAuth (tools.ts) resolves
|
|
@@ -121885,7 +122170,7 @@ function zodInputToJsonSchema(schema) {
|
|
|
121885
122170
|
}
|
|
121886
122171
|
return { properties, required: required2, type: "object" };
|
|
121887
122172
|
}
|
|
121888
|
-
function createMrrlinMcpServer(options = {}) {
|
|
122173
|
+
function createMrrlinMcpServer(options = {}, owned) {
|
|
121889
122174
|
const resolved = resolveServerOptions(options);
|
|
121890
122175
|
const tools = createMrrlinTools(resolved);
|
|
121891
122176
|
assertToolContractCoverage(
|
|
@@ -121906,7 +122191,7 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
121906
122191
|
name: tool.name
|
|
121907
122192
|
}))
|
|
121908
122193
|
}));
|
|
121909
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
122194
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, { signal }) => {
|
|
121910
122195
|
const name = request.params.name;
|
|
121911
122196
|
const tool = tools[name];
|
|
121912
122197
|
if (!Object.prototype.hasOwnProperty.call(tools, name) || !tool) {
|
|
@@ -121927,7 +122212,8 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
121927
122212
|
message: parsed.error.message
|
|
121928
122213
|
});
|
|
121929
122214
|
}
|
|
121930
|
-
|
|
122215
|
+
const invoke2 = () => tool.invoke(parsed.data);
|
|
122216
|
+
return owned ? owned.runInvocation(signal, invoke2) : invoke2();
|
|
121931
122217
|
});
|
|
121932
122218
|
return { resolved, server };
|
|
121933
122219
|
}
|
|
@@ -121958,13 +122244,48 @@ async function startStdioServer(options = {}) {
|
|
|
121958
122244
|
);
|
|
121959
122245
|
}
|
|
121960
122246
|
}
|
|
121961
|
-
const
|
|
121962
|
-
const
|
|
121963
|
-
|
|
121964
|
-
|
|
122247
|
+
const resolvedOptions = resolveServerOptions(effective);
|
|
122248
|
+
const owned = process.env.MRRLIN_MCP_STDIO_OWNED_HTTP === "1" && !effective.fetch && !effective.createOperation ? createStdioOwnedTransport(resolvedOptions) : void 0;
|
|
122249
|
+
try {
|
|
122250
|
+
const { resolved, server } = createMrrlinMcpServer({ ...effective, createOperation: owned?.createOperation ?? effective.createOperation }, owned);
|
|
122251
|
+
const transport = new StdioServerTransport();
|
|
122252
|
+
if (owned) {
|
|
122253
|
+
const close = () => {
|
|
122254
|
+
process.stdin.removeListener("end", terminate);
|
|
122255
|
+
process.stdin.removeListener("close", terminate);
|
|
122256
|
+
process.removeListener("SIGINT", terminate);
|
|
122257
|
+
process.removeListener("SIGTERM", terminate);
|
|
122258
|
+
return owned.dispose();
|
|
122259
|
+
};
|
|
122260
|
+
const terminate = () => {
|
|
122261
|
+
void close();
|
|
122262
|
+
void server.close().catch(() => {
|
|
122263
|
+
});
|
|
122264
|
+
};
|
|
122265
|
+
server.onclose = () => {
|
|
122266
|
+
void close();
|
|
122267
|
+
};
|
|
122268
|
+
process.stdin.once("end", terminate);
|
|
122269
|
+
process.stdin.once("close", terminate);
|
|
122270
|
+
process.once("SIGINT", terminate);
|
|
122271
|
+
process.once("SIGTERM", terminate);
|
|
122272
|
+
try {
|
|
122273
|
+
await server.connect(transport);
|
|
122274
|
+
} catch (error51) {
|
|
122275
|
+
await close();
|
|
122276
|
+
throw error51;
|
|
122277
|
+
}
|
|
122278
|
+
} else {
|
|
122279
|
+
await server.connect(transport);
|
|
122280
|
+
}
|
|
122281
|
+
process.stderr.write(
|
|
122282
|
+
`[mrrlin-mcp] starting stdio server against ${redactUrlForLog(resolved.apiBaseUrl)} (remote_allowed=${resolved.remoteAllowed}, owned_http=${Boolean(owned)})
|
|
121965
122283
|
`
|
|
121966
|
-
|
|
121967
|
-
|
|
122284
|
+
);
|
|
122285
|
+
} catch (error51) {
|
|
122286
|
+
await owned?.dispose();
|
|
122287
|
+
throw error51;
|
|
122288
|
+
}
|
|
121968
122289
|
}
|
|
121969
122290
|
|
|
121970
122291
|
// src/set-credential.ts
|
|
@@ -121982,7 +122303,7 @@ function runSetCredential(args) {
|
|
|
121982
122303
|
|
|
121983
122304
|
// src/install-service.ts
|
|
121984
122305
|
var import_node_os26 = __toESM(require("node:os"), 1);
|
|
121985
|
-
var
|
|
122306
|
+
var import_node_fs36 = require("node:fs");
|
|
121986
122307
|
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
121987
122308
|
function parseEnvLine(line, env) {
|
|
121988
122309
|
const trimmed = line.trim();
|
|
@@ -122419,7 +122740,7 @@ function performConfigBackup(deps, ecoPath, existingText) {
|
|
|
122419
122740
|
var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
|
|
122420
122741
|
function defaultHomeOwnerUid(home) {
|
|
122421
122742
|
try {
|
|
122422
|
-
return (0,
|
|
122743
|
+
return (0, import_node_fs36.statSync)(home).uid;
|
|
122423
122744
|
} catch {
|
|
122424
122745
|
return null;
|
|
122425
122746
|
}
|
|
@@ -122567,7 +122888,7 @@ function uninstallService(deps) {
|
|
|
122567
122888
|
}
|
|
122568
122889
|
|
|
122569
122890
|
// src/uninstall-codex.ts
|
|
122570
|
-
var
|
|
122891
|
+
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
122571
122892
|
var import_node_os27 = __toESM(require("node:os"), 1);
|
|
122572
122893
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
122573
122894
|
var toml6 = __toESM(require_toml(), 1);
|
|
@@ -122579,7 +122900,7 @@ function resolveCodexHome3(options) {
|
|
|
122579
122900
|
}
|
|
122580
122901
|
async function pathExists6(target) {
|
|
122581
122902
|
try {
|
|
122582
|
-
await
|
|
122903
|
+
await import_promises26.default.access(target);
|
|
122583
122904
|
return true;
|
|
122584
122905
|
} catch {
|
|
122585
122906
|
return false;
|
|
@@ -122593,8 +122914,8 @@ async function uninstallCodex(options = {}) {
|
|
|
122593
122914
|
if (!await pathExists6(configPath)) {
|
|
122594
122915
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
122595
122916
|
}
|
|
122596
|
-
const realPath = await
|
|
122597
|
-
const existing = await
|
|
122917
|
+
const realPath = await import_promises26.default.realpath(configPath).catch(() => configPath);
|
|
122918
|
+
const existing = await import_promises26.default.readFile(realPath, "utf8");
|
|
122598
122919
|
let parsed = null;
|
|
122599
122920
|
try {
|
|
122600
122921
|
parsed = toml6.parse(existing);
|
|
@@ -122611,7 +122932,7 @@ async function uninstallCodex(options = {}) {
|
|
|
122611
122932
|
return { action: "noop", configPath: realPath, prompts: await removePrompts() };
|
|
122612
122933
|
}
|
|
122613
122934
|
const stripped = existing.replace(MRRLIN_BLOCK_RE, (match) => match.startsWith("\n") ? "\n" : "").replace(/\n{3,}/g, "\n\n").replace(/^\n+/, "");
|
|
122614
|
-
await
|
|
122935
|
+
await import_promises26.default.writeFile(realPath, stripped, { mode: 384 });
|
|
122615
122936
|
return { action: "removed", configPath: realPath, prompts: await removePrompts() };
|
|
122616
122937
|
}
|
|
122617
122938
|
async function uninstallPrompts(codexHome, names) {
|
|
@@ -122621,7 +122942,7 @@ async function uninstallPrompts(codexHome, names) {
|
|
|
122621
122942
|
for (const name of names) {
|
|
122622
122943
|
const promptPath = import_node_path51.default.join(promptsDir, `${name}.md`);
|
|
122623
122944
|
try {
|
|
122624
|
-
await
|
|
122945
|
+
await import_promises26.default.unlink(promptPath);
|
|
122625
122946
|
out.push({ name, action: "removed", promptPath });
|
|
122626
122947
|
} catch (error51) {
|
|
122627
122948
|
const code = error51?.code;
|
|
@@ -122799,21 +123120,21 @@ async function runConnect(argv, deps) {
|
|
|
122799
123120
|
}
|
|
122800
123121
|
|
|
122801
123122
|
// src/doctor.ts
|
|
122802
|
-
var
|
|
123123
|
+
var import_node_fs37 = require("node:fs");
|
|
122803
123124
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
122804
123125
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
122805
123126
|
var ISO_TS = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
|
|
122806
123127
|
var defaultLogFs = {
|
|
122807
123128
|
listDir: (dir) => {
|
|
122808
123129
|
try {
|
|
122809
|
-
return (0,
|
|
123130
|
+
return (0, import_node_fs37.readdirSync)(dir);
|
|
122810
123131
|
} catch {
|
|
122811
123132
|
return null;
|
|
122812
123133
|
}
|
|
122813
123134
|
},
|
|
122814
123135
|
readFile: (p) => {
|
|
122815
123136
|
try {
|
|
122816
|
-
return (0,
|
|
123137
|
+
return (0, import_node_fs37.readFileSync)(p, "utf8");
|
|
122817
123138
|
} catch {
|
|
122818
123139
|
return null;
|
|
122819
123140
|
}
|
|
@@ -123101,7 +123422,7 @@ function removeBridgeLaunchAgent(deps) {
|
|
|
123101
123422
|
}
|
|
123102
123423
|
|
|
123103
123424
|
// src/extract/command.ts
|
|
123104
|
-
var
|
|
123425
|
+
var import_promises27 = require("node:fs/promises");
|
|
123105
123426
|
var import_node_path54 = require("node:path");
|
|
123106
123427
|
function parseArgs(args) {
|
|
123107
123428
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -123142,7 +123463,7 @@ Missing required flag(s): ${missing.join(
|
|
|
123142
123463
|
const logPath = (0, import_node_path54.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
|
|
123143
123464
|
let raw;
|
|
123144
123465
|
try {
|
|
123145
|
-
raw = await (0,
|
|
123466
|
+
raw = await (0, import_promises27.readFile)(logPath, "utf8");
|
|
123146
123467
|
} catch {
|
|
123147
123468
|
continue;
|
|
123148
123469
|
}
|
|
@@ -123176,7 +123497,7 @@ Missing required flag(s): ${missing.join(
|
|
|
123176
123497
|
}
|
|
123177
123498
|
const outputText = cappedLines.join("\n");
|
|
123178
123499
|
if (outPath) {
|
|
123179
|
-
await (0,
|
|
123500
|
+
await (0, import_promises27.writeFile)(outPath, outputText, "utf8");
|
|
123180
123501
|
return {
|
|
123181
123502
|
ok: true,
|
|
123182
123503
|
message: `Wrote extract to ${outPath}`,
|
|
@@ -123236,7 +123557,7 @@ function augmentProcessPathWithCommonDirs() {
|
|
|
123236
123557
|
];
|
|
123237
123558
|
const existing = (process.env.PATH || "").split(import_node_path56.default.delimiter).filter(Boolean);
|
|
123238
123559
|
const existingSet = new Set(existing);
|
|
123239
|
-
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0,
|
|
123560
|
+
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs38.existsSync)(d));
|
|
123240
123561
|
if (toAdd.length > 0) {
|
|
123241
123562
|
process.env.PATH = [...existing, ...toAdd].join(import_node_path56.default.delimiter);
|
|
123242
123563
|
}
|
|
@@ -123266,7 +123587,7 @@ function bootHookStatus() {
|
|
|
123266
123587
|
for (const candidate of candidates) {
|
|
123267
123588
|
const printed = (0, import_node_child_process30.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
123268
123589
|
if (printed.status !== 0) continue;
|
|
123269
|
-
if (!(0,
|
|
123590
|
+
if (!(0, import_node_fs38.existsSync)(candidate.plist)) continue;
|
|
123270
123591
|
const out = printed.stdout ?? "";
|
|
123271
123592
|
const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
|
|
123272
123593
|
const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
|
|
@@ -123284,14 +123605,14 @@ function realLaunchAgentDeps() {
|
|
|
123284
123605
|
pm2Path: whichBin("pm2") ?? "pm2",
|
|
123285
123606
|
nodeDir: import_node_path56.default.dirname(process.execPath),
|
|
123286
123607
|
mkdirp: (dir) => {
|
|
123287
|
-
(0,
|
|
123608
|
+
(0, import_node_fs38.mkdirSync)(dir, { recursive: true });
|
|
123288
123609
|
},
|
|
123289
123610
|
writeFile: (p, c, mode) => {
|
|
123290
|
-
(0,
|
|
123291
|
-
(0,
|
|
123292
|
-
(0,
|
|
123611
|
+
(0, import_node_fs38.mkdirSync)(import_node_path56.default.join(process.env.HOME ?? (0, import_node_os28.homedir)(), ".mrrlin", "director-bridge"), { recursive: true, mode: 448 });
|
|
123612
|
+
(0, import_node_fs38.writeFileSync)(p, c, { mode });
|
|
123613
|
+
(0, import_node_fs38.chmodSync)(p, mode);
|
|
123293
123614
|
},
|
|
123294
|
-
removeFile: (p) => (0,
|
|
123615
|
+
removeFile: (p) => (0, import_node_fs38.rmSync)(p, { force: true }),
|
|
123295
123616
|
launchctl: (args) => ({ status: (0, import_node_child_process30.spawnSync)("launchctl", args, { encoding: "utf8" }).status })
|
|
123296
123617
|
};
|
|
123297
123618
|
}
|
|
@@ -123402,7 +123723,7 @@ function realDoctorDeps() {
|
|
|
123402
123723
|
verifyReadiness: (provider) => verifyProviderReadiness(provider, runnerFor(provider)),
|
|
123403
123724
|
readFile: (p) => {
|
|
123404
123725
|
try {
|
|
123405
|
-
return (0,
|
|
123726
|
+
return (0, import_node_fs38.readFileSync)(p, "utf8");
|
|
123406
123727
|
} catch {
|
|
123407
123728
|
return null;
|
|
123408
123729
|
}
|
|
@@ -123688,7 +124009,7 @@ async function main() {
|
|
|
123688
124009
|
}
|
|
123689
124010
|
try {
|
|
123690
124011
|
const codexHome = process.env.CODEX_HOME ?? import_node_path56.default.join(process.env.HOME ?? (0, import_node_os28.homedir)(), ".codex");
|
|
123691
|
-
(0,
|
|
124012
|
+
(0, import_node_fs38.rmSync)(import_node_path56.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
123692
124013
|
} catch {
|
|
123693
124014
|
}
|
|
123694
124015
|
const claudeResult = await installClaude({ binPath, force, serveEnv });
|
|
@@ -123766,13 +124087,13 @@ async function main() {
|
|
|
123766
124087
|
env: process.env,
|
|
123767
124088
|
cwd: process.cwd(),
|
|
123768
124089
|
writeFile: (p, c) => {
|
|
123769
|
-
(0,
|
|
123770
|
-
(0,
|
|
124090
|
+
(0, import_node_fs38.mkdirSync)(import_node_path56.default.dirname(p), { recursive: true, mode: 448 });
|
|
124091
|
+
(0, import_node_fs38.writeFileSync)(p, c, { mode: 384 });
|
|
123771
124092
|
},
|
|
123772
|
-
writeExclusiveFile: (p, c) => (0,
|
|
124093
|
+
writeExclusiveFile: (p, c) => (0, import_node_fs38.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
|
|
123773
124094
|
listDir: (p) => {
|
|
123774
124095
|
try {
|
|
123775
|
-
return (0,
|
|
124096
|
+
return (0, import_node_fs38.readdirSync)(p);
|
|
123776
124097
|
} catch {
|
|
123777
124098
|
return null;
|
|
123778
124099
|
}
|
|
@@ -123783,7 +124104,7 @@ async function main() {
|
|
|
123783
124104
|
// value", never a failed install. See readExistingTelemetryDefaultProject.
|
|
123784
124105
|
readFile: (p) => {
|
|
123785
124106
|
try {
|
|
123786
|
-
return (0,
|
|
124107
|
+
return (0, import_node_fs38.readFileSync)(p, "utf8");
|
|
123787
124108
|
} catch {
|
|
123788
124109
|
return null;
|
|
123789
124110
|
}
|
|
@@ -123804,7 +124125,7 @@ async function main() {
|
|
|
123804
124125
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
123805
124126
|
removeFile: (p) => {
|
|
123806
124127
|
try {
|
|
123807
|
-
(0,
|
|
124128
|
+
(0, import_node_fs38.rmSync)(p, { force: true });
|
|
123808
124129
|
} catch {
|
|
123809
124130
|
}
|
|
123810
124131
|
},
|
|
@@ -123826,7 +124147,7 @@ async function main() {
|
|
|
123826
124147
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
123827
124148
|
removeFile: (p) => {
|
|
123828
124149
|
try {
|
|
123829
|
-
(0,
|
|
124150
|
+
(0, import_node_fs38.rmSync)(p, { force: true });
|
|
123830
124151
|
} catch {
|
|
123831
124152
|
}
|
|
123832
124153
|
},
|
|
@@ -123853,7 +124174,7 @@ async function main() {
|
|
|
123853
124174
|
log2(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
123854
124175
|
}
|
|
123855
124176
|
try {
|
|
123856
|
-
(0,
|
|
124177
|
+
(0, import_node_fs38.rmSync)(import_node_path56.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
123857
124178
|
} catch {
|
|
123858
124179
|
}
|
|
123859
124180
|
log2("removed ~/.mrrlin");
|