@mrrlin-dev/mcp 0.4.215 → 0.4.217
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 +619 -332
- 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
|
|
|
@@ -69071,7 +69071,7 @@ function createMrrlinClient(config2) {
|
|
|
69071
69071
|
const signals = [callerSignal, operationSignal].filter((value) => Boolean(value));
|
|
69072
69072
|
return { operation, signal: signals.length ? AbortSignal.any(signals) : void 0 };
|
|
69073
69073
|
}
|
|
69074
|
-
async function executeFetch(path40, init, { operation, signal }
|
|
69074
|
+
async function executeFetch(path40, init, { operation, signal }) {
|
|
69075
69075
|
const method = (init?.method ?? "GET").toUpperCase();
|
|
69076
69076
|
if (signal?.aborted)
|
|
69077
69077
|
throw new DOMException("The user aborted a request.", "AbortError");
|
|
@@ -69109,7 +69109,7 @@ function createMrrlinClient(config2) {
|
|
|
69109
69109
|
}
|
|
69110
69110
|
return response;
|
|
69111
69111
|
} catch (err) {
|
|
69112
|
-
if (signal?.aborted || err?.name === "AbortError") {
|
|
69112
|
+
if (signal?.aborted || err?.name === "AbortError" || operation?.shouldRetryError?.(err) === false) {
|
|
69113
69113
|
throw err;
|
|
69114
69114
|
}
|
|
69115
69115
|
if (isIdempotent && attempt < maxAttempts - 1) {
|
|
@@ -69122,8 +69122,24 @@ function createMrrlinClient(config2) {
|
|
|
69122
69122
|
}
|
|
69123
69123
|
throw new Error(`Failed to execute ${method} ${path40}`);
|
|
69124
69124
|
}
|
|
69125
|
-
|
|
69126
|
-
|
|
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);
|
|
69127
69143
|
}
|
|
69128
69144
|
function throwResponseError(response, method, path40, body) {
|
|
69129
69145
|
let code = `HTTP_${response.status}`;
|
|
@@ -69163,8 +69179,12 @@ function createMrrlinClient(config2) {
|
|
|
69163
69179
|
const scope = createFetchScope(callerSignal);
|
|
69164
69180
|
const signal = scope.signal ?? callerSignal;
|
|
69165
69181
|
const operationDeadlineAt = scope.operation?.deadlineAt ?? Number.POSITIVE_INFINITY;
|
|
69166
|
-
const expired = () =>
|
|
69167
|
-
|
|
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
|
+
};
|
|
69168
69188
|
const pending = executeFetch(path40, init, scope);
|
|
69169
69189
|
void pending.then((response) => {
|
|
69170
69190
|
if (signal.aborted)
|
|
@@ -69172,42 +69192,54 @@ function createMrrlinClient(config2) {
|
|
|
69172
69192
|
});
|
|
69173
69193
|
}, () => {
|
|
69174
69194
|
});
|
|
69175
|
-
return { pending: withinBoundedReadDeadline(pending, signal), signal, expired };
|
|
69195
|
+
return { pending: withinBoundedReadDeadline(pending, signal), signal, expired, close: scope.operation?.close };
|
|
69176
69196
|
}
|
|
69177
69197
|
async function requestBoundedJson(path40, maxBytes, caller) {
|
|
69178
|
-
const { pending, signal } = startBoundedGet(path40, caller, { cache: "no-store" });
|
|
69179
|
-
|
|
69180
|
-
|
|
69181
|
-
|
|
69182
|
-
|
|
69183
|
-
|
|
69184
|
-
|
|
69185
|
-
|
|
69186
|
-
|
|
69187
|
-
|
|
69188
|
-
|
|
69189
|
-
|
|
69190
|
-
|
|
69191
|
-
|
|
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?.();
|
|
69192
69219
|
}
|
|
69193
|
-
const bytes3 = await readBoundedBody(response, signal, maxBytes);
|
|
69194
|
-
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes3));
|
|
69195
69220
|
}
|
|
69196
|
-
async function
|
|
69197
|
-
const
|
|
69198
|
-
|
|
69199
|
-
|
|
69200
|
-
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?.();
|
|
69201
69228
|
}
|
|
69202
|
-
return response.json();
|
|
69203
69229
|
}
|
|
69204
|
-
|
|
69205
|
-
|
|
69206
|
-
|
|
69207
|
-
|
|
69208
|
-
|
|
69209
|
-
}
|
|
69210
|
-
|
|
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
|
+
});
|
|
69211
69243
|
}
|
|
69212
69244
|
return {
|
|
69213
69245
|
withExecutionAuthority(runId, leaseId, signal, assertActive) {
|
|
@@ -69395,37 +69427,41 @@ function createMrrlinClient(config2) {
|
|
|
69395
69427
|
const path40 = `${projectPath(projectSlug)}/tasks/${encodeURIComponent(taskId)}`;
|
|
69396
69428
|
if (!options?.boundedResponse)
|
|
69397
69429
|
return taskResponseSchema.parse(await request(path40)).data;
|
|
69398
|
-
const { pending, signal, expired } = startBoundedGet(path40, options.signal);
|
|
69399
|
-
let response;
|
|
69400
|
-
try {
|
|
69401
|
-
response = await pending;
|
|
69402
|
-
} catch (error51) {
|
|
69403
|
-
options.signal?.throwIfAborted();
|
|
69404
|
-
if (expired())
|
|
69405
|
-
throw new DOMException("Bounded read deadline expired", "TimeoutError");
|
|
69406
|
-
throw error51;
|
|
69407
|
-
}
|
|
69408
|
-
const maxBytes = response.ok ? 8 * 1024 * 1024 : 64 * 1024;
|
|
69409
|
-
let body = "";
|
|
69430
|
+
const { pending, signal, expired, close } = startBoundedGet(path40, options.signal);
|
|
69410
69431
|
try {
|
|
69411
|
-
|
|
69412
|
-
|
|
69413
|
-
|
|
69414
|
-
|
|
69415
|
-
|
|
69416
|
-
|
|
69417
|
-
|
|
69418
|
-
|
|
69419
|
-
if (!response.ok && (error51 instanceof MrrlinResponseTooLargeError || timedOut)) {
|
|
69420
|
-
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;
|
|
69421
69440
|
}
|
|
69422
|
-
|
|
69423
|
-
|
|
69424
|
-
|
|
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?.();
|
|
69425
69464
|
}
|
|
69426
|
-
if (!response.ok)
|
|
69427
|
-
throwResponseError(response, "GET", path40, body);
|
|
69428
|
-
return taskResponseSchema.parse(JSON.parse(body)).data;
|
|
69429
69465
|
},
|
|
69430
69466
|
async getTaskBlockerStatusV1(projectSlug, taskIds, options) {
|
|
69431
69467
|
const ids = blockerTaskIdsSchema.parse(taskIds);
|
|
@@ -69444,10 +69480,11 @@ function createMrrlinClient(config2) {
|
|
|
69444
69480
|
},
|
|
69445
69481
|
async getWikiPageLinkedTaskV1(projectSlug, pageId) {
|
|
69446
69482
|
const path40 = `${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}/linked-task/v1`;
|
|
69447
|
-
|
|
69448
|
-
|
|
69449
|
-
|
|
69450
|
-
|
|
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
|
+
});
|
|
69451
69488
|
},
|
|
69452
69489
|
async getWikiPage(projectSlug, pageId) {
|
|
69453
69490
|
const body = await request(`${projectPath(projectSlug)}/wiki/${encodeURIComponent(pageId)}`);
|
|
@@ -72424,14 +72461,14 @@ async function runCodeGate(_target, deps) {
|
|
|
72424
72461
|
return await deps.readReviewArtifact();
|
|
72425
72462
|
}
|
|
72426
72463
|
});
|
|
72427
|
-
const
|
|
72464
|
+
const open2 = result.outcome === "CONVERGED" ? [] : result.unresolved.map(({ category, text }) => ({ category, text }));
|
|
72428
72465
|
return {
|
|
72429
72466
|
outcome: result.outcome,
|
|
72430
72467
|
rounds: result.rounds,
|
|
72431
72468
|
arbiterInfo: result.arbiterInfo,
|
|
72432
72469
|
panelComposition: result.panelComposition,
|
|
72433
72470
|
sufficiencyVerdict: result.sufficiencyVerdict,
|
|
72434
|
-
...
|
|
72471
|
+
...open2.length > 0 ? { unresolved: open2 } : {}
|
|
72435
72472
|
};
|
|
72436
72473
|
} catch (err) {
|
|
72437
72474
|
if (err instanceof CodeGateUnfixableError) {
|
|
@@ -94901,7 +94938,7 @@ async function getAgentProviderForPanel(client, opts = {}) {
|
|
|
94901
94938
|
}
|
|
94902
94939
|
}
|
|
94903
94940
|
function createMrrlinTools(options) {
|
|
94904
|
-
const client = createMrrlinClient(withAuth(options));
|
|
94941
|
+
const client = createMrrlinClient({ ...withAuth(options), createOperation: options.fetch ? void 0 : options.createOperation });
|
|
94905
94942
|
async function resolveBoundSlug() {
|
|
94906
94943
|
if (process.env.MRRLIN_PROJECT_BINDING === "none") return void 0;
|
|
94907
94944
|
if (options.activeProjectSlug !== void 0) return options.activeProjectSlug;
|
|
@@ -97569,101 +97606,118 @@ function createOwnedStreamingFetch(scope, origin) {
|
|
|
97569
97606
|
throw new TypeError("Invalid streaming transport origin");
|
|
97570
97607
|
}
|
|
97571
97608
|
return async (input) => {
|
|
97572
|
-
const { deadlineAt, deadlineSignal, signal, method } = input;
|
|
97573
|
-
const url2 = new URL(input.url);
|
|
97574
|
-
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")) {
|
|
97575
|
-
throw new TypeError("Unsupported streaming request");
|
|
97576
|
-
}
|
|
97577
|
-
const aborted2 = () => new DOMException("Streaming request canceled", "AbortError");
|
|
97578
|
-
const budget = new AbortController();
|
|
97579
|
-
const expire = () => budget.abort(aborted2());
|
|
97580
|
-
const remaining = deadlineAt - performance.now();
|
|
97581
|
-
if (!Number.isFinite(remaining) || remaining <= 0 || remaining > 2147483647 || signal?.aborted) throw aborted2();
|
|
97582
|
-
let onDeadline = expire;
|
|
97583
|
-
const timer = setTimeout(() => onDeadline(), Math.ceil(remaining));
|
|
97584
|
-
let canceledBeforeDeadline = false;
|
|
97585
|
-
const caller = signal ? (0, import_node_events3.addAbortListener)(signal, () => {
|
|
97586
|
-
if (deadlineSignal?.aborted && signal.reason === deadlineSignal.reason) onDeadline();
|
|
97587
|
-
else {
|
|
97588
|
-
canceledBeforeDeadline = performance.now() < deadlineAt;
|
|
97589
|
-
expire();
|
|
97590
|
-
}
|
|
97591
|
-
}) : void 0;
|
|
97592
97609
|
let retained = false;
|
|
97593
|
-
|
|
97594
|
-
|
|
97595
|
-
|
|
97610
|
+
let notified = false;
|
|
97611
|
+
const notifyReleased = () => {
|
|
97612
|
+
if (notified) return;
|
|
97613
|
+
notified = true;
|
|
97614
|
+
input.onReleased?.();
|
|
97596
97615
|
};
|
|
97597
97616
|
try {
|
|
97598
|
-
|
|
97599
|
-
|
|
97600
|
-
|
|
97601
|
-
|
|
97602
|
-
|
|
97603
|
-
|
|
97604
|
-
|
|
97605
|
-
|
|
97606
|
-
|
|
97607
|
-
|
|
97608
|
-
|
|
97609
|
-
|
|
97610
|
-
|
|
97611
|
-
|
|
97612
|
-
|
|
97613
|
-
|
|
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;
|
|
97614
97634
|
expire();
|
|
97615
|
-
slot?.cancel();
|
|
97616
|
-
};
|
|
97617
|
-
const physicalAbort = (0, import_node_events3.addAbortListener)(budget.signal, cancel);
|
|
97618
|
-
void released.then(() => {
|
|
97619
|
-
physicalAbort[Symbol.dispose]();
|
|
97620
|
-
cleanup();
|
|
97621
|
-
});
|
|
97622
|
-
try {
|
|
97623
|
-
operation.retainResource({ deadlineAt, cancel, released });
|
|
97624
|
-
retained = true;
|
|
97625
|
-
budget.signal.throwIfAborted();
|
|
97626
|
-
slot = operation.generation.openOrdinarySlot({
|
|
97627
|
-
deadlineAt,
|
|
97628
|
-
signal: budget.signal,
|
|
97629
|
-
singleHop: true,
|
|
97630
|
-
onPreWrite: () => {
|
|
97631
|
-
waitingForHeaders = true;
|
|
97632
|
-
},
|
|
97633
|
-
onFinalHeaders: () => {
|
|
97634
|
-
waitingForHeaders = false;
|
|
97635
|
-
},
|
|
97636
|
-
onTerminal: () => slot?.close()
|
|
97637
|
-
});
|
|
97638
|
-
} catch (error51) {
|
|
97639
|
-
if (error51 instanceof BridgeSchedulerSlotOpenError) void error51.released.then(done);
|
|
97640
|
-
else done();
|
|
97641
|
-
throw error51;
|
|
97642
97635
|
}
|
|
97643
|
-
|
|
97644
|
-
|
|
97645
|
-
|
|
97646
|
-
|
|
97647
|
-
|
|
97648
|
-
|
|
97649
|
-
|
|
97650
|
-
|
|
97651
|
-
|
|
97652
|
-
|
|
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;
|
|
97653
97647
|
});
|
|
97654
|
-
|
|
97655
|
-
|
|
97656
|
-
|
|
97657
|
-
|
|
97658
|
-
|
|
97659
|
-
|
|
97660
|
-
|
|
97661
|
-
|
|
97662
|
-
|
|
97663
|
-
|
|
97664
|
-
|
|
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
|
+
}
|
|
97665
97719
|
} finally {
|
|
97666
|
-
if (!retained)
|
|
97720
|
+
if (!retained) notifyReleased();
|
|
97667
97721
|
}
|
|
97668
97722
|
};
|
|
97669
97723
|
}
|
|
@@ -99599,7 +99653,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99599
99653
|
}
|
|
99600
99654
|
|
|
99601
99655
|
// src/_generated/version.ts
|
|
99602
|
-
var PKG_VERSION = "0.4.
|
|
99656
|
+
var PKG_VERSION = "0.4.217";
|
|
99603
99657
|
|
|
99604
99658
|
// src/bridge-allowed-origins.ts
|
|
99605
99659
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -108706,7 +108760,7 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
|
|
|
108706
108760
|
failureReason: outcome.kind === "done" ? null : outcome.failureReason
|
|
108707
108761
|
}).catch(() => {
|
|
108708
108762
|
});
|
|
108709
|
-
if (
|
|
108763
|
+
if (!terminalized || shutdown?.aborted) return;
|
|
108710
108764
|
if (descriptor2.appliesIntentVerdict && outcome.kind === "done" && outcome.taskId) {
|
|
108711
108765
|
let rawResult;
|
|
108712
108766
|
try {
|
|
@@ -111155,21 +111209,21 @@ function chatTurnMaxMs() {
|
|
|
111155
111209
|
// src/tool-busy.ts
|
|
111156
111210
|
function createToolBusyClock(opts) {
|
|
111157
111211
|
const now = opts?.now ?? Date.now;
|
|
111158
|
-
const
|
|
111212
|
+
const open2 = /* @__PURE__ */ new Set();
|
|
111159
111213
|
let total = 0;
|
|
111160
111214
|
let segmentStart = null;
|
|
111161
111215
|
function start(itemId) {
|
|
111162
|
-
if (!
|
|
111163
|
-
|
|
111164
|
-
if (
|
|
111216
|
+
if (!open2.has(itemId)) {
|
|
111217
|
+
open2.add(itemId);
|
|
111218
|
+
if (open2.size === 1) {
|
|
111165
111219
|
segmentStart = now();
|
|
111166
111220
|
}
|
|
111167
111221
|
}
|
|
111168
111222
|
}
|
|
111169
111223
|
function end(itemId) {
|
|
111170
|
-
if (
|
|
111171
|
-
|
|
111172
|
-
if (
|
|
111224
|
+
if (open2.has(itemId)) {
|
|
111225
|
+
open2.delete(itemId);
|
|
111226
|
+
if (open2.size === 0) {
|
|
111173
111227
|
const nowVal = now();
|
|
111174
111228
|
if (segmentStart !== null) {
|
|
111175
111229
|
total += nowVal - segmentStart;
|
|
@@ -111179,18 +111233,18 @@ function createToolBusyClock(opts) {
|
|
|
111179
111233
|
}
|
|
111180
111234
|
}
|
|
111181
111235
|
function endAll() {
|
|
111182
|
-
if (
|
|
111236
|
+
if (open2.size > 0) {
|
|
111183
111237
|
const nowVal = now();
|
|
111184
111238
|
if (segmentStart !== null) {
|
|
111185
111239
|
total += nowVal - segmentStart;
|
|
111186
111240
|
segmentStart = null;
|
|
111187
111241
|
}
|
|
111188
|
-
|
|
111242
|
+
open2.clear();
|
|
111189
111243
|
}
|
|
111190
111244
|
}
|
|
111191
111245
|
function ms() {
|
|
111192
111246
|
const nowVal = now();
|
|
111193
|
-
if (
|
|
111247
|
+
if (open2.size > 0 && segmentStart !== null) {
|
|
111194
111248
|
return total + (nowVal - segmentStart);
|
|
111195
111249
|
}
|
|
111196
111250
|
return total;
|
|
@@ -121810,6 +121864,202 @@ function assertToolContractCoverage(publicNames, registry3, schemaMap, toolMap)
|
|
|
121810
121864
|
}
|
|
121811
121865
|
}
|
|
121812
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
|
+
|
|
121813
122063
|
// src/server.ts
|
|
121814
122064
|
function redactUrlForLog(value) {
|
|
121815
122065
|
try {
|
|
@@ -121824,6 +122074,7 @@ function resolveServerOptions(input = {}) {
|
|
|
121824
122074
|
return {
|
|
121825
122075
|
apiBaseUrl,
|
|
121826
122076
|
fetch: input.fetch,
|
|
122077
|
+
createOperation: input.createOperation,
|
|
121827
122078
|
dispatchExecutionRun: input.dispatchExecutionRun,
|
|
121828
122079
|
remoteAllowed: true,
|
|
121829
122080
|
// Deliberately do NOT bake process.env.MRRLIN_TOKEN in here: withAuth (tools.ts) resolves
|
|
@@ -121919,7 +122170,7 @@ function zodInputToJsonSchema(schema) {
|
|
|
121919
122170
|
}
|
|
121920
122171
|
return { properties, required: required2, type: "object" };
|
|
121921
122172
|
}
|
|
121922
|
-
function createMrrlinMcpServer(options = {}) {
|
|
122173
|
+
function createMrrlinMcpServer(options = {}, owned) {
|
|
121923
122174
|
const resolved = resolveServerOptions(options);
|
|
121924
122175
|
const tools = createMrrlinTools(resolved);
|
|
121925
122176
|
assertToolContractCoverage(
|
|
@@ -121940,7 +122191,7 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
121940
122191
|
name: tool.name
|
|
121941
122192
|
}))
|
|
121942
122193
|
}));
|
|
121943
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
122194
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, { signal }) => {
|
|
121944
122195
|
const name = request.params.name;
|
|
121945
122196
|
const tool = tools[name];
|
|
121946
122197
|
if (!Object.prototype.hasOwnProperty.call(tools, name) || !tool) {
|
|
@@ -121961,7 +122212,8 @@ function createMrrlinMcpServer(options = {}) {
|
|
|
121961
122212
|
message: parsed.error.message
|
|
121962
122213
|
});
|
|
121963
122214
|
}
|
|
121964
|
-
|
|
122215
|
+
const invoke2 = () => tool.invoke(parsed.data);
|
|
122216
|
+
return owned ? owned.runInvocation(signal, invoke2) : invoke2();
|
|
121965
122217
|
});
|
|
121966
122218
|
return { resolved, server };
|
|
121967
122219
|
}
|
|
@@ -121992,13 +122244,48 @@ async function startStdioServer(options = {}) {
|
|
|
121992
122244
|
);
|
|
121993
122245
|
}
|
|
121994
122246
|
}
|
|
121995
|
-
const
|
|
121996
|
-
const
|
|
121997
|
-
|
|
121998
|
-
|
|
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)})
|
|
121999
122283
|
`
|
|
122000
|
-
|
|
122001
|
-
|
|
122284
|
+
);
|
|
122285
|
+
} catch (error51) {
|
|
122286
|
+
await owned?.dispose();
|
|
122287
|
+
throw error51;
|
|
122288
|
+
}
|
|
122002
122289
|
}
|
|
122003
122290
|
|
|
122004
122291
|
// src/set-credential.ts
|
|
@@ -122016,7 +122303,7 @@ function runSetCredential(args) {
|
|
|
122016
122303
|
|
|
122017
122304
|
// src/install-service.ts
|
|
122018
122305
|
var import_node_os26 = __toESM(require("node:os"), 1);
|
|
122019
|
-
var
|
|
122306
|
+
var import_node_fs36 = require("node:fs");
|
|
122020
122307
|
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
122021
122308
|
function parseEnvLine(line, env) {
|
|
122022
122309
|
const trimmed = line.trim();
|
|
@@ -122453,7 +122740,7 @@ function performConfigBackup(deps, ecoPath, existingText) {
|
|
|
122453
122740
|
var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
|
|
122454
122741
|
function defaultHomeOwnerUid(home) {
|
|
122455
122742
|
try {
|
|
122456
|
-
return (0,
|
|
122743
|
+
return (0, import_node_fs36.statSync)(home).uid;
|
|
122457
122744
|
} catch {
|
|
122458
122745
|
return null;
|
|
122459
122746
|
}
|
|
@@ -122601,7 +122888,7 @@ function uninstallService(deps) {
|
|
|
122601
122888
|
}
|
|
122602
122889
|
|
|
122603
122890
|
// src/uninstall-codex.ts
|
|
122604
|
-
var
|
|
122891
|
+
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
122605
122892
|
var import_node_os27 = __toESM(require("node:os"), 1);
|
|
122606
122893
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
122607
122894
|
var toml6 = __toESM(require_toml(), 1);
|
|
@@ -122613,7 +122900,7 @@ function resolveCodexHome3(options) {
|
|
|
122613
122900
|
}
|
|
122614
122901
|
async function pathExists6(target) {
|
|
122615
122902
|
try {
|
|
122616
|
-
await
|
|
122903
|
+
await import_promises26.default.access(target);
|
|
122617
122904
|
return true;
|
|
122618
122905
|
} catch {
|
|
122619
122906
|
return false;
|
|
@@ -122627,8 +122914,8 @@ async function uninstallCodex(options = {}) {
|
|
|
122627
122914
|
if (!await pathExists6(configPath)) {
|
|
122628
122915
|
return { action: "missing", configPath, prompts: await removePrompts() };
|
|
122629
122916
|
}
|
|
122630
|
-
const realPath = await
|
|
122631
|
-
const existing = await
|
|
122917
|
+
const realPath = await import_promises26.default.realpath(configPath).catch(() => configPath);
|
|
122918
|
+
const existing = await import_promises26.default.readFile(realPath, "utf8");
|
|
122632
122919
|
let parsed = null;
|
|
122633
122920
|
try {
|
|
122634
122921
|
parsed = toml6.parse(existing);
|
|
@@ -122645,7 +122932,7 @@ async function uninstallCodex(options = {}) {
|
|
|
122645
122932
|
return { action: "noop", configPath: realPath, prompts: await removePrompts() };
|
|
122646
122933
|
}
|
|
122647
122934
|
const stripped = existing.replace(MRRLIN_BLOCK_RE, (match) => match.startsWith("\n") ? "\n" : "").replace(/\n{3,}/g, "\n\n").replace(/^\n+/, "");
|
|
122648
|
-
await
|
|
122935
|
+
await import_promises26.default.writeFile(realPath, stripped, { mode: 384 });
|
|
122649
122936
|
return { action: "removed", configPath: realPath, prompts: await removePrompts() };
|
|
122650
122937
|
}
|
|
122651
122938
|
async function uninstallPrompts(codexHome, names) {
|
|
@@ -122655,7 +122942,7 @@ async function uninstallPrompts(codexHome, names) {
|
|
|
122655
122942
|
for (const name of names) {
|
|
122656
122943
|
const promptPath = import_node_path51.default.join(promptsDir, `${name}.md`);
|
|
122657
122944
|
try {
|
|
122658
|
-
await
|
|
122945
|
+
await import_promises26.default.unlink(promptPath);
|
|
122659
122946
|
out.push({ name, action: "removed", promptPath });
|
|
122660
122947
|
} catch (error51) {
|
|
122661
122948
|
const code = error51?.code;
|
|
@@ -122833,21 +123120,21 @@ async function runConnect(argv, deps) {
|
|
|
122833
123120
|
}
|
|
122834
123121
|
|
|
122835
123122
|
// src/doctor.ts
|
|
122836
|
-
var
|
|
123123
|
+
var import_node_fs37 = require("node:fs");
|
|
122837
123124
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
122838
123125
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
122839
123126
|
var ISO_TS = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
|
|
122840
123127
|
var defaultLogFs = {
|
|
122841
123128
|
listDir: (dir) => {
|
|
122842
123129
|
try {
|
|
122843
|
-
return (0,
|
|
123130
|
+
return (0, import_node_fs37.readdirSync)(dir);
|
|
122844
123131
|
} catch {
|
|
122845
123132
|
return null;
|
|
122846
123133
|
}
|
|
122847
123134
|
},
|
|
122848
123135
|
readFile: (p) => {
|
|
122849
123136
|
try {
|
|
122850
|
-
return (0,
|
|
123137
|
+
return (0, import_node_fs37.readFileSync)(p, "utf8");
|
|
122851
123138
|
} catch {
|
|
122852
123139
|
return null;
|
|
122853
123140
|
}
|
|
@@ -123135,7 +123422,7 @@ function removeBridgeLaunchAgent(deps) {
|
|
|
123135
123422
|
}
|
|
123136
123423
|
|
|
123137
123424
|
// src/extract/command.ts
|
|
123138
|
-
var
|
|
123425
|
+
var import_promises27 = require("node:fs/promises");
|
|
123139
123426
|
var import_node_path54 = require("node:path");
|
|
123140
123427
|
function parseArgs(args) {
|
|
123141
123428
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -123176,7 +123463,7 @@ Missing required flag(s): ${missing.join(
|
|
|
123176
123463
|
const logPath = (0, import_node_path54.join)(deps.stateDir, "logs", `bridge-${day}.jsonl`);
|
|
123177
123464
|
let raw;
|
|
123178
123465
|
try {
|
|
123179
|
-
raw = await (0,
|
|
123466
|
+
raw = await (0, import_promises27.readFile)(logPath, "utf8");
|
|
123180
123467
|
} catch {
|
|
123181
123468
|
continue;
|
|
123182
123469
|
}
|
|
@@ -123210,7 +123497,7 @@ Missing required flag(s): ${missing.join(
|
|
|
123210
123497
|
}
|
|
123211
123498
|
const outputText = cappedLines.join("\n");
|
|
123212
123499
|
if (outPath) {
|
|
123213
|
-
await (0,
|
|
123500
|
+
await (0, import_promises27.writeFile)(outPath, outputText, "utf8");
|
|
123214
123501
|
return {
|
|
123215
123502
|
ok: true,
|
|
123216
123503
|
message: `Wrote extract to ${outPath}`,
|
|
@@ -123270,7 +123557,7 @@ function augmentProcessPathWithCommonDirs() {
|
|
|
123270
123557
|
];
|
|
123271
123558
|
const existing = (process.env.PATH || "").split(import_node_path56.default.delimiter).filter(Boolean);
|
|
123272
123559
|
const existingSet = new Set(existing);
|
|
123273
|
-
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0,
|
|
123560
|
+
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs38.existsSync)(d));
|
|
123274
123561
|
if (toAdd.length > 0) {
|
|
123275
123562
|
process.env.PATH = [...existing, ...toAdd].join(import_node_path56.default.delimiter);
|
|
123276
123563
|
}
|
|
@@ -123300,7 +123587,7 @@ function bootHookStatus() {
|
|
|
123300
123587
|
for (const candidate of candidates) {
|
|
123301
123588
|
const printed = (0, import_node_child_process30.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
123302
123589
|
if (printed.status !== 0) continue;
|
|
123303
|
-
if (!(0,
|
|
123590
|
+
if (!(0, import_node_fs38.existsSync)(candidate.plist)) continue;
|
|
123304
123591
|
const out = printed.stdout ?? "";
|
|
123305
123592
|
const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
|
|
123306
123593
|
const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
|
|
@@ -123318,14 +123605,14 @@ function realLaunchAgentDeps() {
|
|
|
123318
123605
|
pm2Path: whichBin("pm2") ?? "pm2",
|
|
123319
123606
|
nodeDir: import_node_path56.default.dirname(process.execPath),
|
|
123320
123607
|
mkdirp: (dir) => {
|
|
123321
|
-
(0,
|
|
123608
|
+
(0, import_node_fs38.mkdirSync)(dir, { recursive: true });
|
|
123322
123609
|
},
|
|
123323
123610
|
writeFile: (p, c, mode) => {
|
|
123324
|
-
(0,
|
|
123325
|
-
(0,
|
|
123326
|
-
(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);
|
|
123327
123614
|
},
|
|
123328
|
-
removeFile: (p) => (0,
|
|
123615
|
+
removeFile: (p) => (0, import_node_fs38.rmSync)(p, { force: true }),
|
|
123329
123616
|
launchctl: (args) => ({ status: (0, import_node_child_process30.spawnSync)("launchctl", args, { encoding: "utf8" }).status })
|
|
123330
123617
|
};
|
|
123331
123618
|
}
|
|
@@ -123436,7 +123723,7 @@ function realDoctorDeps() {
|
|
|
123436
123723
|
verifyReadiness: (provider) => verifyProviderReadiness(provider, runnerFor(provider)),
|
|
123437
123724
|
readFile: (p) => {
|
|
123438
123725
|
try {
|
|
123439
|
-
return (0,
|
|
123726
|
+
return (0, import_node_fs38.readFileSync)(p, "utf8");
|
|
123440
123727
|
} catch {
|
|
123441
123728
|
return null;
|
|
123442
123729
|
}
|
|
@@ -123722,7 +124009,7 @@ async function main() {
|
|
|
123722
124009
|
}
|
|
123723
124010
|
try {
|
|
123724
124011
|
const codexHome = process.env.CODEX_HOME ?? import_node_path56.default.join(process.env.HOME ?? (0, import_node_os28.homedir)(), ".codex");
|
|
123725
|
-
(0,
|
|
124012
|
+
(0, import_node_fs38.rmSync)(import_node_path56.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
123726
124013
|
} catch {
|
|
123727
124014
|
}
|
|
123728
124015
|
const claudeResult = await installClaude({ binPath, force, serveEnv });
|
|
@@ -123800,13 +124087,13 @@ async function main() {
|
|
|
123800
124087
|
env: process.env,
|
|
123801
124088
|
cwd: process.cwd(),
|
|
123802
124089
|
writeFile: (p, c) => {
|
|
123803
|
-
(0,
|
|
123804
|
-
(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 });
|
|
123805
124092
|
},
|
|
123806
|
-
writeExclusiveFile: (p, c) => (0,
|
|
124093
|
+
writeExclusiveFile: (p, c) => (0, import_node_fs38.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
|
|
123807
124094
|
listDir: (p) => {
|
|
123808
124095
|
try {
|
|
123809
|
-
return (0,
|
|
124096
|
+
return (0, import_node_fs38.readdirSync)(p);
|
|
123810
124097
|
} catch {
|
|
123811
124098
|
return null;
|
|
123812
124099
|
}
|
|
@@ -123817,7 +124104,7 @@ async function main() {
|
|
|
123817
124104
|
// value", never a failed install. See readExistingTelemetryDefaultProject.
|
|
123818
124105
|
readFile: (p) => {
|
|
123819
124106
|
try {
|
|
123820
|
-
return (0,
|
|
124107
|
+
return (0, import_node_fs38.readFileSync)(p, "utf8");
|
|
123821
124108
|
} catch {
|
|
123822
124109
|
return null;
|
|
123823
124110
|
}
|
|
@@ -123838,7 +124125,7 @@ async function main() {
|
|
|
123838
124125
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
123839
124126
|
removeFile: (p) => {
|
|
123840
124127
|
try {
|
|
123841
|
-
(0,
|
|
124128
|
+
(0, import_node_fs38.rmSync)(p, { force: true });
|
|
123842
124129
|
} catch {
|
|
123843
124130
|
}
|
|
123844
124131
|
},
|
|
@@ -123860,7 +124147,7 @@ async function main() {
|
|
|
123860
124147
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
123861
124148
|
removeFile: (p) => {
|
|
123862
124149
|
try {
|
|
123863
|
-
(0,
|
|
124150
|
+
(0, import_node_fs38.rmSync)(p, { force: true });
|
|
123864
124151
|
} catch {
|
|
123865
124152
|
}
|
|
123866
124153
|
},
|
|
@@ -123887,7 +124174,7 @@ async function main() {
|
|
|
123887
124174
|
log2(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
123888
124175
|
}
|
|
123889
124176
|
try {
|
|
123890
|
-
(0,
|
|
124177
|
+
(0, import_node_fs38.rmSync)(import_node_path56.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
123891
124178
|
} catch {
|
|
123892
124179
|
}
|
|
123893
124180
|
log2("removed ~/.mrrlin");
|