pullfrog 0.1.63 → 0.1.65
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/cli.mjs +1331 -712
- package/dist/index.js +1076 -645
- package/dist/internal.js +139 -4
- package/dist/models.d.ts +2 -1
- package/dist/toolState.d.ts +1 -1
- package/dist/utils/apiKeys.d.ts +30 -0
- package/dist/utils/globals.d.ts +0 -1
- package/dist/utils/learnings.d.ts +1 -5
- package/dist/utils/learningsTruncate.d.ts +2 -2
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -69,14 +69,14 @@ var __callDispose = (stack, error52, hasError) => {
|
|
|
69
69
|
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
70
70
|
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
71
71
|
};
|
|
72
|
-
var
|
|
72
|
+
var fail2 = (e) => error52 = hasError ? new E(e, error52, "An error was suppressed during disposal") : (hasError = true, e);
|
|
73
73
|
var next2 = (it) => {
|
|
74
74
|
while (it = stack.pop()) {
|
|
75
75
|
try {
|
|
76
76
|
var result = it[1] && it[1].call(it[2]);
|
|
77
|
-
if (it[0]) return Promise.resolve(result).then(next2, (e) => (
|
|
77
|
+
if (it[0]) return Promise.resolve(result).then(next2, (e) => (fail2(e), next2()));
|
|
78
78
|
} catch (e) {
|
|
79
|
-
|
|
79
|
+
fail2(e);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (hasError) throw error52;
|
|
@@ -73651,11 +73651,11 @@ var require_dataType = __commonJS({
|
|
|
73651
73651
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
73652
73652
|
}
|
|
73653
73653
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
73654
|
-
const
|
|
73654
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
73655
73655
|
let cond;
|
|
73656
73656
|
switch (dataType) {
|
|
73657
73657
|
case "null":
|
|
73658
|
-
return (0, codegen_1._)`${data} ${
|
|
73658
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
73659
73659
|
case "array":
|
|
73660
73660
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
73661
73661
|
break;
|
|
@@ -73669,7 +73669,7 @@ var require_dataType = __commonJS({
|
|
|
73669
73669
|
cond = numCond();
|
|
73670
73670
|
break;
|
|
73671
73671
|
default:
|
|
73672
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
73672
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
73673
73673
|
}
|
|
73674
73674
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
73675
73675
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -75125,15 +75125,33 @@ var require_data = __commonJS({
|
|
|
75125
75125
|
}
|
|
75126
75126
|
});
|
|
75127
75127
|
|
|
75128
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
75128
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js
|
|
75129
75129
|
var require_utils5 = __commonJS({
|
|
75130
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
75130
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
75131
75131
|
"use strict";
|
|
75132
75132
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
75133
75133
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
75134
75134
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
75135
75135
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
75136
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
75136
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
75137
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
75138
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
75139
|
+
var BYTE_HEX = new Array(256);
|
|
75140
|
+
{
|
|
75141
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
75142
|
+
for (let i2 = 0; i2 < 256; i2++) {
|
|
75143
|
+
BYTE_HEX[i2] = "%" + HEX_DIGITS[i2 >> 4] + HEX_DIGITS[i2 & 15];
|
|
75144
|
+
}
|
|
75145
|
+
}
|
|
75146
|
+
function percentEncodeNonAscii(cp) {
|
|
75147
|
+
if (cp < 2048) {
|
|
75148
|
+
return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
75149
|
+
}
|
|
75150
|
+
if (cp < 65536) {
|
|
75151
|
+
return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
75152
|
+
}
|
|
75153
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
75154
|
+
}
|
|
75137
75155
|
function stringArrayToHexStripped(input) {
|
|
75138
75156
|
let acc = "";
|
|
75139
75157
|
let code = 0;
|
|
@@ -75158,91 +75176,105 @@ var require_utils5 = __commonJS({
|
|
|
75158
75176
|
}
|
|
75159
75177
|
return acc;
|
|
75160
75178
|
}
|
|
75179
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
75180
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
75181
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
75161
75182
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
75162
|
-
function
|
|
75163
|
-
|
|
75164
|
-
|
|
75165
|
-
|
|
75166
|
-
|
|
75167
|
-
|
|
75168
|
-
|
|
75169
|
-
if (hex4 !== "") {
|
|
75170
|
-
address.push(hex4);
|
|
75171
|
-
} else {
|
|
75172
|
-
output.error = true;
|
|
75173
|
-
return false;
|
|
75183
|
+
function isZoneIdentifier(zone) {
|
|
75184
|
+
if (zone.length === 0) return false;
|
|
75185
|
+
for (let i2 = 0; i2 < zone.length; i2++) {
|
|
75186
|
+
if (isZoneCharacter(zone[i2])) continue;
|
|
75187
|
+
if (zone[i2] === "%" && i2 + 2 < zone.length && isHexPair(zone.slice(i2 + 1, i2 + 3))) {
|
|
75188
|
+
i2 += 2;
|
|
75189
|
+
continue;
|
|
75174
75190
|
}
|
|
75175
|
-
|
|
75191
|
+
return false;
|
|
75176
75192
|
}
|
|
75177
75193
|
return true;
|
|
75178
75194
|
}
|
|
75179
|
-
function
|
|
75180
|
-
let
|
|
75181
|
-
|
|
75182
|
-
|
|
75183
|
-
|
|
75184
|
-
let
|
|
75185
|
-
|
|
75186
|
-
|
|
75187
|
-
|
|
75188
|
-
|
|
75189
|
-
|
|
75190
|
-
|
|
75191
|
-
}
|
|
75192
|
-
if (cursor3 === ":") {
|
|
75193
|
-
if (endipv6Encountered === true) {
|
|
75194
|
-
endIpv6 = true;
|
|
75195
|
+
function compressIPv6ZeroRun(hextets) {
|
|
75196
|
+
let bestStart = -1;
|
|
75197
|
+
let bestLength = 0;
|
|
75198
|
+
let runStart = -1;
|
|
75199
|
+
let runLength = 0;
|
|
75200
|
+
for (let i2 = 0; i2 < hextets.length; i2++) {
|
|
75201
|
+
if (hextets[i2] === "0") {
|
|
75202
|
+
if (runStart === -1) runStart = i2;
|
|
75203
|
+
runLength++;
|
|
75204
|
+
if (runLength > bestLength) {
|
|
75205
|
+
bestLength = runLength;
|
|
75206
|
+
bestStart = runStart;
|
|
75195
75207
|
}
|
|
75196
|
-
if (!consume(buffer, address, output)) {
|
|
75197
|
-
break;
|
|
75198
|
-
}
|
|
75199
|
-
if (++tokenCount > 7) {
|
|
75200
|
-
output.error = true;
|
|
75201
|
-
break;
|
|
75202
|
-
}
|
|
75203
|
-
if (i2 > 0 && input[i2 - 1] === ":") {
|
|
75204
|
-
endipv6Encountered = true;
|
|
75205
|
-
}
|
|
75206
|
-
address.push(":");
|
|
75207
|
-
continue;
|
|
75208
|
-
} else if (cursor3 === "%") {
|
|
75209
|
-
if (!consume(buffer, address, output)) {
|
|
75210
|
-
break;
|
|
75211
|
-
}
|
|
75212
|
-
consume = consumeIsZone;
|
|
75213
75208
|
} else {
|
|
75214
|
-
|
|
75209
|
+
runStart = -1;
|
|
75210
|
+
runLength = 0;
|
|
75211
|
+
}
|
|
75212
|
+
}
|
|
75213
|
+
if (bestLength < 2) return hextets.join(":");
|
|
75214
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
75215
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
75216
|
+
return head + "::" + tail;
|
|
75217
|
+
}
|
|
75218
|
+
function normalizeIPv6Address(input) {
|
|
75219
|
+
const compression = input.indexOf("::");
|
|
75220
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
75221
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
75222
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
75223
|
+
if (compression !== -1) {
|
|
75224
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
75225
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
75226
|
+
}
|
|
75227
|
+
const parts = left.concat(right);
|
|
75228
|
+
let hextetCount = 0;
|
|
75229
|
+
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
75230
|
+
const part = parts[i2];
|
|
75231
|
+
if (part === "") return void 0;
|
|
75232
|
+
if (part.indexOf(".") !== -1) {
|
|
75233
|
+
if (i2 !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
75234
|
+
hextetCount += 2;
|
|
75215
75235
|
continue;
|
|
75216
75236
|
}
|
|
75237
|
+
if (!isHextet(part)) return void 0;
|
|
75238
|
+
parts[i2] = parseInt(part, 16).toString(16);
|
|
75239
|
+
hextetCount++;
|
|
75217
75240
|
}
|
|
75218
|
-
if (
|
|
75219
|
-
if (
|
|
75220
|
-
|
|
75221
|
-
} else if (endIpv6) {
|
|
75222
|
-
address.push(buffer.join(""));
|
|
75223
|
-
} else {
|
|
75224
|
-
address.push(stringArrayToHexStripped(buffer));
|
|
75225
|
-
}
|
|
75241
|
+
if (compression === -1) {
|
|
75242
|
+
if (hextetCount !== 8) return void 0;
|
|
75243
|
+
return compressIPv6ZeroRun(parts);
|
|
75226
75244
|
}
|
|
75227
|
-
|
|
75228
|
-
|
|
75245
|
+
if (hextetCount >= 8) return void 0;
|
|
75246
|
+
const expanded = parts.slice(0, left.length);
|
|
75247
|
+
for (let i2 = hextetCount; i2 < 8; i2++) expanded.push("0");
|
|
75248
|
+
for (let i2 = left.length; i2 < parts.length; i2++) expanded.push(parts[i2]);
|
|
75249
|
+
return compressIPv6ZeroRun(expanded);
|
|
75229
75250
|
}
|
|
75230
75251
|
function normalizeIPv6(host) {
|
|
75231
|
-
|
|
75232
|
-
|
|
75233
|
-
}
|
|
75234
|
-
|
|
75235
|
-
if (
|
|
75236
|
-
|
|
75237
|
-
|
|
75238
|
-
|
|
75239
|
-
|
|
75240
|
-
|
|
75241
|
-
|
|
75242
|
-
|
|
75243
|
-
|
|
75244
|
-
|
|
75245
|
-
|
|
75252
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
75253
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
75254
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
|
|
75255
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
75256
|
+
if (bracketed && isIPvFuture(input)) {
|
|
75257
|
+
input = input.toLowerCase();
|
|
75258
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
75259
|
+
}
|
|
75260
|
+
if (findToken(input, ":") < 2) {
|
|
75261
|
+
return { host, isIPV6: false, error: bracketed };
|
|
75262
|
+
}
|
|
75263
|
+
let zoneIdentifier = "";
|
|
75264
|
+
const zoneSeparator = input.indexOf("%");
|
|
75265
|
+
if (zoneSeparator !== -1) {
|
|
75266
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
75267
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
75268
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
75269
|
+
input = input.slice(0, zoneSeparator);
|
|
75270
|
+
}
|
|
75271
|
+
const address = normalizeIPv6Address(input);
|
|
75272
|
+
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
75273
|
+
return {
|
|
75274
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
75275
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
75276
|
+
isIPV6: true
|
|
75277
|
+
};
|
|
75246
75278
|
}
|
|
75247
75279
|
function findToken(str, token) {
|
|
75248
75280
|
let ind = 0;
|
|
@@ -75361,7 +75393,8 @@ var require_utils5 = __commonJS({
|
|
|
75361
75393
|
function normalizePathEncoding(input) {
|
|
75362
75394
|
let output = "";
|
|
75363
75395
|
for (let i2 = 0; i2 < input.length; i2++) {
|
|
75364
|
-
|
|
75396
|
+
const ch = input[i2];
|
|
75397
|
+
if (ch === "%" && i2 + 2 < input.length) {
|
|
75365
75398
|
const hex4 = input.slice(i2 + 1, i2 + 3);
|
|
75366
75399
|
if (isHexPair(hex4)) {
|
|
75367
75400
|
const normalizedHex = hex4.toUpperCase();
|
|
@@ -75375,10 +75408,152 @@ var require_utils5 = __commonJS({
|
|
|
75375
75408
|
continue;
|
|
75376
75409
|
}
|
|
75377
75410
|
}
|
|
75378
|
-
if (isPathCharacter(
|
|
75379
|
-
output +=
|
|
75411
|
+
if (isPathCharacter(ch)) {
|
|
75412
|
+
output += ch;
|
|
75413
|
+
} else {
|
|
75414
|
+
const code = input.charCodeAt(i2);
|
|
75415
|
+
if (code < 128) {
|
|
75416
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
75417
|
+
} else if (code < 55296 || code > 57343) {
|
|
75418
|
+
output += percentEncodeNonAscii(code);
|
|
75419
|
+
} else if (code <= 56319 && i2 + 1 < input.length) {
|
|
75420
|
+
const low = input.charCodeAt(i2 + 1);
|
|
75421
|
+
if (low >= 56320 && low <= 57343) {
|
|
75422
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75423
|
+
i2++;
|
|
75424
|
+
} else {
|
|
75425
|
+
output += percentEncodeNonAscii(65533);
|
|
75426
|
+
}
|
|
75427
|
+
} else {
|
|
75428
|
+
output += percentEncodeNonAscii(65533);
|
|
75429
|
+
}
|
|
75430
|
+
}
|
|
75431
|
+
}
|
|
75432
|
+
return output;
|
|
75433
|
+
}
|
|
75434
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
75435
|
+
let output = "";
|
|
75436
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
75437
|
+
for (let i2 = 0; i2 < input.length; i2++) {
|
|
75438
|
+
const ch = input[i2];
|
|
75439
|
+
if (ch === "%" && i2 + 2 < input.length) {
|
|
75440
|
+
const hex4 = input.slice(i2 + 1, i2 + 3);
|
|
75441
|
+
if (isHexPair(hex4)) {
|
|
75442
|
+
output += "%" + hex4.toUpperCase();
|
|
75443
|
+
i2 += 2;
|
|
75444
|
+
continue;
|
|
75445
|
+
}
|
|
75446
|
+
}
|
|
75447
|
+
if (ch === "/") {
|
|
75448
|
+
firstSegment = false;
|
|
75449
|
+
}
|
|
75450
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
75451
|
+
output += ch;
|
|
75452
|
+
} else {
|
|
75453
|
+
const code = input.charCodeAt(i2);
|
|
75454
|
+
if (code < 128) {
|
|
75455
|
+
output += BYTE_HEX[code];
|
|
75456
|
+
} else if (code < 55296 || code > 57343) {
|
|
75457
|
+
output += percentEncodeNonAscii(code);
|
|
75458
|
+
} else if (code <= 56319 && i2 + 1 < input.length) {
|
|
75459
|
+
const low = input.charCodeAt(i2 + 1);
|
|
75460
|
+
if (low >= 56320 && low <= 57343) {
|
|
75461
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75462
|
+
i2++;
|
|
75463
|
+
} else {
|
|
75464
|
+
output += percentEncodeNonAscii(65533);
|
|
75465
|
+
}
|
|
75466
|
+
} else {
|
|
75467
|
+
output += percentEncodeNonAscii(65533);
|
|
75468
|
+
}
|
|
75469
|
+
}
|
|
75470
|
+
}
|
|
75471
|
+
return output;
|
|
75472
|
+
}
|
|
75473
|
+
function encodeComponent(input, isAllowed) {
|
|
75474
|
+
let output = "";
|
|
75475
|
+
for (let i2 = 0; i2 < input.length; i2++) {
|
|
75476
|
+
const ch = input[i2];
|
|
75477
|
+
if (ch === "%" && i2 + 2 < input.length) {
|
|
75478
|
+
const hex4 = input.slice(i2 + 1, i2 + 3);
|
|
75479
|
+
if (isHexPair(hex4)) {
|
|
75480
|
+
output += "%" + hex4.toUpperCase();
|
|
75481
|
+
i2 += 2;
|
|
75482
|
+
continue;
|
|
75483
|
+
}
|
|
75484
|
+
}
|
|
75485
|
+
if (isAllowed(ch)) {
|
|
75486
|
+
output += ch;
|
|
75487
|
+
} else {
|
|
75488
|
+
const code = input.charCodeAt(i2);
|
|
75489
|
+
if (code < 128) {
|
|
75490
|
+
output += BYTE_HEX[code];
|
|
75491
|
+
} else if (code < 55296 || code > 57343) {
|
|
75492
|
+
output += percentEncodeNonAscii(code);
|
|
75493
|
+
} else if (code <= 56319 && i2 + 1 < input.length) {
|
|
75494
|
+
const low = input.charCodeAt(i2 + 1);
|
|
75495
|
+
if (low >= 56320 && low <= 57343) {
|
|
75496
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75497
|
+
i2++;
|
|
75498
|
+
} else {
|
|
75499
|
+
output += percentEncodeNonAscii(65533);
|
|
75500
|
+
}
|
|
75501
|
+
} else {
|
|
75502
|
+
output += percentEncodeNonAscii(65533);
|
|
75503
|
+
}
|
|
75504
|
+
}
|
|
75505
|
+
}
|
|
75506
|
+
return output;
|
|
75507
|
+
}
|
|
75508
|
+
function encodeUserinfo(input) {
|
|
75509
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
75510
|
+
}
|
|
75511
|
+
function encodeQuery(input) {
|
|
75512
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
75513
|
+
}
|
|
75514
|
+
function encodeFragment(input) {
|
|
75515
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
75516
|
+
}
|
|
75517
|
+
function isEscapeSafe(cp) {
|
|
75518
|
+
return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
|
|
75519
|
+
}
|
|
75520
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
75521
|
+
let output = "";
|
|
75522
|
+
for (let i2 = 0; i2 < input.length; i2++) {
|
|
75523
|
+
const ch = input[i2];
|
|
75524
|
+
if (ch === "%" && i2 + 2 < input.length) {
|
|
75525
|
+
const hex4 = input.slice(i2 + 1, i2 + 3);
|
|
75526
|
+
if (isHexPair(hex4)) {
|
|
75527
|
+
const normalizedHex = hex4.toUpperCase();
|
|
75528
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
75529
|
+
if (isUnreserved(decoded)) {
|
|
75530
|
+
output += decoded;
|
|
75531
|
+
} else {
|
|
75532
|
+
output += "%" + normalizedHex;
|
|
75533
|
+
}
|
|
75534
|
+
i2 += 2;
|
|
75535
|
+
continue;
|
|
75536
|
+
}
|
|
75537
|
+
}
|
|
75538
|
+
if (isQueryFragmentCharacter(ch)) {
|
|
75539
|
+
output += ch;
|
|
75380
75540
|
} else {
|
|
75381
|
-
|
|
75541
|
+
const code = input.charCodeAt(i2);
|
|
75542
|
+
if (code < 128) {
|
|
75543
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
75544
|
+
} else if (code < 55296 || code > 57343) {
|
|
75545
|
+
output += percentEncodeNonAscii(code);
|
|
75546
|
+
} else if (code <= 56319 && i2 + 1 < input.length) {
|
|
75547
|
+
const low = input.charCodeAt(i2 + 1);
|
|
75548
|
+
if (low >= 56320 && low <= 57343) {
|
|
75549
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75550
|
+
i2++;
|
|
75551
|
+
} else {
|
|
75552
|
+
output += percentEncodeNonAscii(65533);
|
|
75553
|
+
}
|
|
75554
|
+
} else {
|
|
75555
|
+
output += percentEncodeNonAscii(65533);
|
|
75556
|
+
}
|
|
75382
75557
|
}
|
|
75383
75558
|
}
|
|
75384
75559
|
return output;
|
|
@@ -75401,14 +75576,18 @@ var require_utils5 = __commonJS({
|
|
|
75401
75576
|
function recomposeAuthority(component) {
|
|
75402
75577
|
const uriTokens = [];
|
|
75403
75578
|
if (component.userinfo !== void 0) {
|
|
75404
|
-
uriTokens.push(component.userinfo);
|
|
75579
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
75405
75580
|
uriTokens.push("@");
|
|
75406
75581
|
}
|
|
75407
75582
|
if (component.host !== void 0) {
|
|
75408
|
-
let host =
|
|
75583
|
+
let host = component.host;
|
|
75409
75584
|
if (!isIPv4(host)) {
|
|
75410
|
-
|
|
75411
|
-
if (ipV6res.isIPV6
|
|
75585
|
+
let ipV6res = normalizeIPv6(host);
|
|
75586
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
75587
|
+
host = normalizePercentEncoding(host, true);
|
|
75588
|
+
ipV6res = normalizeIPv6(host);
|
|
75589
|
+
}
|
|
75590
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
75412
75591
|
host = `[${ipV6res.escapedHost}]`;
|
|
75413
75592
|
} else {
|
|
75414
75593
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -75428,6 +75607,11 @@ var require_utils5 = __commonJS({
|
|
|
75428
75607
|
reescapeHostDelimiters,
|
|
75429
75608
|
normalizePercentEncoding,
|
|
75430
75609
|
normalizePathEncoding,
|
|
75610
|
+
serializePathEncoding,
|
|
75611
|
+
normalizeQueryFragmentEncoding,
|
|
75612
|
+
encodeUserinfo,
|
|
75613
|
+
encodeQuery,
|
|
75614
|
+
encodeFragment,
|
|
75431
75615
|
escapePreservingEscapes,
|
|
75432
75616
|
removeDotSegments,
|
|
75433
75617
|
isIPv4,
|
|
@@ -75438,12 +75622,12 @@ var require_utils5 = __commonJS({
|
|
|
75438
75622
|
}
|
|
75439
75623
|
});
|
|
75440
75624
|
|
|
75441
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
75625
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js
|
|
75442
75626
|
var require_schemes = __commonJS({
|
|
75443
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
75627
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
75444
75628
|
"use strict";
|
|
75445
75629
|
var { isUUID } = require_utils5();
|
|
75446
|
-
var URN_REG =
|
|
75630
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
75447
75631
|
var supportedSchemeNames = (
|
|
75448
75632
|
/** @type {const} */
|
|
75449
75633
|
[
|
|
@@ -75504,9 +75688,10 @@ var require_schemes = __commonJS({
|
|
|
75504
75688
|
wsComponent.secure = void 0;
|
|
75505
75689
|
}
|
|
75506
75690
|
if (wsComponent.resourceName) {
|
|
75507
|
-
const
|
|
75691
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
75692
|
+
const path4 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
75508
75693
|
wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
|
|
75509
|
-
wsComponent.query =
|
|
75694
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
75510
75695
|
wsComponent.resourceName = void 0;
|
|
75511
75696
|
}
|
|
75512
75697
|
wsComponent.fragment = void 0;
|
|
@@ -75518,7 +75703,7 @@ var require_schemes = __commonJS({
|
|
|
75518
75703
|
return urnComponent;
|
|
75519
75704
|
}
|
|
75520
75705
|
const matches = urnComponent.path.match(URN_REG);
|
|
75521
|
-
if (matches) {
|
|
75706
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
75522
75707
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
75523
75708
|
urnComponent.nid = matches[1].toLowerCase();
|
|
75524
75709
|
urnComponent.nss = matches[2];
|
|
@@ -75648,12 +75833,21 @@ var require_schemes = __commonJS({
|
|
|
75648
75833
|
}
|
|
75649
75834
|
});
|
|
75650
75835
|
|
|
75651
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
75836
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js
|
|
75652
75837
|
var require_fast_uri = __commonJS({
|
|
75653
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
75838
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js"(exports, module) {
|
|
75654
75839
|
"use strict";
|
|
75655
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
75840
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils5();
|
|
75656
75841
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
75842
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
75843
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
75844
|
+
function decodeValidScheme(scheme) {
|
|
75845
|
+
const decodedScheme = unescape(String(scheme));
|
|
75846
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
75847
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
75848
|
+
}
|
|
75849
|
+
return decodedScheme;
|
|
75850
|
+
}
|
|
75657
75851
|
function normalize3(uri, options) {
|
|
75658
75852
|
if (typeof uri === "string") {
|
|
75659
75853
|
uri = /** @type {T} */
|
|
@@ -75666,12 +75860,34 @@ var require_fast_uri = __commonJS({
|
|
|
75666
75860
|
}
|
|
75667
75861
|
function resolve3(baseURI, relativeURI, options) {
|
|
75668
75862
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
75669
|
-
const {
|
|
75670
|
-
|
|
75671
|
-
|
|
75863
|
+
const {
|
|
75864
|
+
parsed: baseParsed,
|
|
75865
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
75866
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
75867
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
75868
|
+
malformedHost: baseMalformedHost,
|
|
75869
|
+
malformedScheme: baseMalformedScheme
|
|
75870
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
75871
|
+
const {
|
|
75872
|
+
parsed: relativeParsed,
|
|
75873
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
75874
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
75875
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
75876
|
+
malformedHost: relativeMalformedHost,
|
|
75877
|
+
malformedScheme: relativeMalformedScheme
|
|
75878
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
75879
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
75672
75880
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
75673
75881
|
}
|
|
75674
75882
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
75883
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
75884
|
+
const resolvedHost = resolved.host;
|
|
75885
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
75886
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
75887
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
75888
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
75889
|
+
throw new Error(resolved.error);
|
|
75890
|
+
}
|
|
75675
75891
|
schemelessOptions.skipEscape = true;
|
|
75676
75892
|
return serialize(resolved, schemelessOptions);
|
|
75677
75893
|
}
|
|
@@ -75731,7 +75947,7 @@ var require_fast_uri = __commonJS({
|
|
|
75731
75947
|
function equal(uriA, uriB, options) {
|
|
75732
75948
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
75733
75949
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
75734
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA
|
|
75950
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
75735
75951
|
}
|
|
75736
75952
|
function serialize(cmpts, opts) {
|
|
75737
75953
|
const component = {
|
|
@@ -75752,19 +75968,22 @@ var require_fast_uri = __commonJS({
|
|
|
75752
75968
|
};
|
|
75753
75969
|
const options = Object.assign({}, opts);
|
|
75754
75970
|
const uriTokens = [];
|
|
75971
|
+
if (component.scheme) {
|
|
75972
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
75973
|
+
}
|
|
75755
75974
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
75756
75975
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
75976
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
75977
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
75757
75978
|
if (component.path !== void 0) {
|
|
75758
75979
|
if (!options.skipEscape) {
|
|
75759
|
-
component.path =
|
|
75760
|
-
if (component.scheme !== void 0) {
|
|
75761
|
-
component.path = component.path.split("%3A").join(":");
|
|
75762
|
-
}
|
|
75980
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
75763
75981
|
} else {
|
|
75764
75982
|
component.path = normalizePercentEncoding(component.path);
|
|
75765
75983
|
}
|
|
75766
75984
|
}
|
|
75767
75985
|
if (options.reference !== "suffix" && component.scheme) {
|
|
75986
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
75768
75987
|
uriTokens.push(component.scheme, ":");
|
|
75769
75988
|
}
|
|
75770
75989
|
const authority = recomposeAuthority(component);
|
|
@@ -75782,16 +76001,19 @@ var require_fast_uri = __commonJS({
|
|
|
75782
76001
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
75783
76002
|
s = removeDotSegments(s);
|
|
75784
76003
|
}
|
|
76004
|
+
if (pathNoScheme) {
|
|
76005
|
+
s = serializePathEncoding(s, true);
|
|
76006
|
+
}
|
|
75785
76007
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") {
|
|
75786
76008
|
s = "/%2F" + s.slice(2);
|
|
75787
76009
|
}
|
|
75788
76010
|
uriTokens.push(s);
|
|
75789
76011
|
}
|
|
75790
76012
|
if (component.query !== void 0) {
|
|
75791
|
-
uriTokens.push("?", component.query);
|
|
76013
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
75792
76014
|
}
|
|
75793
76015
|
if (component.fragment !== void 0) {
|
|
75794
|
-
uriTokens.push("#", component.fragment);
|
|
76016
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
75795
76017
|
}
|
|
75796
76018
|
return uriTokens.join("");
|
|
75797
76019
|
}
|
|
@@ -75807,6 +76029,32 @@ var require_fast_uri = __commonJS({
|
|
|
75807
76029
|
}
|
|
75808
76030
|
return void 0;
|
|
75809
76031
|
}
|
|
76032
|
+
function hasMalformedPercentEncoding(component) {
|
|
76033
|
+
if (component === void 0) return false;
|
|
76034
|
+
let percent = component.indexOf("%");
|
|
76035
|
+
while (percent !== -1) {
|
|
76036
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
76037
|
+
return true;
|
|
76038
|
+
}
|
|
76039
|
+
percent = component.indexOf("%", percent + 3);
|
|
76040
|
+
}
|
|
76041
|
+
return false;
|
|
76042
|
+
}
|
|
76043
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
76044
|
+
const host = matches[4];
|
|
76045
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host[0] === "[" && host[host.length - 1] === "]") && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
76046
|
+
}
|
|
76047
|
+
function canonicalizeHost(parsed2, options, schemeHandler, isIP) {
|
|
76048
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed2.host && parsed2.host[0] !== "[" && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed2.host)) {
|
|
76049
|
+
try {
|
|
76050
|
+
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
76051
|
+
} catch (e) {
|
|
76052
|
+
parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
76053
|
+
return true;
|
|
76054
|
+
}
|
|
76055
|
+
}
|
|
76056
|
+
return false;
|
|
76057
|
+
}
|
|
75810
76058
|
function parseWithStatus(uri, opts) {
|
|
75811
76059
|
const options = Object.assign({}, opts);
|
|
75812
76060
|
const parsed2 = {
|
|
@@ -75819,6 +76067,11 @@ var require_fast_uri = __commonJS({
|
|
|
75819
76067
|
fragment: void 0
|
|
75820
76068
|
};
|
|
75821
76069
|
let malformedAuthorityOrPort = false;
|
|
76070
|
+
let malformedPercentEncoding = false;
|
|
76071
|
+
let malformedSchemeSpecific = false;
|
|
76072
|
+
let malformedHost = false;
|
|
76073
|
+
let malformedIPLiteral = false;
|
|
76074
|
+
let malformedScheme = false;
|
|
75822
76075
|
let isIP = false;
|
|
75823
76076
|
if (options.reference === "suffix") {
|
|
75824
76077
|
if (options.scheme) {
|
|
@@ -75855,6 +76108,19 @@ var require_fast_uri = __commonJS({
|
|
|
75855
76108
|
parsed2.path = matches[6] || "";
|
|
75856
76109
|
parsed2.query = matches[7];
|
|
75857
76110
|
parsed2.fragment = matches[8];
|
|
76111
|
+
if (parsed2.scheme !== void 0) {
|
|
76112
|
+
const decodedScheme = unescape(parsed2.scheme);
|
|
76113
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
76114
|
+
parsed2.scheme = decodedScheme.toLowerCase();
|
|
76115
|
+
} else {
|
|
76116
|
+
parsed2.error = parsed2.error || MALFORMED_SCHEME_ERROR;
|
|
76117
|
+
malformedScheme = true;
|
|
76118
|
+
}
|
|
76119
|
+
}
|
|
76120
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
76121
|
+
if (malformedPercentEncoding) {
|
|
76122
|
+
parsed2.error = parsed2.error || "URI contains malformed percent-encoding.";
|
|
76123
|
+
}
|
|
75858
76124
|
if (isNaN(parsed2.port)) {
|
|
75859
76125
|
parsed2.port = matches[5];
|
|
75860
76126
|
}
|
|
@@ -75866,9 +76132,15 @@ var require_fast_uri = __commonJS({
|
|
|
75866
76132
|
if (parsed2.host) {
|
|
75867
76133
|
const ipv4result = isIPv4(parsed2.host);
|
|
75868
76134
|
if (ipv4result === false) {
|
|
76135
|
+
const bracketedIPLiteral = parsed2.host[0] === "[" && parsed2.host[parsed2.host.length - 1] === "]";
|
|
75869
76136
|
const ipv6result = normalizeIPv6(parsed2.host);
|
|
75870
|
-
|
|
75871
|
-
|
|
76137
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
76138
|
+
malformedIPLiteral = bracketedIPLiteral && ipv6result.error === true;
|
|
76139
|
+
parsed2.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
76140
|
+
if (malformedIPLiteral) {
|
|
76141
|
+
parsed2.error = parsed2.error || "URI host is malformed.";
|
|
76142
|
+
malformedAuthorityOrPort = true;
|
|
76143
|
+
}
|
|
75872
76144
|
} else {
|
|
75873
76145
|
isIP = true;
|
|
75874
76146
|
}
|
|
@@ -75886,42 +76158,34 @@ var require_fast_uri = __commonJS({
|
|
|
75886
76158
|
parsed2.error = parsed2.error || "URI is not a " + options.reference + " reference.";
|
|
75887
76159
|
}
|
|
75888
76160
|
const schemeHandler = getSchemeHandler(options.scheme || parsed2.scheme);
|
|
75889
|
-
|
|
75890
|
-
if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed2.host)) {
|
|
75891
|
-
try {
|
|
75892
|
-
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
75893
|
-
} catch (e) {
|
|
75894
|
-
parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
75895
|
-
}
|
|
75896
|
-
}
|
|
75897
|
-
}
|
|
76161
|
+
malformedHost = canonicalizeHost(parsed2, options, schemeHandler, isIP);
|
|
75898
76162
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
75899
76163
|
if (uri.indexOf("%") !== -1) {
|
|
75900
|
-
if (parsed2.
|
|
75901
|
-
parsed2.
|
|
75902
|
-
|
|
75903
|
-
if (parsed2.host !== void 0) {
|
|
75904
|
-
parsed2.host = reescapeHostDelimiters(unescape(parsed2.host), isIP);
|
|
76164
|
+
if (parsed2.host !== void 0 && !malformedIPLiteral) {
|
|
76165
|
+
const host = isIP ? parsed2.host : normalizePercentEncoding(parsed2.host, true);
|
|
76166
|
+
parsed2.host = reescapeHostDelimiters(host, isIP);
|
|
75905
76167
|
}
|
|
75906
76168
|
}
|
|
75907
76169
|
if (parsed2.path) {
|
|
75908
76170
|
parsed2.path = normalizePathEncoding(parsed2.path);
|
|
75909
76171
|
}
|
|
76172
|
+
if (parsed2.query) {
|
|
76173
|
+
parsed2.query = normalizeQueryFragmentEncoding(parsed2.query);
|
|
76174
|
+
}
|
|
75910
76175
|
if (parsed2.fragment) {
|
|
75911
|
-
|
|
75912
|
-
parsed2.fragment = encodeURI(decodeURIComponent(parsed2.fragment));
|
|
75913
|
-
} catch {
|
|
75914
|
-
parsed2.error = parsed2.error || "URI malformed";
|
|
75915
|
-
}
|
|
76176
|
+
parsed2.fragment = normalizeQueryFragmentEncoding(parsed2.fragment);
|
|
75916
76177
|
}
|
|
75917
76178
|
}
|
|
75918
76179
|
if (schemeHandler && schemeHandler.parse) {
|
|
75919
76180
|
schemeHandler.parse(parsed2, options);
|
|
76181
|
+
if (schemeHandler === SCHEMES.urn && parsed2.nid === void 0) {
|
|
76182
|
+
malformedSchemeSpecific = true;
|
|
76183
|
+
}
|
|
75920
76184
|
}
|
|
75921
76185
|
} else {
|
|
75922
76186
|
parsed2.error = parsed2.error || "URI can not be parsed.";
|
|
75923
76187
|
}
|
|
75924
|
-
return { parsed: parsed2, malformedAuthorityOrPort };
|
|
76188
|
+
return { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
75925
76189
|
}
|
|
75926
76190
|
function parse6(uri, opts) {
|
|
75927
76191
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -75930,20 +76194,28 @@ var require_fast_uri = __commonJS({
|
|
|
75930
76194
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
75931
76195
|
}
|
|
75932
76196
|
function normalizeStringWithStatus(uri, opts) {
|
|
75933
|
-
const { parsed: parsed2, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
76197
|
+
const { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
75934
76198
|
return {
|
|
75935
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed2, opts),
|
|
75936
|
-
malformedAuthorityOrPort
|
|
76199
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed2, opts),
|
|
76200
|
+
malformedAuthorityOrPort,
|
|
76201
|
+
malformedPercentEncoding,
|
|
76202
|
+
malformedSchemeSpecific,
|
|
76203
|
+
malformedHost,
|
|
76204
|
+
malformedScheme
|
|
75937
76205
|
};
|
|
75938
76206
|
}
|
|
75939
76207
|
function normalizeComparableURI(uri, opts) {
|
|
75940
|
-
if (typeof uri
|
|
75941
|
-
|
|
75942
|
-
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
76208
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
76209
|
+
return void 0;
|
|
75943
76210
|
}
|
|
75944
|
-
|
|
75945
|
-
|
|
76211
|
+
let value2;
|
|
76212
|
+
try {
|
|
76213
|
+
value2 = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
76214
|
+
} catch {
|
|
76215
|
+
return void 0;
|
|
75946
76216
|
}
|
|
76217
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value2, opts);
|
|
76218
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
75947
76219
|
}
|
|
75948
76220
|
var fastUri = {
|
|
75949
76221
|
SCHEMES,
|
|
@@ -81205,137 +81477,6 @@ var require_light = __commonJS({
|
|
|
81205
81477
|
}
|
|
81206
81478
|
});
|
|
81207
81479
|
|
|
81208
|
-
// node_modules/.pnpm/content-type@2.0.0/node_modules/content-type/dist/index.js
|
|
81209
|
-
var require_dist4 = __commonJS({
|
|
81210
|
-
"node_modules/.pnpm/content-type@2.0.0/node_modules/content-type/dist/index.js"(exports) {
|
|
81211
|
-
"use strict";
|
|
81212
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
81213
|
-
exports.format = format2;
|
|
81214
|
-
exports.parse = parse6;
|
|
81215
|
-
var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
|
|
81216
|
-
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
81217
|
-
var QUOTE_REGEXP = /[\\"]/g;
|
|
81218
|
-
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
81219
|
-
var NullObject = /* @__PURE__ */ (() => {
|
|
81220
|
-
const C = function() {
|
|
81221
|
-
};
|
|
81222
|
-
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
81223
|
-
return C;
|
|
81224
|
-
})();
|
|
81225
|
-
function format2(obj) {
|
|
81226
|
-
const { type: type2, parameters } = obj;
|
|
81227
|
-
if (!type2 || !TYPE_REGEXP.test(type2)) {
|
|
81228
|
-
throw new TypeError(`Invalid type: ${type2}`);
|
|
81229
|
-
}
|
|
81230
|
-
let result = type2;
|
|
81231
|
-
if (parameters) {
|
|
81232
|
-
for (const param of Object.keys(parameters)) {
|
|
81233
|
-
if (!TOKEN_REGEXP.test(param)) {
|
|
81234
|
-
throw new TypeError(`Invalid parameter name: ${param}`);
|
|
81235
|
-
}
|
|
81236
|
-
result += `; ${param}=${qstring(parameters[param])}`;
|
|
81237
|
-
}
|
|
81238
|
-
}
|
|
81239
|
-
return result;
|
|
81240
|
-
}
|
|
81241
|
-
function parse6(header, options) {
|
|
81242
|
-
const len = header.length;
|
|
81243
|
-
let index = skipOWS(header, 0, len);
|
|
81244
|
-
const valueStart = index;
|
|
81245
|
-
index = skipValue(header, index, len);
|
|
81246
|
-
const valueEnd = trailingOWS(header, valueStart, index);
|
|
81247
|
-
const type2 = header.slice(valueStart, valueEnd).toLowerCase();
|
|
81248
|
-
const parameters = options?.parameters === false ? new NullObject() : parseParameters(header, index, len);
|
|
81249
|
-
return { type: type2, parameters };
|
|
81250
|
-
}
|
|
81251
|
-
var SP = 32;
|
|
81252
|
-
var HTAB = 9;
|
|
81253
|
-
var SEMI = 59;
|
|
81254
|
-
var EQ = 61;
|
|
81255
|
-
var DQUOTE = 34;
|
|
81256
|
-
var BSLASH = 92;
|
|
81257
|
-
function parseParameters(header, index, len) {
|
|
81258
|
-
const parameters = new NullObject();
|
|
81259
|
-
parameter: while (index < len) {
|
|
81260
|
-
index = skipOWS(header, index + 1, len);
|
|
81261
|
-
const keyStart = index;
|
|
81262
|
-
while (index < len) {
|
|
81263
|
-
const code = header.charCodeAt(index);
|
|
81264
|
-
if (code === SEMI)
|
|
81265
|
-
continue parameter;
|
|
81266
|
-
if (code === EQ) {
|
|
81267
|
-
const keyEnd = trailingOWS(header, keyStart, index);
|
|
81268
|
-
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
81269
|
-
index = skipOWS(header, index + 1, len);
|
|
81270
|
-
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
81271
|
-
index++;
|
|
81272
|
-
let value2 = "";
|
|
81273
|
-
while (index < len) {
|
|
81274
|
-
const code2 = header.charCodeAt(index++);
|
|
81275
|
-
if (code2 === DQUOTE) {
|
|
81276
|
-
index = skipValue(header, index, len);
|
|
81277
|
-
if (parameters[key] === void 0)
|
|
81278
|
-
parameters[key] = value2;
|
|
81279
|
-
break;
|
|
81280
|
-
}
|
|
81281
|
-
if (code2 === BSLASH && index < len) {
|
|
81282
|
-
value2 += header[index++];
|
|
81283
|
-
continue;
|
|
81284
|
-
}
|
|
81285
|
-
value2 += String.fromCharCode(code2);
|
|
81286
|
-
}
|
|
81287
|
-
continue parameter;
|
|
81288
|
-
}
|
|
81289
|
-
const valueStart = index;
|
|
81290
|
-
index = skipValue(header, index, len);
|
|
81291
|
-
if (parameters[key] === void 0) {
|
|
81292
|
-
const valueEnd = trailingOWS(header, valueStart, index);
|
|
81293
|
-
parameters[key] = header.slice(valueStart, valueEnd);
|
|
81294
|
-
}
|
|
81295
|
-
continue parameter;
|
|
81296
|
-
}
|
|
81297
|
-
index++;
|
|
81298
|
-
}
|
|
81299
|
-
}
|
|
81300
|
-
return parameters;
|
|
81301
|
-
}
|
|
81302
|
-
function skipValue(str, index, len) {
|
|
81303
|
-
while (index < len) {
|
|
81304
|
-
const char = str.charCodeAt(index);
|
|
81305
|
-
if (char === SEMI)
|
|
81306
|
-
break;
|
|
81307
|
-
index++;
|
|
81308
|
-
}
|
|
81309
|
-
return index;
|
|
81310
|
-
}
|
|
81311
|
-
function skipOWS(header, index, len) {
|
|
81312
|
-
while (index < len) {
|
|
81313
|
-
const char = header.charCodeAt(index);
|
|
81314
|
-
if (char !== SP && char !== HTAB)
|
|
81315
|
-
break;
|
|
81316
|
-
index++;
|
|
81317
|
-
}
|
|
81318
|
-
return index;
|
|
81319
|
-
}
|
|
81320
|
-
function trailingOWS(header, start, end) {
|
|
81321
|
-
while (end > start) {
|
|
81322
|
-
const char = header.charCodeAt(end - 1);
|
|
81323
|
-
if (char !== SP && char !== HTAB)
|
|
81324
|
-
break;
|
|
81325
|
-
end--;
|
|
81326
|
-
}
|
|
81327
|
-
return end;
|
|
81328
|
-
}
|
|
81329
|
-
function qstring(str) {
|
|
81330
|
-
if (TOKEN_REGEXP.test(str))
|
|
81331
|
-
return str;
|
|
81332
|
-
if (TEXT_REGEXP.test(str))
|
|
81333
|
-
return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
|
|
81334
|
-
throw new TypeError(`Invalid parameter value: ${str}`);
|
|
81335
|
-
}
|
|
81336
|
-
}
|
|
81337
|
-
});
|
|
81338
|
-
|
|
81339
81480
|
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Event.js
|
|
81340
81481
|
var require_Event = __commonJS({
|
|
81341
81482
|
"node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Event.js"(exports, module) {
|
|
@@ -83378,7 +83519,7 @@ var require_select = __commonJS({
|
|
|
83378
83519
|
var compareDocumentPosition = function(a2, b) {
|
|
83379
83520
|
return a2.compareDocumentPosition(b);
|
|
83380
83521
|
};
|
|
83381
|
-
var
|
|
83522
|
+
var order2 = function(a2, b) {
|
|
83382
83523
|
return compareDocumentPosition(a2, b) & 2 ? 1 : -1;
|
|
83383
83524
|
};
|
|
83384
83525
|
var next2 = function(el) {
|
|
@@ -84059,7 +84200,7 @@ var require_select = __commonJS({
|
|
|
84059
84200
|
}
|
|
84060
84201
|
}
|
|
84061
84202
|
}
|
|
84062
|
-
results.sort(
|
|
84203
|
+
results.sort(order2);
|
|
84063
84204
|
}
|
|
84064
84205
|
return results;
|
|
84065
84206
|
};
|
|
@@ -98607,14 +98748,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
98607
98748
|
} else if (node2.nodeType === 1) {
|
|
98608
98749
|
replacement = replacementForNode.call(self2, node2);
|
|
98609
98750
|
}
|
|
98610
|
-
return
|
|
98751
|
+
return join30(output, replacement);
|
|
98611
98752
|
}, "");
|
|
98612
98753
|
}
|
|
98613
98754
|
function postProcess(output) {
|
|
98614
98755
|
var self2 = this;
|
|
98615
98756
|
this.rules.forEach(function(rule) {
|
|
98616
98757
|
if (typeof rule.append === "function") {
|
|
98617
|
-
output =
|
|
98758
|
+
output = join30(output, rule.append(self2.options));
|
|
98618
98759
|
}
|
|
98619
98760
|
});
|
|
98620
98761
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -98626,7 +98767,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
98626
98767
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
98627
98768
|
return whitespace.leading + rule.replacement(content, node2, this.options) + whitespace.trailing;
|
|
98628
98769
|
}
|
|
98629
|
-
function
|
|
98770
|
+
function join30(output, replacement) {
|
|
98630
98771
|
var s1 = trimTrailingNewlines(output);
|
|
98631
98772
|
var s2 = trimLeadingNewlines(replacement);
|
|
98632
98773
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -104834,36 +104975,43 @@ function handleCancel(value2) {
|
|
|
104834
104975
|
process.exit(0);
|
|
104835
104976
|
}
|
|
104836
104977
|
}
|
|
104837
|
-
function
|
|
104838
|
-
let token;
|
|
104978
|
+
function tryGetGhToken() {
|
|
104839
104979
|
try {
|
|
104840
|
-
|
|
104980
|
+
return execFileSync("gh", ["auth", "token"], { encoding: "utf-8" }).trim() || null;
|
|
104841
104981
|
} catch {
|
|
104842
|
-
|
|
104843
|
-
`gh cli not found or not authenticated.
|
|
104844
|
-
${import_picocolors.default.dim("install:")} https://cli.github.com
|
|
104845
|
-
${import_picocolors.default.dim("then:")} gh auth login`
|
|
104846
|
-
);
|
|
104982
|
+
return null;
|
|
104847
104983
|
}
|
|
104984
|
+
}
|
|
104985
|
+
var GH_TOKEN_HELP = "gh cli not found or not authenticated. install https://cli.github.com, then run `gh auth login`.";
|
|
104986
|
+
function getGhToken() {
|
|
104987
|
+
const token = tryGetGhToken();
|
|
104848
104988
|
if (!token) {
|
|
104849
104989
|
bail(
|
|
104850
|
-
`gh cli returned an empty token.
|
|
104851
|
-
${import_picocolors.default.dim("
|
|
104990
|
+
`gh cli not found, not authenticated, or returned an empty token.
|
|
104991
|
+
${import_picocolors.default.dim("install:")} https://cli.github.com
|
|
104992
|
+
${import_picocolors.default.dim("then:")} gh auth login`
|
|
104852
104993
|
);
|
|
104853
104994
|
}
|
|
104854
104995
|
return token;
|
|
104855
104996
|
}
|
|
104856
|
-
function
|
|
104997
|
+
function tryParseGitRemote() {
|
|
104857
104998
|
let url4;
|
|
104858
104999
|
try {
|
|
104859
105000
|
url4 = execFileSync("git", ["remote", "get-url", "origin"], { encoding: "utf-8" }).trim();
|
|
104860
105001
|
} catch {
|
|
104861
|
-
|
|
105002
|
+
return null;
|
|
104862
105003
|
}
|
|
104863
105004
|
const match3 = url4.match(/github\.com(?::\d+)?[:/]+([^/]+)\/(.+?)(?:\.git)?(?:\/)?$/);
|
|
104864
|
-
if (!match3)
|
|
105005
|
+
if (!match3) return null;
|
|
104865
105006
|
return { owner: match3[1], repo: match3[2] };
|
|
104866
105007
|
}
|
|
105008
|
+
function parseGitRemote() {
|
|
105009
|
+
const parsed2 = tryParseGitRemote();
|
|
105010
|
+
if (!parsed2) {
|
|
105011
|
+
bail("not a git repository, no 'origin' remote, or the remote is not a github url.");
|
|
105012
|
+
}
|
|
105013
|
+
return parsed2;
|
|
105014
|
+
}
|
|
104867
105015
|
async function pullfrogApi(ctx) {
|
|
104868
105016
|
const headers = { authorization: `Bearer ${ctx.token}` };
|
|
104869
105017
|
if (ctx.body) headers["content-type"] = "application/json";
|
|
@@ -105840,7 +105988,12 @@ var providers = {
|
|
|
105840
105988
|
displayName: "O3",
|
|
105841
105989
|
resolve: "openai/o3",
|
|
105842
105990
|
effort: ["low", "medium", "high"],
|
|
105843
|
-
openRouterResolve: "openrouter/openai/o3"
|
|
105991
|
+
openRouterResolve: "openrouter/openai/o3",
|
|
105992
|
+
// OpenRouter publishes a reasoning TOGGLE for o3 where direct OpenAI
|
|
105993
|
+
// publishes a ladder, so the route genuinely has no rungs. `[]` rather
|
|
105994
|
+
// than omitting the field: an absent openRouterEffort falls through to
|
|
105995
|
+
// `effort` and would send a rung this route rejects.
|
|
105996
|
+
openRouterEffort: []
|
|
105844
105997
|
}
|
|
105845
105998
|
}
|
|
105846
105999
|
}),
|
|
@@ -106004,7 +106157,21 @@ var providers = {
|
|
|
106004
106157
|
resolve: "opencode/claude-opus-5",
|
|
106005
106158
|
effort: ["low", "medium", "high", "xhigh", "max"],
|
|
106006
106159
|
openRouterResolve: "openrouter/anthropic/claude-opus-5",
|
|
106007
|
-
subagentModel: "claude-sonnet"
|
|
106160
|
+
subagentModel: "claude-sonnet",
|
|
106161
|
+
// TEMPORARY — clear this ONLY when opus completes a run through opencode,
|
|
106162
|
+
// never when the endpoint merely answers. Zen LISTS claude-opus-5 in
|
|
106163
|
+
// /zen/v1/models, so the catalog test passes; on 2026-08-25 the endpoint
|
|
106164
|
+
// itself answered 503 `Upstream request failed: Endpoint is unavailable.`
|
|
106165
|
+
// (measured 5/5; claude-sonnet-5, claude-opus-4-8, claude-haiku-4-5 and
|
|
106166
|
+
// claude-fable-5 all 200 on the same key). opencode retries above the AI
|
|
106167
|
+
// SDK emitting no part.updated, so a run just produces nothing until it is
|
|
106168
|
+
// killed — metaideas/init logged six zero-output failures from 2026-08-23.
|
|
106169
|
+
// The 503 has since cleared and the model is STILL unusable: re-measured
|
|
106170
|
+
// 2026-08-26, direct POST /zen/v1/messages is 10/10 200 at 1.3-4.1s while
|
|
106171
|
+
// `opencode run --model opencode/claude-opus-5` on the same trivial prompt
|
|
106172
|
+
// emitted nothing for 240s in CI. A raw-endpoint 200 is not runtime
|
|
106173
|
+
// availability. see wiki/opencode-silent-stall.md
|
|
106174
|
+
fallback: "opencode/claude-sonnet"
|
|
106008
106175
|
},
|
|
106009
106176
|
"claude-sonnet": {
|
|
106010
106177
|
displayName: "Claude Sonnet",
|
|
@@ -106134,22 +106301,139 @@ var providers = {
|
|
|
106134
106301
|
}
|
|
106135
106302
|
}
|
|
106136
106303
|
}),
|
|
106304
|
+
// OpenCode Go is a separate $10/mo subscription from Zen, served on its own
|
|
106305
|
+
// base URL (`https://opencode.ai/zen/go/v1`) but authenticated with the SAME
|
|
106306
|
+
// `OPENCODE_API_KEY`. it carries the open-weight coding models plus a couple
|
|
106307
|
+
// of frontier ones, and 14 of the ids below are served ONLY here — Zen's
|
|
106308
|
+
// `/v1/models` does not list glm-5.3*, qwen3.7/3.8-*, mimo-*, longcat-2.0,
|
|
106309
|
+
// hy3 or muse-spark. so for a Go subscriber this provider is not a duplicate
|
|
106310
|
+
// route to Zen, it is the only route to most of what they pay for.
|
|
106311
|
+
// like `opencode` and `openrouter` this is a ROUTER, not a vendor: slugs and
|
|
106312
|
+
// display names mirror the upstream brand tier, and the picker groups them
|
|
106313
|
+
// under the upstream vendor.
|
|
106137
106314
|
"opencode-go": provider({
|
|
106138
106315
|
displayName: "OpenCode Go",
|
|
106139
106316
|
envVars: ["OPENCODE_API_KEY"],
|
|
106140
106317
|
models: {
|
|
106318
|
+
// Z.ai — the plan's flagship coding family, and the only route the
|
|
106319
|
+
// catalog offers to GLM at all.
|
|
106320
|
+
glm: {
|
|
106321
|
+
displayName: "GLM",
|
|
106322
|
+
resolve: "opencode-go/glm-5.3",
|
|
106323
|
+
effort: ["low", "high", "max"],
|
|
106324
|
+
openRouterResolve: "openrouter/z-ai/glm-5.3",
|
|
106325
|
+
preferred: true,
|
|
106326
|
+
subagentModel: "glm-flash"
|
|
106327
|
+
},
|
|
106328
|
+
"glm-flash": {
|
|
106329
|
+
displayName: "GLM Flash",
|
|
106330
|
+
resolve: "opencode-go/glm-5.3-flash",
|
|
106331
|
+
effort: ["low", "high", "max"],
|
|
106332
|
+
openRouterResolve: "openrouter/z-ai/glm-5.3-flash"
|
|
106333
|
+
},
|
|
106334
|
+
// legacy alias — the slug pinned a version instead of a brand tier and
|
|
106335
|
+
// was already resolving to 5.2 under a "GLM 5.2" label. folds forward to
|
|
106336
|
+
// the tier slug; 16 repos and 9 accounts still hold it.
|
|
106141
106337
|
"glm-5.1": {
|
|
106142
106338
|
displayName: "GLM 5.2",
|
|
106143
106339
|
resolve: "opencode-go/glm-5.2",
|
|
106144
106340
|
effort: ["high", "max"],
|
|
106145
106341
|
openRouterEffort: ["high", "xhigh"],
|
|
106146
106342
|
openRouterResolve: "openrouter/z-ai/glm-5.2",
|
|
106147
|
-
|
|
106343
|
+
fallback: "opencode-go/glm"
|
|
106344
|
+
},
|
|
106345
|
+
// Moonshot — parity with moonshotai/* and openrouter/*.
|
|
106346
|
+
"kimi-k3": {
|
|
106347
|
+
displayName: "Kimi K3",
|
|
106348
|
+
resolve: "opencode-go/kimi-k3",
|
|
106349
|
+
// Go publishes a single rung for K3 where the OpenRouter route
|
|
106350
|
+
// publishes three, so every position lands on `max` here.
|
|
106351
|
+
effort: ["max"],
|
|
106352
|
+
openRouterEffort: ["low", "high", "max"],
|
|
106353
|
+
openRouterResolve: "openrouter/moonshotai/kimi-k3",
|
|
106354
|
+
subagentModel: "kimi-k2"
|
|
106148
106355
|
},
|
|
106149
106356
|
"kimi-k2": {
|
|
106150
106357
|
displayName: "Kimi K2",
|
|
106151
106358
|
resolve: "opencode-go/kimi-k2.7-code",
|
|
106152
106359
|
openRouterResolve: "openrouter/moonshotai/kimi-k2.7-code"
|
|
106360
|
+
},
|
|
106361
|
+
// DeepSeek and Muse Spark are deliberately ABSENT even though Go serves
|
|
106362
|
+
// them and prices DeepSeek Pro below Zen. each sits behind a per-workspace
|
|
106363
|
+
// opt-in that is off by default — measured, the run dies with
|
|
106364
|
+
// `RegionError` ("only available hosted in China") and `DataPolicyError`
|
|
106365
|
+
// ("collects data used to improve its quality"). that toggle lives on the
|
|
106366
|
+
// CUSTOMER's OpenCode workspace, so no change here can satisfy it, and a
|
|
106367
|
+
// picker row that fails for almost everyone is worse than none. DeepSeek
|
|
106368
|
+
// stays reachable ungated via `deepseek/*`, `opencode/*` and
|
|
106369
|
+
// `openrouter/*`; both remain runnable by full specifier once opted in.
|
|
106370
|
+
// Alibaba — new vendor family for the catalog; Zen serves neither tier.
|
|
106371
|
+
"qwen-max": {
|
|
106372
|
+
displayName: "Qwen Max",
|
|
106373
|
+
resolve: "opencode-go/qwen3.8-max",
|
|
106374
|
+
// both routes publish rungs, and they are different sets rather than
|
|
106375
|
+
// different spellings of one — OpenRouter carries a `minimal` and a
|
|
106376
|
+
// `high` the Go route does not.
|
|
106377
|
+
effort: ["low", "medium", "xhigh"],
|
|
106378
|
+
openRouterEffort: ["minimal", "low", "medium", "high", "xhigh"],
|
|
106379
|
+
openRouterResolve: "openrouter/qwen/qwen3.8-max"
|
|
106380
|
+
},
|
|
106381
|
+
"qwen-plus": {
|
|
106382
|
+
displayName: "Qwen Plus",
|
|
106383
|
+
resolve: "opencode-go/qwen3.7-plus",
|
|
106384
|
+
openRouterResolve: "openrouter/qwen/qwen3.7-plus"
|
|
106385
|
+
},
|
|
106386
|
+
// MiniMax — parity with opencode/* and openrouter/*; the m2 slug pins the
|
|
106387
|
+
// line for DB stability while the resolve tracks the current m2.7.
|
|
106388
|
+
"minimax-m3": {
|
|
106389
|
+
displayName: "MiniMax M3",
|
|
106390
|
+
resolve: "opencode-go/minimax-m3",
|
|
106391
|
+
openRouterResolve: "openrouter/minimax/minimax-m3"
|
|
106392
|
+
},
|
|
106393
|
+
"minimax-m2.5": {
|
|
106394
|
+
displayName: "MiniMax M2",
|
|
106395
|
+
resolve: "opencode-go/minimax-m2.7",
|
|
106396
|
+
openRouterResolve: "openrouter/minimax/minimax-m2.7"
|
|
106397
|
+
},
|
|
106398
|
+
// Xiaomi — Go-only; Zen serves the free `mimo-v2-pro-free` promo instead.
|
|
106399
|
+
"mimo-pro": {
|
|
106400
|
+
displayName: "MiMo Pro",
|
|
106401
|
+
resolve: "opencode-go/mimo-v2.5-pro",
|
|
106402
|
+
openRouterResolve: "openrouter/xiaomi/mimo-v2.5-pro"
|
|
106403
|
+
},
|
|
106404
|
+
// Meituan — Go-only.
|
|
106405
|
+
longcat: {
|
|
106406
|
+
displayName: "LongCat",
|
|
106407
|
+
resolve: "opencode-go/longcat-2.0",
|
|
106408
|
+
openRouterResolve: "openrouter/meituan/longcat-2.0"
|
|
106409
|
+
},
|
|
106410
|
+
// Tencent — Go-only, and the cheapest model on the plan by an order of
|
|
106411
|
+
// magnitude (0.0175/0.0725). Hy3 succeeds the Hunyuan 2.0 line, so the
|
|
106412
|
+
// generation is part of the product name the way Kimi K2/K3 is.
|
|
106413
|
+
hy3: {
|
|
106414
|
+
displayName: "Hy3",
|
|
106415
|
+
resolve: "opencode-go/hy3",
|
|
106416
|
+
effort: ["none", "low", "high"],
|
|
106417
|
+
openRouterResolve: "openrouter/tencent/hy3"
|
|
106418
|
+
},
|
|
106419
|
+
// xAI and OpenAI — the two non-open models on the plan. same list price as
|
|
106420
|
+
// Zen, but a Go subscription covers them where Zen meters them.
|
|
106421
|
+
// Go is the only route that has retired grok-4.5 (models.dev marks
|
|
106422
|
+
// `opencode-go/grok-4.5` deprecated while every other provider still
|
|
106423
|
+
// serves it), so this alias LEADS `xai/grok` by a generation. a mirror
|
|
106424
|
+
// that leads is safe; it is the trailing case that rots — see
|
|
106425
|
+
// wiki/models-catalog.md on `opencode/kimi-k2`.
|
|
106426
|
+
grok: {
|
|
106427
|
+
displayName: "Grok",
|
|
106428
|
+
resolve: "opencode-go/grok-4.6",
|
|
106429
|
+
effort: ["low", "medium", "high", "xhigh"],
|
|
106430
|
+
openRouterResolve: "openrouter/x-ai/grok-4.6"
|
|
106431
|
+
},
|
|
106432
|
+
"gpt-luna": {
|
|
106433
|
+
displayName: "GPT Luna",
|
|
106434
|
+
resolve: "opencode-go/gpt-5.6-luna",
|
|
106435
|
+
effort: ["none", "low", "medium", "high", "xhigh", "max"],
|
|
106436
|
+
openRouterResolve: "openrouter/openai/gpt-5.6-luna"
|
|
106153
106437
|
}
|
|
106154
106438
|
}
|
|
106155
106439
|
}),
|
|
@@ -106326,7 +106610,6 @@ var providers = {
|
|
|
106326
106610
|
"o4-mini": {
|
|
106327
106611
|
displayName: "O4 Mini",
|
|
106328
106612
|
resolve: "openrouter/openai/o4-mini",
|
|
106329
|
-
effort: ["low", "medium", "high"],
|
|
106330
106613
|
openRouterResolve: "openrouter/openai/o4-mini"
|
|
106331
106614
|
},
|
|
106332
106615
|
"gemini-pro": {
|
|
@@ -106827,7 +107110,6 @@ function logTokenTable(t2) {
|
|
|
106827
107110
|
|
|
106828
107111
|
// utils/globals.ts
|
|
106829
107112
|
import { existsSync } from "node:fs";
|
|
106830
|
-
var isCloudflareSandbox = !!process.env.CLOUDFLARE_APPLICATION_ID && !!process.env.SANDBOX_VERSION;
|
|
106831
107113
|
var isGitHubActions = !!process.env.GITHUB_ACTIONS;
|
|
106832
107114
|
var isInsideDocker = existsSync("/.dockerenv");
|
|
106833
107115
|
|
|
@@ -107358,7 +107640,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
107358
107640
|
// package.json
|
|
107359
107641
|
var package_default = {
|
|
107360
107642
|
name: "pullfrog",
|
|
107361
|
-
version: "0.1.
|
|
107643
|
+
version: "0.1.65",
|
|
107362
107644
|
type: "module",
|
|
107363
107645
|
bin: {
|
|
107364
107646
|
pullfrog: "dist/cli.mjs",
|
|
@@ -125311,7 +125593,7 @@ Fuse.use = function(...plugins) {
|
|
|
125311
125593
|
};
|
|
125312
125594
|
var entry_default = Fuse;
|
|
125313
125595
|
|
|
125314
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125596
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/compose.js
|
|
125315
125597
|
var compose = (middleware, onError, onNotFound) => {
|
|
125316
125598
|
return (context, next2) => {
|
|
125317
125599
|
let index = -1;
|
|
@@ -125355,10 +125637,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
125355
125637
|
};
|
|
125356
125638
|
};
|
|
125357
125639
|
|
|
125358
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125640
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/request/constants.js
|
|
125359
125641
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
125360
125642
|
|
|
125361
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125643
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/buffer.js
|
|
125362
125644
|
var bufferToFormData = (arrayBuffer, contentType) => {
|
|
125363
125645
|
const response = new Response(arrayBuffer, {
|
|
125364
125646
|
headers: {
|
|
@@ -125369,7 +125651,9 @@ var bufferToFormData = (arrayBuffer, contentType) => {
|
|
|
125369
125651
|
return response.formData();
|
|
125370
125652
|
};
|
|
125371
125653
|
|
|
125372
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125654
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/body.js
|
|
125655
|
+
var MAX_NESTING_DEPTH = 32;
|
|
125656
|
+
var MAX_NESTED_OBJECTS = 1e4;
|
|
125373
125657
|
var isRawRequest = (request2) => "headers" in request2;
|
|
125374
125658
|
var parseBody = async (request2, options = /* @__PURE__ */ Object.create(null)) => {
|
|
125375
125659
|
const { all = false, dot = false } = options;
|
|
@@ -125402,6 +125686,7 @@ async function parseFormData(request2, options) {
|
|
|
125402
125686
|
}
|
|
125403
125687
|
function convertFormDataToBodyData(formData, options) {
|
|
125404
125688
|
const form = /* @__PURE__ */ Object.create(null);
|
|
125689
|
+
const nestingState = { count: 0 };
|
|
125405
125690
|
formData.forEach((value2, key) => {
|
|
125406
125691
|
const shouldParseAllValues = options.all || key.endsWith("[]");
|
|
125407
125692
|
if (!shouldParseAllValues) {
|
|
@@ -125414,7 +125699,7 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
125414
125699
|
Object.entries(form).forEach(([key, value2]) => {
|
|
125415
125700
|
const shouldParseDotValues = key.includes(".");
|
|
125416
125701
|
if (shouldParseDotValues) {
|
|
125417
|
-
handleParsingNestedValues(form, key, value2);
|
|
125702
|
+
handleParsingNestedValues(form, key, value2, nestingState);
|
|
125418
125703
|
delete form[key];
|
|
125419
125704
|
}
|
|
125420
125705
|
});
|
|
@@ -125437,25 +125722,34 @@ var handleParsingAllValues = (form, key, value2) => {
|
|
|
125437
125722
|
}
|
|
125438
125723
|
}
|
|
125439
125724
|
};
|
|
125440
|
-
var handleParsingNestedValues = (form, key, value2) => {
|
|
125725
|
+
var handleParsingNestedValues = (form, key, value2, state) => {
|
|
125441
125726
|
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
125442
125727
|
return;
|
|
125443
125728
|
}
|
|
125444
125729
|
let nestedForm = form;
|
|
125445
|
-
const keys = key.split(".");
|
|
125730
|
+
const keys = key.split(".", MAX_NESTING_DEPTH + 2);
|
|
125731
|
+
if (keys.length > MAX_NESTING_DEPTH + 1) {
|
|
125732
|
+
throwNestingLimitExceeded();
|
|
125733
|
+
}
|
|
125446
125734
|
keys.forEach((key2, index) => {
|
|
125447
125735
|
if (index === keys.length - 1) {
|
|
125448
125736
|
nestedForm[key2] = value2;
|
|
125449
125737
|
} else {
|
|
125450
125738
|
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
|
|
125739
|
+
if (state.count++ >= MAX_NESTED_OBJECTS) {
|
|
125740
|
+
throwNestingLimitExceeded();
|
|
125741
|
+
}
|
|
125451
125742
|
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
125452
125743
|
}
|
|
125453
125744
|
nestedForm = nestedForm[key2];
|
|
125454
125745
|
}
|
|
125455
125746
|
});
|
|
125456
125747
|
};
|
|
125748
|
+
var throwNestingLimitExceeded = () => {
|
|
125749
|
+
throw new Error("Nesting limit exceeded");
|
|
125750
|
+
};
|
|
125457
125751
|
|
|
125458
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125752
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/url.js
|
|
125459
125753
|
var splitPath = (path4) => {
|
|
125460
125754
|
const paths = path4.split("/");
|
|
125461
125755
|
if (paths[0] === "") {
|
|
@@ -125561,13 +125855,13 @@ var checkOptionalParameter = (path4) => {
|
|
|
125561
125855
|
if (segment !== "" && !/\:/.test(segment)) {
|
|
125562
125856
|
basePath += "/" + segment;
|
|
125563
125857
|
} else if (/\:/.test(segment)) {
|
|
125564
|
-
if (
|
|
125858
|
+
if (segment.charCodeAt(segment.length - 1) === 63) {
|
|
125565
125859
|
if (results.length === 0 && basePath === "") {
|
|
125566
125860
|
results.push("/");
|
|
125567
125861
|
} else {
|
|
125568
125862
|
results.push(basePath);
|
|
125569
125863
|
}
|
|
125570
|
-
const optionalSegment = segment.
|
|
125864
|
+
const optionalSegment = segment.slice(0, -1);
|
|
125571
125865
|
basePath += "/" + optionalSegment;
|
|
125572
125866
|
results.push(basePath);
|
|
125573
125867
|
} else {
|
|
@@ -125585,6 +125879,10 @@ var _decodeURI = (value2) => {
|
|
|
125585
125879
|
return tryDecodeURIComponent(value2);
|
|
125586
125880
|
};
|
|
125587
125881
|
var _getQueryParam = (url4, key, multiple) => {
|
|
125882
|
+
const hashIndex = url4.indexOf("#", 8);
|
|
125883
|
+
if (hashIndex !== -1) {
|
|
125884
|
+
url4 = url4.slice(0, hashIndex);
|
|
125885
|
+
}
|
|
125588
125886
|
let encoded;
|
|
125589
125887
|
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
125590
125888
|
let keyIndex2 = url4.indexOf("?", 8);
|
|
@@ -125657,7 +125955,7 @@ var getQueryParams = (url4, key) => {
|
|
|
125657
125955
|
};
|
|
125658
125956
|
var decodeURIComponent_ = decodeURIComponent;
|
|
125659
125957
|
|
|
125660
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125958
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/request.js
|
|
125661
125959
|
var HonoRequest = class {
|
|
125662
125960
|
/**
|
|
125663
125961
|
* `.raw` can get the raw Request object.
|
|
@@ -125701,13 +125999,13 @@ var HonoRequest = class {
|
|
|
125701
125999
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
125702
126000
|
}
|
|
125703
126001
|
#getDecodedParam(key) {
|
|
125704
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
126002
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
125705
126003
|
const param = this.#getParamValue(paramKey);
|
|
125706
126004
|
return param && tryDecodeURIComponent(param);
|
|
125707
126005
|
}
|
|
125708
126006
|
#getAllDecodedParams() {
|
|
125709
126007
|
const decoded = {};
|
|
125710
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
126008
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
125711
126009
|
for (const key of keys) {
|
|
125712
126010
|
const value2 = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
125713
126011
|
if (value2 !== void 0) {
|
|
@@ -125938,7 +126236,7 @@ var HonoRequest = class {
|
|
|
125938
126236
|
}
|
|
125939
126237
|
};
|
|
125940
126238
|
|
|
125941
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126239
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/html.js
|
|
125942
126240
|
var HtmlEscapedCallbackPhase = {
|
|
125943
126241
|
Stringify: 1,
|
|
125944
126242
|
BeforeStream: 2,
|
|
@@ -125980,7 +126278,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
125980
126278
|
}
|
|
125981
126279
|
};
|
|
125982
126280
|
|
|
125983
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126281
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/context.js
|
|
125984
126282
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
125985
126283
|
var setDefaultContentType = (contentType, headers) => {
|
|
125986
126284
|
return {
|
|
@@ -126182,6 +126480,10 @@ var Context = class {
|
|
|
126182
126480
|
* c.header('X-Message', 'Hello!')
|
|
126183
126481
|
* c.header('Content-Type', 'text/plain')
|
|
126184
126482
|
*
|
|
126483
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
126484
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
126485
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
126486
|
+
*
|
|
126185
126487
|
* return c.body('Thank you for coming')
|
|
126186
126488
|
* })
|
|
126187
126489
|
* ```
|
|
@@ -126402,7 +126704,7 @@ var Context = class {
|
|
|
126402
126704
|
};
|
|
126403
126705
|
};
|
|
126404
126706
|
|
|
126405
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126707
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router.js
|
|
126406
126708
|
var METHOD_NAME_ALL = "ALL";
|
|
126407
126709
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
126408
126710
|
var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
|
|
@@ -126410,10 +126712,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
126410
126712
|
var UnsupportedPathError = class extends Error {
|
|
126411
126713
|
};
|
|
126412
126714
|
|
|
126413
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126715
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/constants.js
|
|
126414
126716
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
126415
126717
|
|
|
126416
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126718
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/hono-base.js
|
|
126417
126719
|
var notFoundHandler = (c2) => {
|
|
126418
126720
|
return c2.text("404 Not Found", 404);
|
|
126419
126721
|
};
|
|
@@ -126790,7 +127092,10 @@ var Hono = class _Hono {
|
|
|
126790
127092
|
};
|
|
126791
127093
|
};
|
|
126792
127094
|
|
|
126793
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127095
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/utils.js
|
|
127096
|
+
var createNullObject = () => /* @__PURE__ */ Object.create(null);
|
|
127097
|
+
|
|
127098
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
126794
127099
|
var emptyParam = [];
|
|
126795
127100
|
function match(method, path4) {
|
|
126796
127101
|
const matchers2 = this.buildAllMatchers();
|
|
@@ -126811,7 +127116,7 @@ function match(method, path4) {
|
|
|
126811
127116
|
return match22(method, path4);
|
|
126812
127117
|
}
|
|
126813
127118
|
|
|
126814
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127119
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
126815
127120
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
126816
127121
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
126817
127122
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -126840,7 +127145,7 @@ var Node = class _Node {
|
|
|
126840
127145
|
// handler index of a dynamic path, or -1 for a static path terminal
|
|
126841
127146
|
#index;
|
|
126842
127147
|
#varIndex;
|
|
126843
|
-
#children =
|
|
127148
|
+
#children = createNullObject();
|
|
126844
127149
|
insert(tokens, index, paramMap, context, isStatic) {
|
|
126845
127150
|
let node2 = this;
|
|
126846
127151
|
for (let i2 = 0, len = tokens.length; i2 < len; i2++) {
|
|
@@ -126918,13 +127223,13 @@ var Node = class _Node {
|
|
|
126918
127223
|
}
|
|
126919
127224
|
};
|
|
126920
127225
|
|
|
126921
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127226
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
126922
127227
|
var Trie = class {
|
|
126923
127228
|
#context = { varIndex: 0 };
|
|
126924
127229
|
#root = new Node();
|
|
126925
127230
|
#index = 0;
|
|
126926
127231
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
126927
|
-
paths =
|
|
127232
|
+
paths = createNullObject();
|
|
126928
127233
|
insert(path4, isStatic) {
|
|
126929
127234
|
if (isStatic) {
|
|
126930
127235
|
this.#root.insert(path4.split(""), 0, [], this.#context, true);
|
|
@@ -126982,23 +127287,17 @@ var Trie = class {
|
|
|
126982
127287
|
}
|
|
126983
127288
|
};
|
|
126984
127289
|
|
|
126985
|
-
// node_modules/.pnpm/hono@4.13.
|
|
126986
|
-
var wildcardRegExpCache =
|
|
127290
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
127291
|
+
var wildcardRegExpCache = createNullObject();
|
|
126987
127292
|
function buildWildcardRegExp(path4) {
|
|
126988
127293
|
return wildcardRegExpCache[path4] ??= new RegExp(
|
|
126989
|
-
|
|
126990
|
-
|
|
126991
|
-
(
|
|
127294
|
+
`^${path4.replace(
|
|
127295
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
127296
|
+
(match22, metaChar) => metaChar ? `\\${metaChar}` : match22 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match22 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`
|
|
126992
127297
|
)}$`
|
|
126993
127298
|
);
|
|
126994
127299
|
}
|
|
126995
|
-
function clearWildcardRegExpCache() {
|
|
126996
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
126997
|
-
}
|
|
126998
127300
|
function findMiddleware(middleware, path4) {
|
|
126999
|
-
if (!middleware) {
|
|
127000
|
-
return void 0;
|
|
127001
|
-
}
|
|
127002
127301
|
for (const k2 of Object.keys(middleware).sort((a2, b) => b.length - a2.length)) {
|
|
127003
127302
|
if (buildWildcardRegExp(k2).test(path4)) {
|
|
127004
127303
|
return [...middleware[k2]];
|
|
@@ -127012,8 +127311,8 @@ var RegExpRouter = class {
|
|
|
127012
127311
|
#routes;
|
|
127013
127312
|
#tries;
|
|
127014
127313
|
constructor() {
|
|
127015
|
-
this.#middleware = { [METHOD_NAME_ALL]:
|
|
127016
|
-
this.#routes = { [METHOD_NAME_ALL]:
|
|
127314
|
+
this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
|
|
127315
|
+
this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
|
|
127017
127316
|
this.#tries = { [METHOD_NAME_ALL]: new Trie() };
|
|
127018
127317
|
}
|
|
127019
127318
|
#insertPath(method, path4) {
|
|
@@ -127026,121 +127325,90 @@ var RegExpRouter = class {
|
|
|
127026
127325
|
add(method, path4, handler2) {
|
|
127027
127326
|
const middleware = this.#middleware;
|
|
127028
127327
|
const routes = this.#routes;
|
|
127029
|
-
if (!middleware
|
|
127328
|
+
if (!middleware) {
|
|
127030
127329
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
127031
127330
|
}
|
|
127032
127331
|
if (!middleware[method]) {
|
|
127033
127332
|
this.#tries[method] = new Trie();
|
|
127034
|
-
[middleware, routes]
|
|
127035
|
-
handlerMap[method] =
|
|
127036
|
-
|
|
127333
|
+
for (const handlerMap of [middleware, routes]) {
|
|
127334
|
+
handlerMap[method] = createNullObject();
|
|
127335
|
+
for (const p in handlerMap[METHOD_NAME_ALL]) {
|
|
127037
127336
|
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
127038
127337
|
this.#insertPath(method, p);
|
|
127039
|
-
}
|
|
127040
|
-
}
|
|
127338
|
+
}
|
|
127339
|
+
}
|
|
127041
127340
|
}
|
|
127042
127341
|
if (path4 === "/*") {
|
|
127043
127342
|
path4 = "*";
|
|
127044
127343
|
}
|
|
127045
|
-
const
|
|
127344
|
+
const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
127046
127345
|
if (/\*$/.test(path4)) {
|
|
127047
127346
|
const re = buildWildcardRegExp(path4);
|
|
127048
|
-
|
|
127049
|
-
if (
|
|
127347
|
+
for (const m of methods) {
|
|
127348
|
+
if (!middleware[m][path4]) {
|
|
127050
127349
|
this.#insertPath(m, path4);
|
|
127051
127350
|
middleware[m][path4] = findMiddleware(middleware[m], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
|
|
127052
127351
|
}
|
|
127053
|
-
}
|
|
127054
|
-
|
|
127055
|
-
|
|
127056
|
-
|
|
127057
|
-
re.test(p) &&
|
|
127058
|
-
}
|
|
127059
|
-
}
|
|
127060
|
-
});
|
|
127061
|
-
Object.keys(routes).forEach((m) => {
|
|
127062
|
-
if (method === METHOD_NAME_ALL || method === m) {
|
|
127063
|
-
Object.keys(routes[m]).forEach(
|
|
127064
|
-
(p) => re.test(p) && routes[m][p].push([handler2, paramCount])
|
|
127065
|
-
);
|
|
127352
|
+
}
|
|
127353
|
+
for (const handlerMap of [middleware, routes]) {
|
|
127354
|
+
for (const m of methods) {
|
|
127355
|
+
for (const p in handlerMap[m]) {
|
|
127356
|
+
re.test(p) && handlerMap[m][p].push([handler2, path4]);
|
|
127357
|
+
}
|
|
127066
127358
|
}
|
|
127067
|
-
}
|
|
127359
|
+
}
|
|
127068
127360
|
return;
|
|
127069
127361
|
}
|
|
127070
127362
|
const paths = checkOptionalParameter(path4) || [path4];
|
|
127071
|
-
for (
|
|
127072
|
-
const
|
|
127073
|
-
|
|
127074
|
-
|
|
127075
|
-
|
|
127076
|
-
this.#insertPath(m, path22);
|
|
127077
|
-
routes[m][path22] = [
|
|
127078
|
-
...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
|
|
127079
|
-
];
|
|
127080
|
-
}
|
|
127081
|
-
routes[m][path22].push([handler2, paramCount - len + i2 + 1]);
|
|
127363
|
+
for (const path22 of paths) {
|
|
127364
|
+
for (const m of methods) {
|
|
127365
|
+
if (!routes[m][path22]) {
|
|
127366
|
+
this.#insertPath(m, path22);
|
|
127367
|
+
routes[m][path22] = findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
|
|
127082
127368
|
}
|
|
127083
|
-
|
|
127369
|
+
routes[m][path22].push([handler2, path22]);
|
|
127370
|
+
}
|
|
127084
127371
|
}
|
|
127085
127372
|
}
|
|
127086
127373
|
match = match;
|
|
127087
127374
|
buildAllMatchers() {
|
|
127088
|
-
const matchers2 =
|
|
127089
|
-
Object.keys(this.#routes)
|
|
127090
|
-
matchers2[method]
|
|
127091
|
-
}
|
|
127375
|
+
const matchers2 = createNullObject();
|
|
127376
|
+
for (const method of Object.keys(this.#routes)) {
|
|
127377
|
+
matchers2[method] = this.#buildMatcher(method);
|
|
127378
|
+
}
|
|
127092
127379
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
127093
|
-
|
|
127380
|
+
wildcardRegExpCache = createNullObject();
|
|
127094
127381
|
return matchers2;
|
|
127095
127382
|
}
|
|
127096
127383
|
#buildMatcher(method) {
|
|
127097
127384
|
const middleware = this.#middleware[method];
|
|
127098
127385
|
const routes = this.#routes[method];
|
|
127099
127386
|
const trie = this.#tries[method];
|
|
127100
|
-
const staticMap =
|
|
127387
|
+
const staticMap = createNullObject();
|
|
127101
127388
|
const handlerData = [];
|
|
127102
|
-
[
|
|
127389
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
127390
|
+
for (const r2 of [middleware, routes]) {
|
|
127103
127391
|
for (const path4 in r2) {
|
|
127104
127392
|
const handlers2 = r2[path4];
|
|
127105
127393
|
const pathData = trie.paths[path4];
|
|
127106
127394
|
if (!pathData) {
|
|
127107
|
-
staticMap[path4] = [handlers2.map(([h2]) => [h2,
|
|
127395
|
+
staticMap[path4] = [handlers2.map(([h2]) => [h2, createNullObject()]), emptyParam];
|
|
127108
127396
|
continue;
|
|
127109
127397
|
}
|
|
127110
|
-
|
|
127111
|
-
|
|
127112
|
-
|
|
127113
|
-
|
|
127114
|
-
|
|
127115
|
-
|
|
127116
|
-
|
|
127117
|
-
}
|
|
127118
|
-
return [h2, paramIndexMap];
|
|
127119
|
-
});
|
|
127120
|
-
}
|
|
127121
|
-
});
|
|
127122
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
127123
|
-
for (let i2 = 0, len = handlerData.length; i2 < len; i2++) {
|
|
127124
|
-
for (let j2 = 0, len2 = handlerData[i2].length; j2 < len2; j2++) {
|
|
127125
|
-
const map2 = handlerData[i2][j2]?.[1];
|
|
127126
|
-
if (!map2) {
|
|
127127
|
-
continue;
|
|
127128
|
-
}
|
|
127129
|
-
const keys = Object.keys(map2);
|
|
127130
|
-
for (let k2 = 0, len3 = keys.length; k2 < len3; k2++) {
|
|
127131
|
-
map2[keys[k2]] = paramReplacementMap[map2[keys[k2]]];
|
|
127132
|
-
}
|
|
127398
|
+
handlerData[pathData[0]] = handlers2.map(([h2, handlerPath]) => [
|
|
127399
|
+
h2,
|
|
127400
|
+
trie.paths[handlerPath][1].reduceRight((map2, [key], i2) => {
|
|
127401
|
+
map2[key] = paramReplacementMap[pathData[1][i2][1]];
|
|
127402
|
+
return map2;
|
|
127403
|
+
}, createNullObject())
|
|
127404
|
+
]);
|
|
127133
127405
|
}
|
|
127134
127406
|
}
|
|
127135
|
-
|
|
127136
|
-
for (const i2 in indexReplacementMap) {
|
|
127137
|
-
handlerMap[i2] = handlerData[indexReplacementMap[i2]];
|
|
127138
|
-
}
|
|
127139
|
-
return [regexp, handlerMap, staticMap];
|
|
127407
|
+
return [regexp, indexReplacementMap.map((i2) => handlerData[i2]), staticMap];
|
|
127140
127408
|
}
|
|
127141
127409
|
};
|
|
127142
127410
|
|
|
127143
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127411
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/smart-router/router.js
|
|
127144
127412
|
var SmartRouter = class {
|
|
127145
127413
|
name = "SmartRouter";
|
|
127146
127414
|
#routers = [];
|
|
@@ -127195,78 +127463,53 @@ var SmartRouter = class {
|
|
|
127195
127463
|
}
|
|
127196
127464
|
};
|
|
127197
127465
|
|
|
127198
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127199
|
-
var emptyParams =
|
|
127200
|
-
var
|
|
127201
|
-
for (const _ in children) {
|
|
127202
|
-
return true;
|
|
127203
|
-
}
|
|
127204
|
-
return false;
|
|
127205
|
-
};
|
|
127466
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/trie-router/node.js
|
|
127467
|
+
var emptyParams = createNullObject();
|
|
127468
|
+
var order = 0;
|
|
127206
127469
|
var Node2 = class _Node2 {
|
|
127207
|
-
#methods;
|
|
127208
|
-
#children;
|
|
127209
|
-
#patterns;
|
|
127210
|
-
#
|
|
127470
|
+
#methods = [];
|
|
127471
|
+
#children = createNullObject();
|
|
127472
|
+
#patterns = [];
|
|
127473
|
+
#pattern;
|
|
127211
127474
|
#params = emptyParams;
|
|
127212
|
-
constructor(method, handler2, children) {
|
|
127213
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
127214
|
-
this.#methods = [];
|
|
127215
|
-
if (method && handler2) {
|
|
127216
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
127217
|
-
m[method] = { handler: handler2, possibleKeys: [], score: 0 };
|
|
127218
|
-
this.#methods = [m];
|
|
127219
|
-
}
|
|
127220
|
-
this.#patterns = [];
|
|
127221
|
-
}
|
|
127222
127475
|
insert(method, path4, handler2) {
|
|
127223
|
-
this.#order = ++this.#order;
|
|
127224
127476
|
let curNode = this;
|
|
127225
127477
|
const parts = splitRoutingPath(path4);
|
|
127226
|
-
const possibleKeys =
|
|
127227
|
-
|
|
127228
|
-
|
|
127229
|
-
const nextP = parts[i2
|
|
127230
|
-
const pattern = getPattern(p, nextP);
|
|
127231
|
-
const
|
|
127232
|
-
|
|
127233
|
-
|
|
127234
|
-
|
|
127235
|
-
|
|
127236
|
-
|
|
127237
|
-
continue;
|
|
127478
|
+
const possibleKeys = /* @__PURE__ */ new Set();
|
|
127479
|
+
let i2 = 0;
|
|
127480
|
+
for (const p of parts) {
|
|
127481
|
+
const nextP = parts[++i2];
|
|
127482
|
+
const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
127483
|
+
const isParam = Array.isArray(pattern);
|
|
127484
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
127485
|
+
const child = curNode.#children[key] ||= new _Node2();
|
|
127486
|
+
if (pattern && !child.#pattern) {
|
|
127487
|
+
child.#pattern = pattern;
|
|
127488
|
+
curNode.#patterns.push(child);
|
|
127238
127489
|
}
|
|
127239
|
-
curNode
|
|
127240
|
-
if (
|
|
127241
|
-
|
|
127242
|
-
possibleKeys.push(pattern[1]);
|
|
127490
|
+
curNode = child;
|
|
127491
|
+
if (isParam) {
|
|
127492
|
+
possibleKeys.add(pattern[1]);
|
|
127243
127493
|
}
|
|
127244
|
-
curNode = curNode.#children[key];
|
|
127245
127494
|
}
|
|
127246
127495
|
curNode.#methods.push({
|
|
127247
127496
|
[method]: {
|
|
127248
127497
|
handler: handler2,
|
|
127249
|
-
possibleKeys: possibleKeys
|
|
127250
|
-
score:
|
|
127498
|
+
possibleKeys: [...possibleKeys],
|
|
127499
|
+
score: ++order
|
|
127251
127500
|
}
|
|
127252
127501
|
});
|
|
127253
|
-
return curNode;
|
|
127254
127502
|
}
|
|
127255
127503
|
#pushHandlerSets(handlerSets, node2, method, nodeParams, params) {
|
|
127256
127504
|
for (let i2 = 0, len = node2.#methods.length; i2 < len; i2++) {
|
|
127257
127505
|
const m = node2.#methods[i2];
|
|
127258
127506
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
127259
|
-
|
|
127260
|
-
|
|
127261
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
127507
|
+
if (handlerSet) {
|
|
127508
|
+
handlerSet.params = createNullObject();
|
|
127262
127509
|
handlerSets.push(handlerSet);
|
|
127263
|
-
|
|
127264
|
-
|
|
127265
|
-
|
|
127266
|
-
const processed = processedSet[handlerSet.score];
|
|
127267
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
127268
|
-
processedSet[handlerSet.score] = true;
|
|
127269
|
-
}
|
|
127510
|
+
for (let i22 = 0, len2 = handlerSet.possibleKeys.length; i22 < len2; i22++) {
|
|
127511
|
+
const key = handlerSet.possibleKeys[i22];
|
|
127512
|
+
handlerSet.params[key] = params?.[key] && !i22 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
127270
127513
|
}
|
|
127271
127514
|
}
|
|
127272
127515
|
}
|
|
@@ -127298,33 +127541,33 @@ var Node2 = class _Node2 {
|
|
|
127298
127541
|
tempNodes.push(nextNode);
|
|
127299
127542
|
}
|
|
127300
127543
|
}
|
|
127301
|
-
for (
|
|
127302
|
-
const pattern =
|
|
127544
|
+
for (const child of node2.#patterns) {
|
|
127545
|
+
const pattern = child.#pattern;
|
|
127303
127546
|
const params = node2.#params === emptyParams ? {} : { ...node2.#params };
|
|
127304
|
-
if (pattern === "
|
|
127305
|
-
|
|
127306
|
-
|
|
127307
|
-
|
|
127308
|
-
|
|
127309
|
-
|
|
127547
|
+
if (typeof pattern === "string") {
|
|
127548
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
127549
|
+
this.#pushHandlerSets(handlerSets, child, method, node2.#params);
|
|
127550
|
+
if (pattern === "*") {
|
|
127551
|
+
child.#params = params;
|
|
127552
|
+
tempNodes.push(child);
|
|
127553
|
+
}
|
|
127310
127554
|
}
|
|
127311
127555
|
continue;
|
|
127312
127556
|
}
|
|
127313
|
-
const [
|
|
127314
|
-
if (!part &&
|
|
127557
|
+
const [, name, matcher] = pattern;
|
|
127558
|
+
if (!part && matcher === true) {
|
|
127315
127559
|
continue;
|
|
127316
127560
|
}
|
|
127317
|
-
|
|
127318
|
-
|
|
127319
|
-
|
|
127320
|
-
partOffsets = new Array(len);
|
|
127561
|
+
if (matcher !== true) {
|
|
127562
|
+
if (!partOffsets) {
|
|
127563
|
+
partOffsets = [];
|
|
127321
127564
|
let offset = path4[0] === "/" ? 1 : 0;
|
|
127322
127565
|
for (let p = 0; p < len; p++) {
|
|
127323
127566
|
partOffsets[p] = offset;
|
|
127324
127567
|
offset += parts[p].length + 1;
|
|
127325
127568
|
}
|
|
127326
127569
|
}
|
|
127327
|
-
const restPathString = path4.
|
|
127570
|
+
const restPathString = path4.slice(partOffsets[i2]);
|
|
127328
127571
|
const m = matcher.exec(restPathString);
|
|
127329
127572
|
if (m) {
|
|
127330
127573
|
params[name] = m[0];
|
|
@@ -127338,11 +127581,12 @@ var Node2 = class _Node2 {
|
|
|
127338
127581
|
params
|
|
127339
127582
|
);
|
|
127340
127583
|
}
|
|
127341
|
-
|
|
127584
|
+
for (const _ in child.#children) {
|
|
127342
127585
|
child.#params = params;
|
|
127343
127586
|
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
127344
127587
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
127345
127588
|
targetCurNodes.push(child);
|
|
127589
|
+
break;
|
|
127346
127590
|
}
|
|
127347
127591
|
continue;
|
|
127348
127592
|
}
|
|
@@ -127370,7 +127614,7 @@ var Node2 = class _Node2 {
|
|
|
127370
127614
|
const shifted = curNodesQueue.shift();
|
|
127371
127615
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
127372
127616
|
}
|
|
127373
|
-
if (handlerSets
|
|
127617
|
+
if (handlerSets[1]) {
|
|
127374
127618
|
handlerSets.sort((a2, b) => {
|
|
127375
127619
|
return a2.score - b.score;
|
|
127376
127620
|
});
|
|
@@ -127379,29 +127623,21 @@ var Node2 = class _Node2 {
|
|
|
127379
127623
|
}
|
|
127380
127624
|
};
|
|
127381
127625
|
|
|
127382
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127626
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/trie-router/router.js
|
|
127383
127627
|
var TrieRouter = class {
|
|
127384
127628
|
name = "TrieRouter";
|
|
127385
|
-
#node;
|
|
127386
|
-
constructor() {
|
|
127387
|
-
this.#node = new Node2();
|
|
127388
|
-
}
|
|
127629
|
+
#node = new Node2();
|
|
127389
127630
|
add(method, path4, handler2) {
|
|
127390
|
-
const
|
|
127391
|
-
|
|
127392
|
-
for (let i2 = 0, len = results.length; i2 < len; i2++) {
|
|
127393
|
-
this.#node.insert(method, results[i2], handler2);
|
|
127394
|
-
}
|
|
127395
|
-
return;
|
|
127631
|
+
for (const result of checkOptionalParameter(path4) || [path4]) {
|
|
127632
|
+
this.#node.insert(method, result, handler2);
|
|
127396
127633
|
}
|
|
127397
|
-
this.#node.insert(method, path4, handler2);
|
|
127398
127634
|
}
|
|
127399
127635
|
match(method, path4) {
|
|
127400
127636
|
return this.#node.search(method, path4);
|
|
127401
127637
|
}
|
|
127402
127638
|
};
|
|
127403
127639
|
|
|
127404
|
-
// node_modules/.pnpm/hono@4.13.
|
|
127640
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/hono.js
|
|
127405
127641
|
var Hono2 = class extends Hono {
|
|
127406
127642
|
/**
|
|
127407
127643
|
* Creates an instance of the Hono class.
|
|
@@ -127416,7 +127652,7 @@ var Hono2 = class extends Hono {
|
|
|
127416
127652
|
}
|
|
127417
127653
|
};
|
|
127418
127654
|
|
|
127419
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
127655
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
127420
127656
|
import { createRequire } from "node:module";
|
|
127421
127657
|
import { randomUUID as randomUUID2, timingSafeEqual } from "node:crypto";
|
|
127422
127658
|
|
|
@@ -134672,11 +134908,11 @@ var require_dataType2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
134672
134908
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
134673
134909
|
}
|
|
134674
134910
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
134675
|
-
const
|
|
134911
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
134676
134912
|
let cond;
|
|
134677
134913
|
switch (dataType) {
|
|
134678
134914
|
case "null":
|
|
134679
|
-
return (0, codegen_1._)`${data} ${
|
|
134915
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
134680
134916
|
case "array":
|
|
134681
134917
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
134682
134918
|
break;
|
|
@@ -134690,7 +134926,7 @@ var require_dataType2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
134690
134926
|
cond = numCond();
|
|
134691
134927
|
break;
|
|
134692
134928
|
default:
|
|
134693
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
134929
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
134694
134930
|
}
|
|
134695
134931
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
134696
134932
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -143015,7 +143251,7 @@ function createMcpHandler(factory, options = {}) {
|
|
|
143015
143251
|
};
|
|
143016
143252
|
}
|
|
143017
143253
|
|
|
143018
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
143254
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
143019
143255
|
import http from "http";
|
|
143020
143256
|
import { Http2ServerRequest } from "http2";
|
|
143021
143257
|
import { Readable } from "stream";
|
|
@@ -148723,11 +148959,11 @@ var require_dataType3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
148723
148959
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
148724
148960
|
}
|
|
148725
148961
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
148726
|
-
const
|
|
148962
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
148727
148963
|
let cond;
|
|
148728
148964
|
switch (dataType) {
|
|
148729
148965
|
case "null":
|
|
148730
|
-
return (0, codegen_1._)`${data} ${
|
|
148966
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
148731
148967
|
case "array":
|
|
148732
148968
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
148733
148969
|
break;
|
|
@@ -148741,7 +148977,7 @@ var require_dataType3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
148741
148977
|
cond = numCond();
|
|
148742
148978
|
break;
|
|
148743
148979
|
default:
|
|
148744
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
148980
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
148745
148981
|
}
|
|
148746
148982
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
148747
148983
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -154420,7 +154656,7 @@ var SseError = class extends Error {
|
|
|
154420
154656
|
}
|
|
154421
154657
|
};
|
|
154422
154658
|
|
|
154423
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
154659
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
154424
154660
|
var __create4 = Object.create;
|
|
154425
154661
|
var __defProp$1 = Object.defineProperty;
|
|
154426
154662
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -154528,6 +154764,12 @@ var InMemoryEventStore = class {
|
|
|
154528
154764
|
get size() {
|
|
154529
154765
|
return this.events.size;
|
|
154530
154766
|
}
|
|
154767
|
+
/**
|
|
154768
|
+
* Keeps event IDs in stream-local insertion order so replay can walk only the
|
|
154769
|
+
* relevant stream instead of sorting the entire global event map on every
|
|
154770
|
+
* reconnect.
|
|
154771
|
+
*/
|
|
154772
|
+
eventIdsByStream = /* @__PURE__ */ new Map();
|
|
154531
154773
|
events = /* @__PURE__ */ new Map();
|
|
154532
154774
|
lastTimestamp = 0;
|
|
154533
154775
|
lastTimestampCounter = 0;
|
|
@@ -154551,15 +154793,15 @@ var InMemoryEventStore = class {
|
|
|
154551
154793
|
if (!lastEventId) return "";
|
|
154552
154794
|
const streamId = await this.getStreamIdForEventId(lastEventId);
|
|
154553
154795
|
if (!streamId) return "";
|
|
154554
|
-
|
|
154555
|
-
|
|
154556
|
-
|
|
154557
|
-
|
|
154558
|
-
|
|
154559
|
-
|
|
154560
|
-
|
|
154561
|
-
|
|
154562
|
-
|
|
154796
|
+
const eventIdsForStream = this.eventIdsByStream.get(streamId);
|
|
154797
|
+
if (!eventIdsForStream) return "";
|
|
154798
|
+
const lastEventIndex = eventIdsForStream.indexOf(lastEventId);
|
|
154799
|
+
if (lastEventIndex === -1) return "";
|
|
154800
|
+
for (let index = lastEventIndex + 1; index < eventIdsForStream.length; index++) {
|
|
154801
|
+
const eventId = eventIdsForStream[index];
|
|
154802
|
+
const storedEvent = this.events.get(eventId);
|
|
154803
|
+
if (!storedEvent) continue;
|
|
154804
|
+
await send(eventId, storedEvent.message);
|
|
154563
154805
|
}
|
|
154564
154806
|
return streamId;
|
|
154565
154807
|
}
|
|
@@ -154573,10 +154815,22 @@ var InMemoryEventStore = class {
|
|
|
154573
154815
|
message,
|
|
154574
154816
|
streamId
|
|
154575
154817
|
});
|
|
154818
|
+
const streamEvents = this.eventIdsByStream.get(streamId) ?? [];
|
|
154819
|
+
streamEvents.push(eventId);
|
|
154820
|
+
this.eventIdsByStream.set(streamId, streamEvents);
|
|
154576
154821
|
while (this.events.size > this.maxEvents) {
|
|
154577
154822
|
const oldestEventId = this.events.keys().next().value;
|
|
154578
154823
|
if (oldestEventId === void 0) break;
|
|
154824
|
+
const oldestEvent = this.events.get(oldestEventId);
|
|
154579
154825
|
this.events.delete(oldestEventId);
|
|
154826
|
+
if (oldestEvent) {
|
|
154827
|
+
const streamEventIds = this.eventIdsByStream.get(oldestEvent.streamId);
|
|
154828
|
+
if (streamEventIds) {
|
|
154829
|
+
const index = streamEventIds.indexOf(oldestEventId);
|
|
154830
|
+
if (index !== -1) streamEventIds.splice(index, 1);
|
|
154831
|
+
if (streamEventIds.length === 0) this.eventIdsByStream.delete(oldestEvent.streamId);
|
|
154832
|
+
}
|
|
154833
|
+
}
|
|
154580
154834
|
}
|
|
154581
154835
|
return eventId;
|
|
154582
154836
|
}
|
|
@@ -171141,6 +171395,34 @@ data: ${JSON.stringify(message)}
|
|
|
171141
171395
|
}
|
|
171142
171396
|
};
|
|
171143
171397
|
var DEFAULT_KEEP_ALIVE_TIMEOUT = 3e5;
|
|
171398
|
+
var addUtf8Charset = (contentType$1) => {
|
|
171399
|
+
if (/;\s*charset=/i.test(contentType$1) || !/^(application\/json|text\/event-stream)(?:\s*;|$)/i.test(contentType$1)) return contentType$1;
|
|
171400
|
+
return `${contentType$1}; charset=utf-8`;
|
|
171401
|
+
};
|
|
171402
|
+
var normalizeResponseHeaders = (headers) => {
|
|
171403
|
+
if (Array.isArray(headers)) return headers.map((value2, index) => {
|
|
171404
|
+
const headerName = headers[index - 1];
|
|
171405
|
+
if (index % 2 === 1 && typeof headerName === "string" && headerName.toLowerCase() === "content-type" && typeof value2 === "string") return addUtf8Charset(value2);
|
|
171406
|
+
return value2;
|
|
171407
|
+
});
|
|
171408
|
+
const normalizedHeaders = { ...headers };
|
|
171409
|
+
for (const [name, value2] of Object.entries(headers)) if (name.toLowerCase() === "content-type" && typeof value2 === "string") normalizedHeaders[name] = addUtf8Charset(value2);
|
|
171410
|
+
return normalizedHeaders;
|
|
171411
|
+
};
|
|
171412
|
+
var ensureUtf8ResponseCharset = (res) => {
|
|
171413
|
+
const originalWriteHead = res.writeHead.bind(res);
|
|
171414
|
+
res.writeHead = ((statusCode, statusMessageOrHeaders, headers) => {
|
|
171415
|
+
const currentContentType = res.getHeader("Content-Type");
|
|
171416
|
+
if (typeof currentContentType === "string") res.setHeader("Content-Type", addUtf8Charset(currentContentType));
|
|
171417
|
+
const responseHeaders = typeof statusMessageOrHeaders === "string" ? headers : statusMessageOrHeaders;
|
|
171418
|
+
if (responseHeaders) {
|
|
171419
|
+
const normalizedHeaders = normalizeResponseHeaders(responseHeaders);
|
|
171420
|
+
if (typeof statusMessageOrHeaders === "string") return originalWriteHead(statusCode, statusMessageOrHeaders, normalizedHeaders);
|
|
171421
|
+
return originalWriteHead(statusCode, normalizedHeaders);
|
|
171422
|
+
}
|
|
171423
|
+
return originalWriteHead(statusCode, statusMessageOrHeaders, headers);
|
|
171424
|
+
});
|
|
171425
|
+
};
|
|
171144
171426
|
var DEFAULT_SESSION_IDLE_TIMEOUT = 18e5;
|
|
171145
171427
|
var SESSION_SWEEP_INTERVAL = 6e4;
|
|
171146
171428
|
var FORCE_CLOSE_GRACE_PERIOD = 1e3;
|
|
@@ -171188,6 +171470,7 @@ var getBody = (request2, maxBodySize = DEFAULT_MAX_BODY_SIZE) => {
|
|
|
171188
171470
|
if (maxBodySize !== false) {
|
|
171189
171471
|
size += chunk.length;
|
|
171190
171472
|
if (size > maxBodySize) {
|
|
171473
|
+
request2.pause();
|
|
171191
171474
|
resolve3({
|
|
171192
171475
|
limit: maxBodySize,
|
|
171193
171476
|
tooLarge: true
|
|
@@ -171293,6 +171576,10 @@ var isScopeChallengeError = (error52) => {
|
|
|
171293
171576
|
var handleResponseError = async (error52, res) => {
|
|
171294
171577
|
if (error52 && typeof error52 === "object" && "status" in error52 && "headers" in error52 && "statusText" in error52 || error52 instanceof Response) {
|
|
171295
171578
|
const responseError = error52;
|
|
171579
|
+
if (res.headersSent) {
|
|
171580
|
+
res.end();
|
|
171581
|
+
return true;
|
|
171582
|
+
}
|
|
171296
171583
|
const fixedHeaders = {};
|
|
171297
171584
|
responseError.headers.forEach((value2, key$1) => {
|
|
171298
171585
|
if (fixedHeaders[key$1]) if (Array.isArray(fixedHeaders[key$1])) fixedHeaders[key$1].push(value2);
|
|
@@ -171368,8 +171655,9 @@ var applyCorsHeaders = (req, res, corsOptions) => {
|
|
|
171368
171655
|
else if (Array.isArray(finalCorsOptions.origin)) allowedOrigin = finalCorsOptions.origin.includes(origin.origin) ? origin.origin : "false";
|
|
171369
171656
|
else if (typeof finalCorsOptions.origin === "function") allowedOrigin = finalCorsOptions.origin(origin.origin) ? origin.origin : "false";
|
|
171370
171657
|
}
|
|
171658
|
+
res.setHeader("Vary", "Origin");
|
|
171371
171659
|
if (allowedOrigin !== "false") res.setHeader("Access-Control-Allow-Origin", allowedOrigin);
|
|
171372
|
-
if (finalCorsOptions.credentials !== void 0) res.setHeader("Access-Control-Allow-Credentials", finalCorsOptions.credentials.toString());
|
|
171660
|
+
if (finalCorsOptions.credentials !== void 0 && allowedOrigin !== "*") res.setHeader("Access-Control-Allow-Credentials", finalCorsOptions.credentials.toString());
|
|
171373
171661
|
if (finalCorsOptions.methods) res.setHeader("Access-Control-Allow-Methods", finalCorsOptions.methods.join(", "));
|
|
171374
171662
|
if (finalCorsOptions.allowedHeaders) {
|
|
171375
171663
|
const allowedHeaders = typeof finalCorsOptions.allowedHeaders === "string" ? finalCorsOptions.allowedHeaders : finalCorsOptions.allowedHeaders.join(", ");
|
|
@@ -171603,8 +171891,16 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
171603
171891
|
});
|
|
171604
171892
|
return true;
|
|
171605
171893
|
}
|
|
171606
|
-
|
|
171607
|
-
|
|
171894
|
+
try {
|
|
171895
|
+
await server.connect(transport);
|
|
171896
|
+
if (onConnect) await onConnect(server);
|
|
171897
|
+
} catch (error52) {
|
|
171898
|
+
if (!isCleaningUp) {
|
|
171899
|
+
isCleaningUp = true;
|
|
171900
|
+
await cleanupServer(server, onClose);
|
|
171901
|
+
}
|
|
171902
|
+
throw error52;
|
|
171903
|
+
}
|
|
171608
171904
|
await transport.handleRequest(req, res, body);
|
|
171609
171905
|
return true;
|
|
171610
171906
|
} else if (stateless && !sessionId && !isInitializeRequest(body)) {
|
|
@@ -171626,8 +171922,13 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
171626
171922
|
});
|
|
171627
171923
|
return true;
|
|
171628
171924
|
}
|
|
171629
|
-
|
|
171630
|
-
|
|
171925
|
+
try {
|
|
171926
|
+
await server.connect(transport);
|
|
171927
|
+
if (onConnect) await onConnect(server);
|
|
171928
|
+
} catch (error52) {
|
|
171929
|
+
await cleanupServer(server, onClose);
|
|
171930
|
+
throw error52;
|
|
171931
|
+
}
|
|
171631
171932
|
await transport.handleRequest(req, res, body);
|
|
171632
171933
|
return true;
|
|
171633
171934
|
} else {
|
|
@@ -171646,6 +171947,11 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
171646
171947
|
await transport.handleRequest(req, res, body);
|
|
171647
171948
|
return true;
|
|
171648
171949
|
} catch (error52) {
|
|
171950
|
+
if (res.headersSent) {
|
|
171951
|
+
console.error("[mcp-proxy] error handling request after headers sent", error52);
|
|
171952
|
+
res.end();
|
|
171953
|
+
return true;
|
|
171954
|
+
}
|
|
171649
171955
|
if (isScopeChallengeError(error52)) {
|
|
171650
171956
|
const response = authMiddleware.getScopeChallengeResponse(error52.data.requiredScopes, error52.data.errorDescription, body?.id);
|
|
171651
171957
|
res.writeHead(response.statusCode, response.headers);
|
|
@@ -171691,7 +171997,13 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
171691
171997
|
if (lastEventId) console.log(`[mcp-proxy] client reconnecting with Last-Event-ID ${lastEventId} for session ID ${sessionId}`);
|
|
171692
171998
|
else console.log(`[mcp-proxy] establishing new SSE stream for session ID ${sessionId}`);
|
|
171693
171999
|
trackSessionStream(activeTransport, res);
|
|
171694
|
-
|
|
172000
|
+
try {
|
|
172001
|
+
await activeTransport.transport.handleRequest(req, res);
|
|
172002
|
+
} catch (error52) {
|
|
172003
|
+
console.error("[mcp-proxy] error handling stream request", error52);
|
|
172004
|
+
if (res.headersSent) res.end();
|
|
172005
|
+
else res.writeHead(500).end("Error handling request");
|
|
172006
|
+
}
|
|
171695
172007
|
return true;
|
|
171696
172008
|
}
|
|
171697
172009
|
if (req.method === "DELETE" && new URL(req.url, "http://localhost").pathname === endpoint2) {
|
|
@@ -171801,6 +172113,7 @@ var startHTTPServer = async ({ apiKey, authenticate, cors, createServer: createS
|
|
|
171801
172113
|
onListenSubscriptions
|
|
171802
172114
|
}) : void 0;
|
|
171803
172115
|
const requestListener = async (req, res) => {
|
|
172116
|
+
ensureUtf8ResponseCharset(res);
|
|
171804
172117
|
applyCorsHeaders(req, res, cors);
|
|
171805
172118
|
if (req.method === "OPTIONS") {
|
|
171806
172119
|
res.writeHead(204);
|
|
@@ -182307,7 +182620,7 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
182307
182620
|
let lastEmittedSeq = -2;
|
|
182308
182621
|
let seq = 0;
|
|
182309
182622
|
let hasChanges = false;
|
|
182310
|
-
function
|
|
182623
|
+
function emit2(line) {
|
|
182311
182624
|
if (lastEmittedSeq >= 0 && line.seq > lastEmittedSeq + 1) out += (out ? "\n" : "") + "...";
|
|
182312
182625
|
out += (out ? "\n" : "") + line.prefix + raw2.slice(line.from, line.to);
|
|
182313
182626
|
lastEmittedSeq = line.seq;
|
|
@@ -182315,10 +182628,10 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
182315
182628
|
if (lastHunkHdr?.seq === line.seq) hunkHdrEmitted = true;
|
|
182316
182629
|
}
|
|
182317
182630
|
function flushBefore() {
|
|
182318
|
-
if (lastFileHdr && !fileHdrEmitted)
|
|
182319
|
-
if (lastHunkHdr && !hunkHdrEmitted)
|
|
182631
|
+
if (lastFileHdr && !fileHdrEmitted) emit2(lastFileHdr);
|
|
182632
|
+
if (lastHunkHdr && !hunkHdrEmitted) emit2(lastHunkHdr);
|
|
182320
182633
|
for (const line of beforeBuf) {
|
|
182321
|
-
if (line.seq > lastEmittedSeq)
|
|
182634
|
+
if (line.seq > lastEmittedSeq) emit2(line);
|
|
182322
182635
|
}
|
|
182323
182636
|
beforeBuf.length = 0;
|
|
182324
182637
|
}
|
|
@@ -182357,10 +182670,10 @@ function postProcessRangeDiff(raw2, contextLines = 3) {
|
|
|
182357
182670
|
if (isChange) {
|
|
182358
182671
|
hasChanges = true;
|
|
182359
182672
|
flushBefore();
|
|
182360
|
-
|
|
182673
|
+
emit2(line);
|
|
182361
182674
|
afterRemaining = contextLines;
|
|
182362
182675
|
} else if (afterRemaining > 0) {
|
|
182363
|
-
|
|
182676
|
+
emit2(line);
|
|
182364
182677
|
afterRemaining--;
|
|
182365
182678
|
} else {
|
|
182366
182679
|
if (beforeBuf.length >= contextLines) beforeBuf.shift();
|
|
@@ -184173,10 +184486,111 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
184173
184486
|
}
|
|
184174
184487
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
184175
184488
|
|
|
184176
|
-
// node_modules/.pnpm
|
|
184177
|
-
var
|
|
184489
|
+
// node_modules/.pnpm/content-type@3.0.0/node_modules/content-type/dist/index.js
|
|
184490
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
184491
|
+
const C = function() {
|
|
184492
|
+
};
|
|
184493
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
184494
|
+
return C;
|
|
184495
|
+
})();
|
|
184496
|
+
function parse5(header, options) {
|
|
184497
|
+
const stopChar = options?.comma === true ? COMMA : 65536;
|
|
184498
|
+
const len = header.length;
|
|
184499
|
+
let index = skipOWS(header, options?.start ?? 0, len);
|
|
184500
|
+
const valueStart = index;
|
|
184501
|
+
index = skipValue(header, index, len, stopChar);
|
|
184502
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
184503
|
+
const type2 = header.slice(valueStart, valueEnd).toLowerCase();
|
|
184504
|
+
if (options?.parameters === false) {
|
|
184505
|
+
return { type: type2, index, parameters: new NullObject() };
|
|
184506
|
+
}
|
|
184507
|
+
return parseParameters(header, type2, index, len, stopChar);
|
|
184508
|
+
}
|
|
184509
|
+
var SP = 32;
|
|
184510
|
+
var HTAB = 9;
|
|
184511
|
+
var SEMI = 59;
|
|
184512
|
+
var EQ = 61;
|
|
184513
|
+
var DQUOTE = 34;
|
|
184514
|
+
var BSLASH = 92;
|
|
184515
|
+
var COMMA = 44;
|
|
184516
|
+
function parseParameters(header, type2, index, len, stopChar) {
|
|
184517
|
+
const parameters = new NullObject();
|
|
184518
|
+
parameter: while (index < len) {
|
|
184519
|
+
if (header.charCodeAt(index) === stopChar)
|
|
184520
|
+
break;
|
|
184521
|
+
index = skipOWS(header, index + 1, len);
|
|
184522
|
+
const keyStart = index;
|
|
184523
|
+
while (index < len) {
|
|
184524
|
+
const code = header.charCodeAt(index);
|
|
184525
|
+
if (code === stopChar)
|
|
184526
|
+
break parameter;
|
|
184527
|
+
if (code === SEMI)
|
|
184528
|
+
continue parameter;
|
|
184529
|
+
if (code === EQ) {
|
|
184530
|
+
const keyEnd = trailingOWS(header, keyStart, index);
|
|
184531
|
+
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
184532
|
+
index = skipOWS(header, index + 1, len);
|
|
184533
|
+
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
184534
|
+
index++;
|
|
184535
|
+
let value2 = "";
|
|
184536
|
+
while (index < len) {
|
|
184537
|
+
const code2 = header.charCodeAt(index++);
|
|
184538
|
+
if (code2 === DQUOTE) {
|
|
184539
|
+
index = skipValue(header, index, len, stopChar);
|
|
184540
|
+
if (parameters[key] === void 0)
|
|
184541
|
+
parameters[key] = value2;
|
|
184542
|
+
break;
|
|
184543
|
+
}
|
|
184544
|
+
if (code2 === BSLASH && index < len) {
|
|
184545
|
+
value2 += header[index++];
|
|
184546
|
+
continue;
|
|
184547
|
+
}
|
|
184548
|
+
value2 += String.fromCharCode(code2);
|
|
184549
|
+
}
|
|
184550
|
+
continue parameter;
|
|
184551
|
+
}
|
|
184552
|
+
const valueStart = index;
|
|
184553
|
+
index = skipValue(header, index, len, stopChar);
|
|
184554
|
+
if (parameters[key] === void 0) {
|
|
184555
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
184556
|
+
parameters[key] = header.slice(valueStart, valueEnd);
|
|
184557
|
+
}
|
|
184558
|
+
continue parameter;
|
|
184559
|
+
}
|
|
184560
|
+
index++;
|
|
184561
|
+
}
|
|
184562
|
+
}
|
|
184563
|
+
return { type: type2, index, parameters };
|
|
184564
|
+
}
|
|
184565
|
+
function skipValue(str, index, len, stopChar) {
|
|
184566
|
+
while (index < len) {
|
|
184567
|
+
const code = str.charCodeAt(index);
|
|
184568
|
+
if (code === SEMI || code === stopChar)
|
|
184569
|
+
break;
|
|
184570
|
+
index++;
|
|
184571
|
+
}
|
|
184572
|
+
return index;
|
|
184573
|
+
}
|
|
184574
|
+
function skipOWS(header, index, len) {
|
|
184575
|
+
while (index < len) {
|
|
184576
|
+
const char = header.charCodeAt(index);
|
|
184577
|
+
if (char !== SP && char !== HTAB)
|
|
184578
|
+
break;
|
|
184579
|
+
index++;
|
|
184580
|
+
}
|
|
184581
|
+
return index;
|
|
184582
|
+
}
|
|
184583
|
+
function trailingOWS(header, start, end) {
|
|
184584
|
+
while (end > start) {
|
|
184585
|
+
const char = header.charCodeAt(end - 1);
|
|
184586
|
+
if (char !== SP && char !== HTAB)
|
|
184587
|
+
break;
|
|
184588
|
+
end--;
|
|
184589
|
+
}
|
|
184590
|
+
return end;
|
|
184591
|
+
}
|
|
184178
184592
|
|
|
184179
|
-
// node_modules/.pnpm/json-with-bigint@3.5.
|
|
184593
|
+
// node_modules/.pnpm/json-with-bigint@3.5.12/node_modules/json-with-bigint/json-with-bigint.js
|
|
184180
184594
|
var intRegex = /^-?\d+$/;
|
|
184181
184595
|
var noiseValue = /^-?\d+n+$/;
|
|
184182
184596
|
var originalStringify = JSON.stringify;
|
|
@@ -184433,7 +184847,7 @@ var JSONParseV2 = (text, reviver) => {
|
|
|
184433
184847
|
};
|
|
184434
184848
|
var MAX_INT = Number.MAX_SAFE_INTEGER.toString();
|
|
184435
184849
|
var MAX_DIGITS = MAX_INT.length;
|
|
184436
|
-
var stringsOrLargeNumbers = /"(
|
|
184850
|
+
var stringsOrLargeNumbers = /"(?:[^"\\]|\\.)*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
|
|
184437
184851
|
var noiseValueWithQuotes = /^"-?\d+n+"$/;
|
|
184438
184852
|
var applyReviverIteratively = (parsed2, userReviver) => {
|
|
184439
184853
|
const rootHolder = { "": parsed2 };
|
|
@@ -184550,8 +184964,8 @@ var RequestError2 = class extends Error {
|
|
|
184550
184964
|
}
|
|
184551
184965
|
};
|
|
184552
184966
|
|
|
184553
|
-
// node_modules/.pnpm/@octokit+request@10.0.
|
|
184554
|
-
var VERSION3 = "10.0.
|
|
184967
|
+
// node_modules/.pnpm/@octokit+request@10.0.15/node_modules/@octokit/request/dist-bundle/index.js
|
|
184968
|
+
var VERSION3 = "10.0.15";
|
|
184555
184969
|
var defaults_default = {
|
|
184556
184970
|
headers: {
|
|
184557
184971
|
"user-agent": `octokit-request.js/${VERSION3} ${getUserAgent2()}`
|
|
@@ -184669,7 +185083,7 @@ async function getResponseData(response) {
|
|
|
184669
185083
|
if (!contentType) {
|
|
184670
185084
|
return response.text().catch(noop2);
|
|
184671
185085
|
}
|
|
184672
|
-
const mimetype = (
|
|
185086
|
+
const mimetype = parse5(contentType);
|
|
184673
185087
|
if (isJSONResponse(mimetype)) {
|
|
184674
185088
|
let text = "";
|
|
184675
185089
|
try {
|
|
@@ -188041,7 +188455,7 @@ function resolveRepoCtx(ctx, repo) {
|
|
|
188041
188455
|
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
|
188042
188456
|
var LIST_ITEM_MARKER = "-";
|
|
188043
188457
|
var LIST_ITEM_PREFIX = "- ";
|
|
188044
|
-
var
|
|
188458
|
+
var COMMA2 = ",";
|
|
188045
188459
|
var PIPE = "|";
|
|
188046
188460
|
var DOT = ".";
|
|
188047
188461
|
var NULL_LITERAL = "null";
|
|
@@ -188051,7 +188465,7 @@ var BACKSLASH = "\\";
|
|
|
188051
188465
|
var DOUBLE_QUOTE = '"';
|
|
188052
188466
|
var TAB = " ";
|
|
188053
188467
|
var DELIMITERS = {
|
|
188054
|
-
comma:
|
|
188468
|
+
comma: COMMA2,
|
|
188055
188469
|
tab: TAB,
|
|
188056
188470
|
pipe: PIPE
|
|
188057
188471
|
};
|
|
@@ -188196,7 +188610,7 @@ function encodeAndJoinPrimitives(values, delimiter2 = DEFAULT_DELIMITER) {
|
|
|
188196
188610
|
function formatHeader(length, options) {
|
|
188197
188611
|
const key = options?.key;
|
|
188198
188612
|
const fields = options?.fields;
|
|
188199
|
-
const delimiter2 = options?.delimiter ??
|
|
188613
|
+
const delimiter2 = options?.delimiter ?? COMMA2;
|
|
188200
188614
|
let header = "";
|
|
188201
188615
|
if (key) header += encodeKey(key);
|
|
188202
188616
|
header += `[${length}${delimiter2 !== DEFAULT_DELIMITER ? delimiter2 : ""}]`;
|
|
@@ -194620,116 +195034,16 @@ function subagentDeniedToolNames(ctx, outputSchema) {
|
|
|
194620
195034
|
return names;
|
|
194621
195035
|
}
|
|
194622
195036
|
|
|
194623
|
-
// utils/agent.ts
|
|
194624
|
-
function hasEnvVar2(name) {
|
|
194625
|
-
const val = process.env[name];
|
|
194626
|
-
return typeof val === "string" && val.length > 0;
|
|
194627
|
-
}
|
|
194628
|
-
function hasClaudeCodeAuth() {
|
|
194629
|
-
return hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN") || hasEnvVar2("ANTHROPIC_API_KEY") || hasEnvVar2("ANTHROPIC_AUTH_TOKEN");
|
|
194630
|
-
}
|
|
194631
|
-
function hasCodexAuth() {
|
|
194632
|
-
return hasEnvVar2("CODEX_AUTH_JSON") || hasEnvVar2("OPENAI_API_KEY");
|
|
194633
|
-
}
|
|
194634
|
-
function hasBedrockAuth() {
|
|
194635
|
-
return hasEnvVar2("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar2("AWS_ACCESS_KEY_ID") && hasEnvVar2("AWS_SECRET_ACCESS_KEY");
|
|
194636
|
-
}
|
|
194637
|
-
function hasVertexAuth() {
|
|
194638
|
-
return hasEnvVar2(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
194639
|
-
}
|
|
194640
|
-
function resolveSlug(slug2) {
|
|
194641
|
-
const alias = resolveDisplayAlias(slug2);
|
|
194642
|
-
if (alias?.routing === "bedrock") {
|
|
194643
|
-
const bedrockId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
194644
|
-
if (!bedrockId) {
|
|
194645
|
-
throw new Error(
|
|
194646
|
-
`${BEDROCK_MODEL_ID_ENV} env var is required when the model is set to "${slug2}". set it to an AWS Bedrock model ID from the Bedrock console. see https://docs.pullfrog.com/bedrock for setup.`
|
|
194647
|
-
);
|
|
194648
|
-
}
|
|
194649
|
-
return bedrockId;
|
|
194650
|
-
}
|
|
194651
|
-
if (alias?.routing === "vertex") {
|
|
194652
|
-
const vertexId = process.env[VERTEX_MODEL_ID_ENV]?.trim();
|
|
194653
|
-
if (!vertexId) {
|
|
194654
|
-
throw new Error(
|
|
194655
|
-
`${VERTEX_MODEL_ID_ENV} env var is required when the model is set to "${slug2}". set it to a Google Vertex AI model ID from Model Garden. see https://docs.pullfrog.com/vertex for setup.`
|
|
194656
|
-
);
|
|
194657
|
-
}
|
|
194658
|
-
return vertexId;
|
|
194659
|
-
}
|
|
194660
|
-
if (alias?.routing === "azure") {
|
|
194661
|
-
const deployment = process.env[AZURE_DEPLOYMENT_ENV]?.trim();
|
|
194662
|
-
if (!deployment) {
|
|
194663
|
-
throw new Error(
|
|
194664
|
-
`${AZURE_DEPLOYMENT_ENV} env var is required when the model is set to "${slug2}". set it to the name of your Azure OpenAI deployment (not the model it serves \u2014 Azure routes on the deployment name). see https://docs.pullfrog.com/azure for setup.`
|
|
194665
|
-
);
|
|
194666
|
-
}
|
|
194667
|
-
return `${AZURE_PROVIDER}/${deployment}`;
|
|
194668
|
-
}
|
|
194669
|
-
if (alias?.routing === "openai-compatible") {
|
|
194670
|
-
const modelId = process.env[OPENAI_COMPATIBLE_MODEL_ENV]?.trim();
|
|
194671
|
-
if (!modelId) {
|
|
194672
|
-
throw new Error(
|
|
194673
|
-
`${OPENAI_COMPATIBLE_MODEL_ENV} env var is required when the model is set to "${slug2}". set it to the model ID served by your OpenAI-compatible endpoint (e.g. a Cloudflare AI Gateway or DashScope model). see https://docs.pullfrog.com/openai-compatible for setup.`
|
|
194674
|
-
);
|
|
194675
|
-
}
|
|
194676
|
-
return `${OPENAI_COMPATIBLE_PROVIDER}/${modelId}`;
|
|
194677
|
-
}
|
|
194678
|
-
return resolveCliModel(slug2);
|
|
194679
|
-
}
|
|
194680
|
-
function resolveModel(ctx) {
|
|
194681
|
-
const envModel = process.env.PULLFROG_MODEL?.trim();
|
|
194682
|
-
if (envModel) {
|
|
194683
|
-
return resolveSlug(envModel) ?? envModel;
|
|
194684
|
-
}
|
|
194685
|
-
const slug2 = ctx.slug?.trim();
|
|
194686
|
-
if (slug2) {
|
|
194687
|
-
const resolved = resolveSlug(slug2);
|
|
194688
|
-
if (resolved) {
|
|
194689
|
-
return resolved;
|
|
194690
|
-
}
|
|
194691
|
-
if (slug2.includes("/")) {
|
|
194692
|
-
log2.info(`\xBB "${slug2}" is not a curated alias \u2014 passing through as a raw model specifier`);
|
|
194693
|
-
return slug2;
|
|
194694
|
-
}
|
|
194695
|
-
log2.warning(`\xBB unknown model slug "${slug2}" \u2014 agent will auto-select`);
|
|
194696
|
-
}
|
|
194697
|
-
return void 0;
|
|
194698
|
-
}
|
|
194699
|
-
function resolveAgent(ctx) {
|
|
194700
|
-
const envAgent = process.env.PULLFROG_AGENT?.trim();
|
|
194701
|
-
if (envAgent) {
|
|
194702
|
-
if (envAgent in agents) {
|
|
194703
|
-
return agents[envAgent];
|
|
194704
|
-
}
|
|
194705
|
-
log2.warning(`\xBB unknown PULLFROG_AGENT="${envAgent}" \u2014 falling through to auto-select`);
|
|
194706
|
-
}
|
|
194707
|
-
if (ctx.proxyModel) return agents.opencode;
|
|
194708
|
-
if (ctx.model && hasBedrockAuth() && process.env[BEDROCK_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
194709
|
-
return isBedrockAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
194710
|
-
}
|
|
194711
|
-
if (ctx.model && hasVertexAuth() && process.env[VERTEX_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
194712
|
-
return isVertexAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
194713
|
-
}
|
|
194714
|
-
if (ctx.model) {
|
|
194715
|
-
try {
|
|
194716
|
-
const provider2 = getModelProvider(ctx.model);
|
|
194717
|
-
if (provider2 === "anthropic" && hasClaudeCodeAuth()) return agents.claude;
|
|
194718
|
-
if (provider2 === "openai" && ctx.codexAgent && hasCodexAuth()) return agents.codex;
|
|
194719
|
-
} catch {
|
|
194720
|
-
}
|
|
194721
|
-
}
|
|
194722
|
-
if (!ctx.model) {
|
|
194723
|
-
if (hasEnvVar2("ANTHROPIC_AUTH_TOKEN") && !hasEnvVar2("ANTHROPIC_API_KEY") && !hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN")) {
|
|
194724
|
-
return agents.claude;
|
|
194725
|
-
}
|
|
194726
|
-
if (ctx.codexAgent && hasCodexAuth() && !hasClaudeCodeAuth()) return agents.codex;
|
|
194727
|
-
}
|
|
194728
|
-
return agents.opencode;
|
|
194729
|
-
}
|
|
194730
|
-
|
|
194731
195037
|
// utils/apiKeys.ts
|
|
194732
195038
|
var MISSING_KEY_MARKER = "no API key found";
|
|
195039
|
+
var BYOK_SLUG_MARKER = "env var is required when the model is set to";
|
|
195040
|
+
var BYOK_CONFIG_MARKER = "selected but required configuration is missing:";
|
|
195041
|
+
var BYOK_SETUP_PATTERN = new RegExp(
|
|
195042
|
+
`^(?:[A-Z][A-Z0-9_]+ ${BYOK_SLUG_MARKER}|[A-Z][\\w-]*(?: [\\w-]+){0,3} ${BYOK_CONFIG_MARKER})`
|
|
195043
|
+
);
|
|
195044
|
+
function isByokSetupError(text) {
|
|
195045
|
+
return BYOK_SETUP_PATTERN.test(text);
|
|
195046
|
+
}
|
|
194733
195047
|
var SECRETS_UNAVAILABLE_MARKER = "couldn't load your Pullfrog secrets";
|
|
194734
195048
|
var ROUTER_UNFUNDED_MARKER = "your Pullfrog Router balance is empty";
|
|
194735
195049
|
var CREDENTIAL_REJECTED_MARKER = "was rejected by its provider";
|
|
@@ -194778,7 +195092,7 @@ function buildMissingApiKeyError(params) {
|
|
|
194778
195092
|
}
|
|
194779
195093
|
function buildBedrockSetupError(params) {
|
|
194780
195094
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
194781
|
-
return `Bedrock model
|
|
195095
|
+
return `Bedrock model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
194782
195096
|
|
|
194783
195097
|
add the missing secret(s) to your GitHub repository at ${githubSecretsUrl}, then reference them in your workflow's \`env:\` block:
|
|
194784
195098
|
|
|
@@ -194792,7 +195106,7 @@ for full setup instructions, see https://docs.pullfrog.com/bedrock`;
|
|
|
194792
195106
|
}
|
|
194793
195107
|
function buildVertexSetupError(params) {
|
|
194794
195108
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
194795
|
-
return `Google Vertex AI model
|
|
195109
|
+
return `Google Vertex AI model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
194796
195110
|
|
|
194797
195111
|
add the missing secret(s) to your GitHub repository at ${githubSecretsUrl}, then reference them in your workflow's \`env:\` block:
|
|
194798
195112
|
|
|
@@ -194805,7 +195119,7 @@ for full setup instructions, see https://docs.pullfrog.com/vertex`;
|
|
|
194805
195119
|
}
|
|
194806
195120
|
function buildOpenAICompatibleSetupError(params) {
|
|
194807
195121
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
194808
|
-
return `OpenAI-compatible model
|
|
195122
|
+
return `OpenAI-compatible model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
194809
195123
|
|
|
194810
195124
|
only the API key is sensitive \u2014 add it as a secret at ${githubSecretsUrl}. everything else is plain workflow \`env:\`:
|
|
194811
195125
|
|
|
@@ -194824,7 +195138,7 @@ for full setup instructions, see https://docs.pullfrog.com/openai-compatible`;
|
|
|
194824
195138
|
}
|
|
194825
195139
|
function buildAzureSetupError(params) {
|
|
194826
195140
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
194827
|
-
return `Azure OpenAI
|
|
195141
|
+
return `Azure OpenAI ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
194828
195142
|
|
|
194829
195143
|
only the API key is sensitive \u2014 add it as a secret at ${githubSecretsUrl}. the rest is plain workflow \`env:\`:
|
|
194830
195144
|
|
|
@@ -194845,22 +195159,22 @@ is disabled, so long runs grow until Azure refuses them.
|
|
|
194845
195159
|
|
|
194846
195160
|
for full setup instructions, see https://docs.pullfrog.com/azure`;
|
|
194847
195161
|
}
|
|
194848
|
-
function
|
|
195162
|
+
function hasEnvVar2(name) {
|
|
194849
195163
|
const value2 = process.env[name];
|
|
194850
195164
|
return typeof value2 === "string" && value2.length > 0;
|
|
194851
195165
|
}
|
|
194852
195166
|
function modelHasRuntimeAuth(model) {
|
|
194853
195167
|
const authVars = [...getModelEnvVars(model), ...getModelManagedCredentials(model)];
|
|
194854
|
-
return authVars.length === 0 || authVars.some(
|
|
195168
|
+
return authVars.length === 0 || authVars.some(hasEnvVar2);
|
|
194855
195169
|
}
|
|
194856
195170
|
function hasPositiveNumberEnvVar(name) {
|
|
194857
195171
|
return Number(process.env[name]) > 0;
|
|
194858
195172
|
}
|
|
194859
195173
|
function validateOpenAICompatibleSetup(params) {
|
|
194860
195174
|
const missing = [];
|
|
194861
|
-
if (!
|
|
194862
|
-
if (!
|
|
194863
|
-
if (!
|
|
195175
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_BASE_URL_ENV)) missing.push(OPENAI_COMPATIBLE_BASE_URL_ENV);
|
|
195176
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_API_KEY_ENV)) missing.push(OPENAI_COMPATIBLE_API_KEY_ENV);
|
|
195177
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_MODEL_ENV)) missing.push(OPENAI_COMPATIBLE_MODEL_ENV);
|
|
194864
195178
|
if (!hasPositiveNumberEnvVar(OPENAI_COMPATIBLE_CONTEXT_ENV))
|
|
194865
195179
|
missing.push(OPENAI_COMPATIBLE_CONTEXT_ENV);
|
|
194866
195180
|
if (!hasPositiveNumberEnvVar(OPENAI_COMPATIBLE_MAX_OUTPUT_ENV))
|
|
@@ -194873,9 +195187,9 @@ function validateOpenAICompatibleSetup(params) {
|
|
|
194873
195187
|
}
|
|
194874
195188
|
function validateAzureSetup(params) {
|
|
194875
195189
|
const missing = [];
|
|
194876
|
-
if (!
|
|
194877
|
-
if (!
|
|
194878
|
-
if (!
|
|
195190
|
+
if (!hasEnvVar2(AZURE_API_KEY_ENV)) missing.push(AZURE_API_KEY_ENV);
|
|
195191
|
+
if (!hasEnvVar2(AZURE_RESOURCE_NAME_ENV)) missing.push(AZURE_RESOURCE_NAME_ENV);
|
|
195192
|
+
if (!hasEnvVar2(AZURE_DEPLOYMENT_ENV)) missing.push(AZURE_DEPLOYMENT_ENV);
|
|
194879
195193
|
if (!hasPositiveNumberEnvVar(AZURE_CONTEXT_ENV)) missing.push(AZURE_CONTEXT_ENV);
|
|
194880
195194
|
if (!hasPositiveNumberEnvVar(AZURE_MAX_OUTPUT_ENV)) missing.push(AZURE_MAX_OUTPUT_ENV);
|
|
194881
195195
|
if (missing.length > 0) {
|
|
@@ -194883,33 +195197,33 @@ function validateAzureSetup(params) {
|
|
|
194883
195197
|
}
|
|
194884
195198
|
}
|
|
194885
195199
|
function validateBedrockSetup(params) {
|
|
194886
|
-
const hasAuth =
|
|
195200
|
+
const hasAuth = hasEnvVar2("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar2("AWS_ACCESS_KEY_ID") && hasEnvVar2("AWS_SECRET_ACCESS_KEY");
|
|
194887
195201
|
const missing = [];
|
|
194888
195202
|
if (!hasAuth)
|
|
194889
195203
|
missing.push("AWS_BEARER_TOKEN_BEDROCK (or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)");
|
|
194890
|
-
if (!
|
|
194891
|
-
if (!
|
|
195204
|
+
if (!hasEnvVar2("AWS_REGION")) missing.push("AWS_REGION");
|
|
195205
|
+
if (!hasEnvVar2(BEDROCK_MODEL_ID_ENV)) missing.push(BEDROCK_MODEL_ID_ENV);
|
|
194892
195206
|
if (missing.length > 0) {
|
|
194893
195207
|
throw new Error(buildBedrockSetupError({ owner: params.owner, name: params.name, missing }));
|
|
194894
195208
|
}
|
|
194895
195209
|
}
|
|
194896
195210
|
function validateVertexSetup(params) {
|
|
194897
|
-
const hasAuth =
|
|
194898
|
-
const hasProject =
|
|
195211
|
+
const hasAuth = hasEnvVar2(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
195212
|
+
const hasProject = hasEnvVar2(GOOGLE_CLOUD_PROJECT_ENV) || readProjectIdFromVertexServiceAccountJson() !== void 0;
|
|
194899
195213
|
const missing = [];
|
|
194900
195214
|
if (!hasAuth) missing.push(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
194901
195215
|
if (!hasProject) missing.push(GOOGLE_CLOUD_PROJECT_ENV);
|
|
194902
|
-
if (!
|
|
194903
|
-
if (!
|
|
195216
|
+
if (!hasEnvVar2(VERTEX_LOCATION_ENV)) missing.push(VERTEX_LOCATION_ENV);
|
|
195217
|
+
if (!hasEnvVar2(VERTEX_MODEL_ID_ENV)) missing.push(VERTEX_MODEL_ID_ENV);
|
|
194904
195218
|
if (missing.length > 0) {
|
|
194905
195219
|
throw new Error(buildVertexSetupError({ owner: params.owner, name: params.name, missing }));
|
|
194906
195220
|
}
|
|
194907
195221
|
}
|
|
194908
195222
|
function hasSingleProviderAuth(agentName) {
|
|
194909
195223
|
if (agentName === "codex") {
|
|
194910
|
-
return
|
|
195224
|
+
return hasEnvVar2("OPENAI_API_KEY") || hasEnvVar2("CODEX_AUTH_JSON");
|
|
194911
195225
|
}
|
|
194912
|
-
return
|
|
195226
|
+
return hasEnvVar2("ANTHROPIC_API_KEY") || hasEnvVar2("ANTHROPIC_AUTH_TOKEN") || hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN");
|
|
194913
195227
|
}
|
|
194914
195228
|
function validateAgentApiKey(params) {
|
|
194915
195229
|
if (params.model) {
|
|
@@ -194942,7 +195256,7 @@ function validateAgentApiKey(params) {
|
|
|
194942
195256
|
if (params.authorized.has(params.model)) return;
|
|
194943
195257
|
const reason = getModelsFailure();
|
|
194944
195258
|
if (reason) throw new Error(reason);
|
|
194945
|
-
if (getModelEnvVars(params.model).some(
|
|
195259
|
+
if (getModelEnvVars(params.model).some(hasEnvVar2)) return;
|
|
194946
195260
|
throw new Error(
|
|
194947
195261
|
buildKeyError({
|
|
194948
195262
|
owner: params.owner,
|
|
@@ -194989,7 +195303,7 @@ function validateAgentApiKey(params) {
|
|
|
194989
195303
|
}
|
|
194990
195304
|
function isApiKeyAuthError(text) {
|
|
194991
195305
|
if (!text) return false;
|
|
194992
|
-
return text.includes(MISSING_KEY_MARKER) || /Invalid API key/i.test(text) || /\bUser not found\b/i.test(text) || /\bInvalid authentication\b/i.test(text) || /authentication_error/i.test(text) || /Invalid bearer token/i.test(text) || /api_error_status\s*=\s*401/i.test(text) || /API Error:\s*401/i.test(text) || /Failed to authenticate\. API Error:/i.test(text) || /Your api key:.*is invalid/i.test(text) || isMalformedKeyError(text) || isClaudeSubscriptionDisabledError(text) || isClaudeSessionLimitError(text) || isOAuthCredentialExpiredError(text);
|
|
195306
|
+
return text.includes(MISSING_KEY_MARKER) || /Invalid API key/i.test(text) || /Incorrect API key provided/i.test(text) || /\bUser not found\b/i.test(text) || /\bInvalid authentication\b/i.test(text) || /authentication_error/i.test(text) || /Invalid bearer token/i.test(text) || /api_error_status\s*=\s*401/i.test(text) || /API Error:\s*401/i.test(text) || /Failed to authenticate\. API Error:/i.test(text) || /Your api key:.*is invalid/i.test(text) || isMalformedKeyError(text) || isClaudeSubscriptionDisabledError(text) || isClaudeSessionLimitError(text) || isOAuthCredentialExpiredError(text);
|
|
194993
195307
|
}
|
|
194994
195308
|
function isOAuthCredentialExpiredError(text) {
|
|
194995
195309
|
return (
|
|
@@ -195085,8 +195399,8 @@ function formatApiKeyErrorSummary(params) {
|
|
|
195085
195399
|
`[Claude subscription \u2192](https://docs.pullfrog.com/claude-auth) \xB7 [ChatGPT subscription \u2192](https://docs.pullfrog.com/codex-auth) \xB7 [Model settings \u2192](${settingsUrl}) \xB7 [Ask in Discord \u2192](https://discord.gg/8y96raFg8e)`
|
|
195086
195400
|
].join("\n");
|
|
195087
195401
|
}
|
|
195088
|
-
const subscription = Object.keys(SUBSCRIPTION_CREDENTIALS).find(
|
|
195089
|
-
if (subscription && !
|
|
195402
|
+
const subscription = Object.keys(SUBSCRIPTION_CREDENTIALS).find(hasEnvVar2);
|
|
195403
|
+
if (subscription && !hasEnvVar2("ANTHROPIC_API_KEY")) {
|
|
195090
195404
|
const details = SUBSCRIPTION_CREDENTIALS[subscription];
|
|
195091
195405
|
return [
|
|
195092
195406
|
`**Your ${details?.label} was rejected during this run.** Re-authenticate with \`${details?.command}\` and re-trigger \u2014 a subscription credential can't be rotated from a provider dashboard.`,
|
|
@@ -195101,6 +195415,114 @@ function formatApiKeyErrorSummary(params) {
|
|
|
195101
195415
|
].join("\n");
|
|
195102
195416
|
}
|
|
195103
195417
|
|
|
195418
|
+
// utils/agent.ts
|
|
195419
|
+
function hasEnvVar3(name) {
|
|
195420
|
+
const val = process.env[name];
|
|
195421
|
+
return typeof val === "string" && val.length > 0;
|
|
195422
|
+
}
|
|
195423
|
+
function hasClaudeCodeAuth() {
|
|
195424
|
+
return hasEnvVar3("CLAUDE_CODE_OAUTH_TOKEN") || hasEnvVar3("ANTHROPIC_API_KEY") || hasEnvVar3("ANTHROPIC_AUTH_TOKEN");
|
|
195425
|
+
}
|
|
195426
|
+
function hasCodexAuth() {
|
|
195427
|
+
return hasEnvVar3("CODEX_AUTH_JSON") || hasEnvVar3("OPENAI_API_KEY");
|
|
195428
|
+
}
|
|
195429
|
+
function hasBedrockAuth() {
|
|
195430
|
+
return hasEnvVar3("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar3("AWS_ACCESS_KEY_ID") && hasEnvVar3("AWS_SECRET_ACCESS_KEY");
|
|
195431
|
+
}
|
|
195432
|
+
function hasVertexAuth() {
|
|
195433
|
+
return hasEnvVar3(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
195434
|
+
}
|
|
195435
|
+
function resolveSlug(slug2) {
|
|
195436
|
+
const alias = resolveDisplayAlias(slug2);
|
|
195437
|
+
if (alias?.routing === "bedrock") {
|
|
195438
|
+
const bedrockId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
195439
|
+
if (!bedrockId) {
|
|
195440
|
+
throw new Error(
|
|
195441
|
+
`${BEDROCK_MODEL_ID_ENV} ${BYOK_SLUG_MARKER} "${slug2}". set it to an AWS Bedrock model ID from the Bedrock console. see https://docs.pullfrog.com/bedrock for setup.`
|
|
195442
|
+
);
|
|
195443
|
+
}
|
|
195444
|
+
return bedrockId;
|
|
195445
|
+
}
|
|
195446
|
+
if (alias?.routing === "vertex") {
|
|
195447
|
+
const vertexId = process.env[VERTEX_MODEL_ID_ENV]?.trim();
|
|
195448
|
+
if (!vertexId) {
|
|
195449
|
+
throw new Error(
|
|
195450
|
+
`${VERTEX_MODEL_ID_ENV} ${BYOK_SLUG_MARKER} "${slug2}". set it to a Google Vertex AI model ID from Model Garden. see https://docs.pullfrog.com/vertex for setup.`
|
|
195451
|
+
);
|
|
195452
|
+
}
|
|
195453
|
+
return vertexId;
|
|
195454
|
+
}
|
|
195455
|
+
if (alias?.routing === "azure") {
|
|
195456
|
+
const deployment = process.env[AZURE_DEPLOYMENT_ENV]?.trim();
|
|
195457
|
+
if (!deployment) {
|
|
195458
|
+
throw new Error(
|
|
195459
|
+
`${AZURE_DEPLOYMENT_ENV} ${BYOK_SLUG_MARKER} "${slug2}". set it to the name of your Azure OpenAI deployment (not the model it serves \u2014 Azure routes on the deployment name). see https://docs.pullfrog.com/azure for setup.`
|
|
195460
|
+
);
|
|
195461
|
+
}
|
|
195462
|
+
return `${AZURE_PROVIDER}/${deployment}`;
|
|
195463
|
+
}
|
|
195464
|
+
if (alias?.routing === "openai-compatible") {
|
|
195465
|
+
const modelId = process.env[OPENAI_COMPATIBLE_MODEL_ENV]?.trim();
|
|
195466
|
+
if (!modelId) {
|
|
195467
|
+
throw new Error(
|
|
195468
|
+
`${OPENAI_COMPATIBLE_MODEL_ENV} ${BYOK_SLUG_MARKER} "${slug2}". set it to the model ID served by your OpenAI-compatible endpoint (e.g. a Cloudflare AI Gateway or DashScope model). see https://docs.pullfrog.com/openai-compatible for setup.`
|
|
195469
|
+
);
|
|
195470
|
+
}
|
|
195471
|
+
return `${OPENAI_COMPATIBLE_PROVIDER}/${modelId}`;
|
|
195472
|
+
}
|
|
195473
|
+
return resolveCliModel(slug2);
|
|
195474
|
+
}
|
|
195475
|
+
function resolveModel(ctx) {
|
|
195476
|
+
const envModel = process.env.PULLFROG_MODEL?.trim();
|
|
195477
|
+
if (envModel) {
|
|
195478
|
+
return resolveSlug(envModel) ?? envModel;
|
|
195479
|
+
}
|
|
195480
|
+
const slug2 = ctx.slug?.trim();
|
|
195481
|
+
if (slug2) {
|
|
195482
|
+
const resolved = resolveSlug(slug2);
|
|
195483
|
+
if (resolved) {
|
|
195484
|
+
return resolved;
|
|
195485
|
+
}
|
|
195486
|
+
if (slug2.includes("/")) {
|
|
195487
|
+
log2.info(`\xBB "${slug2}" is not a curated alias \u2014 passing through as a raw model specifier`);
|
|
195488
|
+
return slug2;
|
|
195489
|
+
}
|
|
195490
|
+
log2.warning(`\xBB unknown model slug "${slug2}" \u2014 agent will auto-select`);
|
|
195491
|
+
}
|
|
195492
|
+
return void 0;
|
|
195493
|
+
}
|
|
195494
|
+
function resolveAgent(ctx) {
|
|
195495
|
+
const envAgent = process.env.PULLFROG_AGENT?.trim();
|
|
195496
|
+
if (envAgent) {
|
|
195497
|
+
if (envAgent in agents) {
|
|
195498
|
+
return agents[envAgent];
|
|
195499
|
+
}
|
|
195500
|
+
log2.warning(`\xBB unknown PULLFROG_AGENT="${envAgent}" \u2014 falling through to auto-select`);
|
|
195501
|
+
}
|
|
195502
|
+
if (ctx.proxyModel) return agents.opencode;
|
|
195503
|
+
if (ctx.model && hasBedrockAuth() && process.env[BEDROCK_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
195504
|
+
return isBedrockAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
195505
|
+
}
|
|
195506
|
+
if (ctx.model && hasVertexAuth() && process.env[VERTEX_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
195507
|
+
return isVertexAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
195508
|
+
}
|
|
195509
|
+
if (ctx.model) {
|
|
195510
|
+
try {
|
|
195511
|
+
const provider2 = getModelProvider(ctx.model);
|
|
195512
|
+
if (provider2 === "anthropic" && hasClaudeCodeAuth()) return agents.claude;
|
|
195513
|
+
if (provider2 === "openai" && ctx.codexAgent && hasCodexAuth()) return agents.codex;
|
|
195514
|
+
} catch {
|
|
195515
|
+
}
|
|
195516
|
+
}
|
|
195517
|
+
if (!ctx.model) {
|
|
195518
|
+
if (hasEnvVar3("ANTHROPIC_AUTH_TOKEN") && !hasEnvVar3("ANTHROPIC_API_KEY") && !hasEnvVar3("CLAUDE_CODE_OAUTH_TOKEN")) {
|
|
195519
|
+
return agents.claude;
|
|
195520
|
+
}
|
|
195521
|
+
if (ctx.codexAgent && hasCodexAuth() && !hasClaudeCodeAuth()) return agents.codex;
|
|
195522
|
+
}
|
|
195523
|
+
return agents.opencode;
|
|
195524
|
+
}
|
|
195525
|
+
|
|
195104
195526
|
// utils/billingErrors.ts
|
|
195105
195527
|
var BillingError = class extends Error {
|
|
195106
195528
|
code;
|
|
@@ -195953,10 +196375,7 @@ async function persistLearnings(ctx) {
|
|
|
195953
196375
|
authorization: `Bearer ${ctx.apiToken}`,
|
|
195954
196376
|
"content-type": "application/json"
|
|
195955
196377
|
},
|
|
195956
|
-
body: JSON.stringify({
|
|
195957
|
-
learnings: current,
|
|
195958
|
-
model: ctx.toolState.model
|
|
195959
|
-
}),
|
|
196378
|
+
body: JSON.stringify({ learnings: current }),
|
|
195960
196379
|
signal: AbortSignal.timeout(1e4)
|
|
195961
196380
|
});
|
|
195962
196381
|
if (!response.ok) {
|
|
@@ -195998,7 +196417,7 @@ async function persistXrepoLearnings(ctx) {
|
|
|
195998
196417
|
authorization: `Bearer ${ctx.apiToken}`,
|
|
195999
196418
|
"content-type": "application/json"
|
|
196000
196419
|
},
|
|
196001
|
-
body: JSON.stringify({ learnings: current
|
|
196420
|
+
body: JSON.stringify({ learnings: current }),
|
|
196002
196421
|
signal: AbortSignal.timeout(1e4)
|
|
196003
196422
|
});
|
|
196004
196423
|
if (!response.ok) {
|
|
@@ -197409,6 +197828,15 @@ ${input.errorMessage}
|
|
|
197409
197828
|
\`\`\``
|
|
197410
197829
|
].join("\n");
|
|
197411
197830
|
}
|
|
197831
|
+
function formatByokSetupSummary(input) {
|
|
197832
|
+
return [
|
|
197833
|
+
"**This repo's model isn't fully set up yet.**",
|
|
197834
|
+
"",
|
|
197835
|
+
input.raw,
|
|
197836
|
+
"",
|
|
197837
|
+
`[Configure model \u2192](${getApiUrl()}/console/${input.owner}/${input.name})`
|
|
197838
|
+
].join("\n");
|
|
197839
|
+
}
|
|
197412
197840
|
function formatProviderModelNotFoundSummary(input) {
|
|
197413
197841
|
return `The configured model is no longer available in OpenCode's catalog. Pick a different model in the Pullfrog console for \`${input.owner}/${input.name}\`, or contact support if this persists.
|
|
197414
197842
|
|
|
@@ -197464,6 +197892,16 @@ ${body}`, comment: body };
|
|
|
197464
197892
|
});
|
|
197465
197893
|
return { summary: `### \u274C Pullfrog failed
|
|
197466
197894
|
|
|
197895
|
+
${body}`, comment: body };
|
|
197896
|
+
}
|
|
197897
|
+
if (isByokSetupError(input.errorMessage)) {
|
|
197898
|
+
const body = formatByokSetupSummary({
|
|
197899
|
+
owner: input.repo.owner,
|
|
197900
|
+
name: input.repo.name,
|
|
197901
|
+
raw: input.errorMessage
|
|
197902
|
+
});
|
|
197903
|
+
return { summary: `### \u274C Pullfrog failed
|
|
197904
|
+
|
|
197467
197905
|
${body}`, comment: body };
|
|
197468
197906
|
}
|
|
197469
197907
|
const apiKeySource = hangBody ?? input.errorMessage;
|
|
@@ -199188,16 +199626,192 @@ async function run2() {
|
|
|
199188
199626
|
}
|
|
199189
199627
|
}
|
|
199190
199628
|
|
|
199629
|
+
// commands/_prEvents.ts
|
|
199630
|
+
import { mkdirSync as mkdirSync11, readFileSync as readFileSync8, writeFileSync as writeFileSync16 } from "node:fs";
|
|
199631
|
+
import { homedir as homedir3 } from "node:os";
|
|
199632
|
+
import { join as join29 } from "node:path";
|
|
199633
|
+
var REQUEST_TIMEOUT_MS = 35e3;
|
|
199634
|
+
var SERVER_POLL_WINDOW_MS = 25e3;
|
|
199635
|
+
var PrEventsAuthError = class extends Error {
|
|
199636
|
+
};
|
|
199637
|
+
var PrEventsAccessError = class extends Error {
|
|
199638
|
+
};
|
|
199639
|
+
function isTerminal2(error52) {
|
|
199640
|
+
return error52 instanceof PrEventsAuthError || error52 instanceof PrEventsAccessError;
|
|
199641
|
+
}
|
|
199642
|
+
async function pollPrEvents(ctx) {
|
|
199643
|
+
const params = new URLSearchParams({
|
|
199644
|
+
owner: ctx.owner,
|
|
199645
|
+
repo: ctx.repo,
|
|
199646
|
+
pr: String(ctx.pr)
|
|
199647
|
+
});
|
|
199648
|
+
if (ctx.cursor !== void 0) params.set("since", ctx.cursor);
|
|
199649
|
+
const controller = new AbortController();
|
|
199650
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
199651
|
+
const onCallerAbort = () => controller.abort();
|
|
199652
|
+
if (ctx.signal?.aborted) controller.abort();
|
|
199653
|
+
else ctx.signal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
199654
|
+
try {
|
|
199655
|
+
const response = await fetch(`${PULLFROG_API_URL}/api/cli/pr-events?${params}`, {
|
|
199656
|
+
headers: { authorization: `Bearer ${ctx.token}` },
|
|
199657
|
+
signal: controller.signal
|
|
199658
|
+
});
|
|
199659
|
+
if (response.status === 401 || response.status === 403) {
|
|
199660
|
+
throw new PrEventsAuthError("invalid or expired github token \u2014 run `gh auth login`.");
|
|
199661
|
+
}
|
|
199662
|
+
if (response.status === 404) {
|
|
199663
|
+
throw new PrEventsAccessError(
|
|
199664
|
+
`repository ${ctx.owner}/${ctx.repo} not found or Pullfrog not installed on it.`
|
|
199665
|
+
);
|
|
199666
|
+
}
|
|
199667
|
+
if (!response.ok) {
|
|
199668
|
+
throw new Error(`pr-events returned ${response.status}`);
|
|
199669
|
+
}
|
|
199670
|
+
return await response.json();
|
|
199671
|
+
} finally {
|
|
199672
|
+
clearTimeout(timeout);
|
|
199673
|
+
ctx.signal?.removeEventListener("abort", onCallerAbort);
|
|
199674
|
+
}
|
|
199675
|
+
}
|
|
199676
|
+
function stateDir() {
|
|
199677
|
+
return process.env.PULLFROG_STATE_DIR || join29(homedir3(), ".pullfrog");
|
|
199678
|
+
}
|
|
199679
|
+
function cursorPath(target) {
|
|
199680
|
+
const key = [target.owner, target.repo, String(target.pr)].map(encodeURIComponent).join("__");
|
|
199681
|
+
return join29(stateDir(), "watch", `${key}.cursor`);
|
|
199682
|
+
}
|
|
199683
|
+
function readCursor(target) {
|
|
199684
|
+
try {
|
|
199685
|
+
const raw2 = readFileSync8(cursorPath(target), "utf-8").trim();
|
|
199686
|
+
return /^\d+$/.test(raw2) ? raw2 : void 0;
|
|
199687
|
+
} catch {
|
|
199688
|
+
return void 0;
|
|
199689
|
+
}
|
|
199690
|
+
}
|
|
199691
|
+
function writeCursor(target, cursor3) {
|
|
199692
|
+
try {
|
|
199693
|
+
const path4 = cursorPath(target);
|
|
199694
|
+
mkdirSync11(join29(stateDir(), "watch"), { recursive: true });
|
|
199695
|
+
writeFileSync16(path4, cursor3, "utf-8");
|
|
199696
|
+
} catch {
|
|
199697
|
+
}
|
|
199698
|
+
}
|
|
199699
|
+
async function resolveCursor(ctx) {
|
|
199700
|
+
if (ctx.since !== void 0) return ctx.since;
|
|
199701
|
+
const stored = readCursor(ctx);
|
|
199702
|
+
if (stored !== void 0) return stored;
|
|
199703
|
+
const subscribed = await pollPrEvents({ ...ctx, cursor: void 0 });
|
|
199704
|
+
writeCursor(ctx, subscribed.cursor);
|
|
199705
|
+
return subscribed.cursor;
|
|
199706
|
+
}
|
|
199707
|
+
async function waitForPrEvents(ctx) {
|
|
199708
|
+
const controller = new AbortController();
|
|
199709
|
+
const deadline = setTimeout(() => controller.abort(), ctx.maxWaitMs);
|
|
199710
|
+
let cursor3 = ctx.cursor;
|
|
199711
|
+
try {
|
|
199712
|
+
for (; ; ) {
|
|
199713
|
+
const result = await pollPrEvents({ ...ctx, cursor: cursor3, signal: controller.signal });
|
|
199714
|
+
cursor3 = result.cursor;
|
|
199715
|
+
if (result.events.length > 0) return { cursor: cursor3, events: result.events };
|
|
199716
|
+
}
|
|
199717
|
+
} catch (error52) {
|
|
199718
|
+
if (isTerminal2(error52) || !controller.signal.aborted) throw error52;
|
|
199719
|
+
return { cursor: cursor3, events: [] };
|
|
199720
|
+
} finally {
|
|
199721
|
+
clearTimeout(deadline);
|
|
199722
|
+
writeCursor(ctx, cursor3);
|
|
199723
|
+
}
|
|
199724
|
+
}
|
|
199725
|
+
|
|
199726
|
+
// commands/mcp.ts
|
|
199727
|
+
var MAX_WAIT_SECONDS = 50;
|
|
199728
|
+
var PrWait = type({
|
|
199729
|
+
pr: type.number.describe("The pull request number to wait on"),
|
|
199730
|
+
"repo?": type.string.describe("Target repo as 'owner/repo'. Defaults to the current git remote."),
|
|
199731
|
+
"max_wait_seconds?": type.number.describe(
|
|
199732
|
+
`How long to block before returning empty. Default 25, maximum ${MAX_WAIT_SECONDS}.`
|
|
199733
|
+
)
|
|
199734
|
+
});
|
|
199735
|
+
var ok = (data) => ({
|
|
199736
|
+
content: [{ type: "text", text: JSON.stringify(data) }]
|
|
199737
|
+
});
|
|
199738
|
+
var fail = (message) => ({
|
|
199739
|
+
content: [{ type: "text", text: message }],
|
|
199740
|
+
isError: true
|
|
199741
|
+
});
|
|
199742
|
+
function resolveTarget(repo) {
|
|
199743
|
+
if (repo === void 0) return tryParseGitRemote();
|
|
199744
|
+
const match3 = repo.match(/^([^/\s]+)\/([^/\s]+)$/);
|
|
199745
|
+
if (!match3) return null;
|
|
199746
|
+
return { owner: match3[1], repo: match3[2] };
|
|
199747
|
+
}
|
|
199748
|
+
function cliVersion() {
|
|
199749
|
+
const parts = /^(\d+)\.(\d+)\.(\d+)$/.exec("0.1.65");
|
|
199750
|
+
if (!parts) return "0.0.0";
|
|
199751
|
+
return `${Number(parts[1])}.${Number(parts[2])}.${Number(parts[3])}`;
|
|
199752
|
+
}
|
|
199753
|
+
async function runCli4(input) {
|
|
199754
|
+
if (input.showHelp || input.args.includes("--help") || input.args.includes("-h")) {
|
|
199755
|
+
console.log(`usage: ${input.prog} mcp
|
|
199756
|
+
`);
|
|
199757
|
+
console.log("run a stdio MCP server exposing this repo's PR activity as an agent tool.\n");
|
|
199758
|
+
console.log("register it with your harness rather than running it by hand:");
|
|
199759
|
+
console.log(` claude mcp add pullfrog -- npx ${input.prog} mcp`);
|
|
199760
|
+
process.exit(0);
|
|
199761
|
+
}
|
|
199762
|
+
const server = new FastMCP({ name: "pullfrog", version: cliVersion() });
|
|
199763
|
+
server.addTool({
|
|
199764
|
+
name: "pr_wait",
|
|
199765
|
+
description: "Block until new activity lands on a GitHub pull request, then return it. Covers new reviews, review comments, resolved/unresolved review threads, top-level PR comments, PR state changes (opened/closed/merged/synchronized), and completed check suites. Returns as soon as anything arrives, or an empty `events` array if the wait elapsed quietly \u2014 call it again to keep waiting. Reads a push feed of GitHub webhooks rather than polling the GitHub API, and remembers its position between calls, so consecutive calls do not miss events that landed in between. Example: `pr_wait({ pr: 42 })`.",
|
|
199766
|
+
parameters: PrWait,
|
|
199767
|
+
execute: async (params) => {
|
|
199768
|
+
const token = tryGetGhToken();
|
|
199769
|
+
if (!token) return fail(GH_TOKEN_HELP);
|
|
199770
|
+
const target = resolveTarget(params.repo);
|
|
199771
|
+
if (!target) {
|
|
199772
|
+
return fail(
|
|
199773
|
+
"could not determine the repo \u2014 pass `repo` as 'owner/repo', or run the server from a git checkout whose origin remote points at github."
|
|
199774
|
+
);
|
|
199775
|
+
}
|
|
199776
|
+
if (!Number.isInteger(params.pr) || params.pr <= 0) {
|
|
199777
|
+
return fail(`pr must be a positive integer, got ${params.pr}`);
|
|
199778
|
+
}
|
|
199779
|
+
const requested = params.max_wait_seconds ?? SERVER_POLL_WINDOW_MS / 1e3;
|
|
199780
|
+
const maxWaitMs = Math.min(Math.max(requested, 1), MAX_WAIT_SECONDS) * 1e3;
|
|
199781
|
+
const watched = { ...target, pr: params.pr };
|
|
199782
|
+
try {
|
|
199783
|
+
const cursor3 = await resolveCursor({ ...watched, token, since: void 0 });
|
|
199784
|
+
const started = Date.now();
|
|
199785
|
+
const result = await waitForPrEvents({ ...watched, token, cursor: cursor3, maxWaitMs });
|
|
199786
|
+
return ok({
|
|
199787
|
+
repo: `${target.owner}/${target.repo}`,
|
|
199788
|
+
pr: params.pr,
|
|
199789
|
+
waited_seconds: Math.round((Date.now() - started) / 1e3),
|
|
199790
|
+
events: result.events
|
|
199791
|
+
});
|
|
199792
|
+
} catch (error52) {
|
|
199793
|
+
if (isTerminal2(error52)) return fail(error52.message);
|
|
199794
|
+
throw error52;
|
|
199795
|
+
}
|
|
199796
|
+
}
|
|
199797
|
+
});
|
|
199798
|
+
await server.start({ transportType: "stdio" });
|
|
199799
|
+
await new Promise((resolve3) => {
|
|
199800
|
+
process.stdin.once("end", resolve3);
|
|
199801
|
+
process.stdin.once("close", resolve3);
|
|
199802
|
+
});
|
|
199803
|
+
}
|
|
199804
|
+
|
|
199191
199805
|
// commands/watch.ts
|
|
199192
199806
|
var import_arg4 = __toESM(require_arg(), 1);
|
|
199193
199807
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
199194
|
-
var REQUEST_TIMEOUT_MS = 35e3;
|
|
199195
199808
|
function parseWatchArgs(args2) {
|
|
199196
199809
|
return (0, import_arg4.default)(
|
|
199197
199810
|
{
|
|
199198
199811
|
"--pr": Number,
|
|
199199
199812
|
"--pretty": Boolean,
|
|
199200
199813
|
"--since": String,
|
|
199814
|
+
"--once": Boolean,
|
|
199201
199815
|
"--help": Boolean,
|
|
199202
199816
|
"-h": "--help",
|
|
199203
199817
|
"-p": "--pretty"
|
|
@@ -199214,7 +199828,8 @@ function printUsage(prog, stream) {
|
|
|
199214
199828
|
stream("");
|
|
199215
199829
|
stream("options:");
|
|
199216
199830
|
stream(" --pr <number> pull request number to watch (required)");
|
|
199217
|
-
stream(" --
|
|
199831
|
+
stream(" --once wait for one batch of events, print it, and exit");
|
|
199832
|
+
stream(" --since <cursor> resume from a cursor instead of the saved position");
|
|
199218
199833
|
stream(" -p, --pretty human-readable output instead of JSON lines");
|
|
199219
199834
|
stream(" -h, --help show help");
|
|
199220
199835
|
}
|
|
@@ -199224,34 +199839,6 @@ function resolveRepo(positional) {
|
|
|
199224
199839
|
if (!match3) bail(`invalid repo "${positional}" \u2014 expected <owner>/<repo>`);
|
|
199225
199840
|
return { owner: match3[1], repo: match3[2] };
|
|
199226
199841
|
}
|
|
199227
|
-
async function pollOnce(ctx) {
|
|
199228
|
-
const params = new URLSearchParams({
|
|
199229
|
-
owner: ctx.owner,
|
|
199230
|
-
repo: ctx.repo,
|
|
199231
|
-
pr: String(ctx.pr)
|
|
199232
|
-
});
|
|
199233
|
-
if (ctx.cursor !== void 0) params.set("since", ctx.cursor);
|
|
199234
|
-
const controller = new AbortController();
|
|
199235
|
-
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
199236
|
-
try {
|
|
199237
|
-
const response = await fetch(`${PULLFROG_API_URL}/api/cli/pr-events?${params}`, {
|
|
199238
|
-
headers: { authorization: `Bearer ${ctx.token}` },
|
|
199239
|
-
signal: controller.signal
|
|
199240
|
-
});
|
|
199241
|
-
if (response.status === 401 || response.status === 403) {
|
|
199242
|
-
bail("invalid or expired github token \u2014 run `gh auth login`.");
|
|
199243
|
-
}
|
|
199244
|
-
if (response.status === 404) {
|
|
199245
|
-
bail(`repository ${ctx.owner}/${ctx.repo} not found or Pullfrog not installed on it.`);
|
|
199246
|
-
}
|
|
199247
|
-
if (!response.ok) {
|
|
199248
|
-
throw new Error(`pr-events returned ${response.status}`);
|
|
199249
|
-
}
|
|
199250
|
-
return await response.json();
|
|
199251
|
-
} finally {
|
|
199252
|
-
clearTimeout(timeout);
|
|
199253
|
-
}
|
|
199254
|
-
}
|
|
199255
199842
|
function formatPretty(event) {
|
|
199256
199843
|
const time4 = new Date(event.createdAt).toLocaleTimeString();
|
|
199257
199844
|
const action = typeof event.data.action === "string" ? event.data.action : "";
|
|
@@ -199259,7 +199846,14 @@ function formatPretty(event) {
|
|
|
199259
199846
|
const detail = [action, actor && import_picocolors4.default.dim(`by ${actor}`)].filter(Boolean).join(" ");
|
|
199260
199847
|
return `${import_picocolors4.default.dim(time4)} ${import_picocolors4.default.cyan(event.kind)} ${import_picocolors4.default.bold(`#${event.pr}`)} ${detail}`.trimEnd();
|
|
199261
199848
|
}
|
|
199262
|
-
|
|
199849
|
+
function emit(events, pretty) {
|
|
199850
|
+
for (const event of events) {
|
|
199851
|
+
process.stdout.write(pretty ? `${formatPretty(event)}
|
|
199852
|
+
` : `${JSON.stringify(event)}
|
|
199853
|
+
`);
|
|
199854
|
+
}
|
|
199855
|
+
}
|
|
199856
|
+
async function runCli5(input) {
|
|
199263
199857
|
let parsed2;
|
|
199264
199858
|
try {
|
|
199265
199859
|
parsed2 = parseWatchArgs(input.args);
|
|
@@ -199280,21 +199874,37 @@ async function runCli4(input) {
|
|
|
199280
199874
|
}
|
|
199281
199875
|
const token = getGhToken();
|
|
199282
199876
|
const pretty = parsed2["--pretty"] === true;
|
|
199283
|
-
|
|
199284
|
-
|
|
199877
|
+
const watched = { ...target, pr };
|
|
199878
|
+
let cursor3;
|
|
199879
|
+
try {
|
|
199880
|
+
cursor3 = await resolveCursor({ ...watched, token, since: parsed2["--since"] });
|
|
199881
|
+
if (parsed2["--once"] === true) {
|
|
199882
|
+
const result = await waitForPrEvents({
|
|
199883
|
+
...watched,
|
|
199884
|
+
token,
|
|
199885
|
+
cursor: cursor3,
|
|
199886
|
+
maxWaitMs: SERVER_POLL_WINDOW_MS
|
|
199887
|
+
});
|
|
199888
|
+
emit(result.events, pretty);
|
|
199889
|
+
return;
|
|
199890
|
+
}
|
|
199891
|
+
} catch (error52) {
|
|
199892
|
+
if (isTerminal2(error52)) bail(error52.message);
|
|
199893
|
+
throw error52;
|
|
199894
|
+
}
|
|
199895
|
+
const poll = op(pollPrEvents, {
|
|
199285
199896
|
name: "pr-events poll",
|
|
199286
|
-
retries: [1e3, 2e3, 5e3, 1e4, 15e3]
|
|
199897
|
+
retries: [1e3, 2e3, 5e3, 1e4, 15e3],
|
|
199898
|
+
bail: isTerminal2
|
|
199287
199899
|
});
|
|
199288
199900
|
for (; ; ) {
|
|
199289
199901
|
try {
|
|
199290
|
-
const result = await poll({
|
|
199902
|
+
const result = await poll({ ...watched, token, cursor: cursor3 });
|
|
199291
199903
|
cursor3 = result.cursor;
|
|
199292
|
-
|
|
199293
|
-
|
|
199294
|
-
` : `${JSON.stringify(event)}
|
|
199295
|
-
`);
|
|
199296
|
-
}
|
|
199904
|
+
writeCursor(watched, cursor3);
|
|
199905
|
+
emit(result.events, pretty);
|
|
199297
199906
|
} catch (error52) {
|
|
199907
|
+
if (isTerminal2(error52)) bail(error52.message);
|
|
199298
199908
|
const message = error52 instanceof Error ? error52.message : String(error52);
|
|
199299
199909
|
console.error(import_picocolors4.default.dim(`watch: ${message} \u2014 retrying in 30s`));
|
|
199300
199910
|
await new Promise((resolve3) => setTimeout(resolve3, 3e4));
|
|
@@ -199303,7 +199913,7 @@ async function runCli4(input) {
|
|
|
199303
199913
|
}
|
|
199304
199914
|
|
|
199305
199915
|
// cli.ts
|
|
199306
|
-
var VERSION10 = "0.1.
|
|
199916
|
+
var VERSION10 = "0.1.65";
|
|
199307
199917
|
var bin = basename2(process.argv[1] || "");
|
|
199308
199918
|
var PROG = bin === "pf" || bin === "pullfrog" ? bin : "pullfrog";
|
|
199309
199919
|
var rawArgs = process.argv.slice(2);
|
|
@@ -199314,6 +199924,7 @@ function printMainUsage(stream) {
|
|
|
199314
199924
|
stream(" init install pullfrog on the current repository and open its dashboard");
|
|
199315
199925
|
stream(" auth manage provider credentials for the current repository");
|
|
199316
199926
|
stream(" watch stream a PR's activity as one JSON line per event");
|
|
199927
|
+
stream(" mcp run a stdio MCP server exposing PR activity as an agent tool");
|
|
199317
199928
|
stream("");
|
|
199318
199929
|
stream("global options:");
|
|
199319
199930
|
stream(" -h, --help show help");
|
|
@@ -199387,7 +199998,7 @@ async function run3() {
|
|
|
199387
199998
|
});
|
|
199388
199999
|
return;
|
|
199389
200000
|
}
|
|
199390
|
-
if (command === "
|
|
200001
|
+
if (command === "mcp") {
|
|
199391
200002
|
await runCli4({
|
|
199392
200003
|
args: commandArgs,
|
|
199393
200004
|
prog: PROG,
|
|
@@ -199395,6 +200006,14 @@ async function run3() {
|
|
|
199395
200006
|
});
|
|
199396
200007
|
return;
|
|
199397
200008
|
}
|
|
200009
|
+
if (command === "watch") {
|
|
200010
|
+
await runCli5({
|
|
200011
|
+
args: commandArgs,
|
|
200012
|
+
prog: PROG,
|
|
200013
|
+
showHelp: globalParsed["--help"] === true
|
|
200014
|
+
});
|
|
200015
|
+
return;
|
|
200016
|
+
}
|
|
199398
200017
|
if (globalParsed["--help"]) {
|
|
199399
200018
|
printMainUsage(console.log);
|
|
199400
200019
|
process.exit(0);
|
|
@@ -199422,13 +200041,6 @@ undici/lib/websocket/frame.js:
|
|
|
199422
200041
|
undici/lib/web/websocket/frame.js:
|
|
199423
200042
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
199424
200043
|
|
|
199425
|
-
content-type/dist/index.js:
|
|
199426
|
-
(*!
|
|
199427
|
-
* content-type
|
|
199428
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
199429
|
-
* MIT Licensed
|
|
199430
|
-
*)
|
|
199431
|
-
|
|
199432
200044
|
@mixmark-io/domino/lib/style_parser.js:
|
|
199433
200045
|
(**
|
|
199434
200046
|
* @license
|
|
@@ -199449,7 +200061,7 @@ ieee754/index.js:
|
|
|
199449
200061
|
* MIT Licensed
|
|
199450
200062
|
*)
|
|
199451
200063
|
|
|
199452
|
-
mcp-proxy/dist/startStdioServer-
|
|
200064
|
+
mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs:
|
|
199453
200065
|
(*!
|
|
199454
200066
|
* content-type
|
|
199455
200067
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
@@ -199495,6 +200107,13 @@ mcp-proxy/dist/startStdioServer-BomI-BJR.mjs:
|
|
|
199495
200107
|
* MIT Licensed
|
|
199496
200108
|
*)
|
|
199497
200109
|
|
|
200110
|
+
content-type/dist/index.js:
|
|
200111
|
+
(*!
|
|
200112
|
+
* content-type
|
|
200113
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
200114
|
+
* MIT Licensed
|
|
200115
|
+
*)
|
|
200116
|
+
|
|
199498
200117
|
@octokit/request-error/dist-src/index.js:
|
|
199499
200118
|
(* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist *)
|
|
199500
200119
|
|