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/index.js
CHANGED
|
@@ -73378,11 +73378,11 @@ var require_dataType = __commonJS({
|
|
|
73378
73378
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
73379
73379
|
}
|
|
73380
73380
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
73381
|
-
const
|
|
73381
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
73382
73382
|
let cond;
|
|
73383
73383
|
switch (dataType) {
|
|
73384
73384
|
case "null":
|
|
73385
|
-
return (0, codegen_1._)`${data} ${
|
|
73385
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
73386
73386
|
case "array":
|
|
73387
73387
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
73388
73388
|
break;
|
|
@@ -73396,7 +73396,7 @@ var require_dataType = __commonJS({
|
|
|
73396
73396
|
cond = numCond();
|
|
73397
73397
|
break;
|
|
73398
73398
|
default:
|
|
73399
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
73399
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
73400
73400
|
}
|
|
73401
73401
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
73402
73402
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -74852,15 +74852,33 @@ var require_data = __commonJS({
|
|
|
74852
74852
|
}
|
|
74853
74853
|
});
|
|
74854
74854
|
|
|
74855
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
74855
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js
|
|
74856
74856
|
var require_utils5 = __commonJS({
|
|
74857
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
74857
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
74858
74858
|
"use strict";
|
|
74859
74859
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
74860
74860
|
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);
|
|
74861
74861
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
74862
74862
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
74863
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
74863
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
74864
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
74865
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
74866
|
+
var BYTE_HEX = new Array(256);
|
|
74867
|
+
{
|
|
74868
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
74869
|
+
for (let i = 0; i < 256; i++) {
|
|
74870
|
+
BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
74871
|
+
}
|
|
74872
|
+
}
|
|
74873
|
+
function percentEncodeNonAscii(cp) {
|
|
74874
|
+
if (cp < 2048) {
|
|
74875
|
+
return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
74876
|
+
}
|
|
74877
|
+
if (cp < 65536) {
|
|
74878
|
+
return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
74879
|
+
}
|
|
74880
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
74881
|
+
}
|
|
74864
74882
|
function stringArrayToHexStripped(input) {
|
|
74865
74883
|
let acc = "";
|
|
74866
74884
|
let code = 0;
|
|
@@ -74885,91 +74903,105 @@ var require_utils5 = __commonJS({
|
|
|
74885
74903
|
}
|
|
74886
74904
|
return acc;
|
|
74887
74905
|
}
|
|
74906
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
74907
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
74908
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
74888
74909
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
74889
|
-
function
|
|
74890
|
-
|
|
74891
|
-
|
|
74892
|
-
|
|
74893
|
-
|
|
74894
|
-
|
|
74895
|
-
|
|
74896
|
-
if (hex4 !== "") {
|
|
74897
|
-
address.push(hex4);
|
|
74898
|
-
} else {
|
|
74899
|
-
output.error = true;
|
|
74900
|
-
return false;
|
|
74910
|
+
function isZoneIdentifier(zone) {
|
|
74911
|
+
if (zone.length === 0) return false;
|
|
74912
|
+
for (let i = 0; i < zone.length; i++) {
|
|
74913
|
+
if (isZoneCharacter(zone[i])) continue;
|
|
74914
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
74915
|
+
i += 2;
|
|
74916
|
+
continue;
|
|
74901
74917
|
}
|
|
74902
|
-
|
|
74918
|
+
return false;
|
|
74903
74919
|
}
|
|
74904
74920
|
return true;
|
|
74905
74921
|
}
|
|
74906
|
-
function
|
|
74907
|
-
let
|
|
74908
|
-
|
|
74909
|
-
|
|
74910
|
-
|
|
74911
|
-
let
|
|
74912
|
-
|
|
74913
|
-
|
|
74914
|
-
|
|
74915
|
-
|
|
74916
|
-
|
|
74917
|
-
|
|
74918
|
-
}
|
|
74919
|
-
if (cursor === ":") {
|
|
74920
|
-
if (endipv6Encountered === true) {
|
|
74921
|
-
endIpv6 = true;
|
|
74922
|
-
}
|
|
74923
|
-
if (!consume(buffer, address, output)) {
|
|
74924
|
-
break;
|
|
74925
|
-
}
|
|
74926
|
-
if (++tokenCount > 7) {
|
|
74927
|
-
output.error = true;
|
|
74928
|
-
break;
|
|
74929
|
-
}
|
|
74930
|
-
if (i > 0 && input[i - 1] === ":") {
|
|
74931
|
-
endipv6Encountered = true;
|
|
74932
|
-
}
|
|
74933
|
-
address.push(":");
|
|
74934
|
-
continue;
|
|
74935
|
-
} else if (cursor === "%") {
|
|
74936
|
-
if (!consume(buffer, address, output)) {
|
|
74937
|
-
break;
|
|
74922
|
+
function compressIPv6ZeroRun(hextets) {
|
|
74923
|
+
let bestStart = -1;
|
|
74924
|
+
let bestLength = 0;
|
|
74925
|
+
let runStart = -1;
|
|
74926
|
+
let runLength = 0;
|
|
74927
|
+
for (let i = 0; i < hextets.length; i++) {
|
|
74928
|
+
if (hextets[i] === "0") {
|
|
74929
|
+
if (runStart === -1) runStart = i;
|
|
74930
|
+
runLength++;
|
|
74931
|
+
if (runLength > bestLength) {
|
|
74932
|
+
bestLength = runLength;
|
|
74933
|
+
bestStart = runStart;
|
|
74938
74934
|
}
|
|
74939
|
-
consume = consumeIsZone;
|
|
74940
74935
|
} else {
|
|
74941
|
-
|
|
74936
|
+
runStart = -1;
|
|
74937
|
+
runLength = 0;
|
|
74938
|
+
}
|
|
74939
|
+
}
|
|
74940
|
+
if (bestLength < 2) return hextets.join(":");
|
|
74941
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
74942
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
74943
|
+
return head + "::" + tail;
|
|
74944
|
+
}
|
|
74945
|
+
function normalizeIPv6Address(input) {
|
|
74946
|
+
const compression = input.indexOf("::");
|
|
74947
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
74948
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
74949
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
74950
|
+
if (compression !== -1) {
|
|
74951
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
74952
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
74953
|
+
}
|
|
74954
|
+
const parts = left.concat(right);
|
|
74955
|
+
let hextetCount = 0;
|
|
74956
|
+
for (let i = 0; i < parts.length; i++) {
|
|
74957
|
+
const part = parts[i];
|
|
74958
|
+
if (part === "") return void 0;
|
|
74959
|
+
if (part.indexOf(".") !== -1) {
|
|
74960
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
74961
|
+
hextetCount += 2;
|
|
74942
74962
|
continue;
|
|
74943
74963
|
}
|
|
74964
|
+
if (!isHextet(part)) return void 0;
|
|
74965
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
74966
|
+
hextetCount++;
|
|
74944
74967
|
}
|
|
74945
|
-
if (
|
|
74946
|
-
if (
|
|
74947
|
-
|
|
74948
|
-
} else if (endIpv6) {
|
|
74949
|
-
address.push(buffer.join(""));
|
|
74950
|
-
} else {
|
|
74951
|
-
address.push(stringArrayToHexStripped(buffer));
|
|
74952
|
-
}
|
|
74968
|
+
if (compression === -1) {
|
|
74969
|
+
if (hextetCount !== 8) return void 0;
|
|
74970
|
+
return compressIPv6ZeroRun(parts);
|
|
74953
74971
|
}
|
|
74954
|
-
|
|
74955
|
-
|
|
74972
|
+
if (hextetCount >= 8) return void 0;
|
|
74973
|
+
const expanded = parts.slice(0, left.length);
|
|
74974
|
+
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
74975
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
74976
|
+
return compressIPv6ZeroRun(expanded);
|
|
74956
74977
|
}
|
|
74957
74978
|
function normalizeIPv6(host) {
|
|
74958
|
-
|
|
74959
|
-
|
|
74960
|
-
}
|
|
74961
|
-
|
|
74962
|
-
if (
|
|
74963
|
-
|
|
74964
|
-
|
|
74965
|
-
|
|
74966
|
-
|
|
74967
|
-
|
|
74968
|
-
|
|
74969
|
-
|
|
74970
|
-
|
|
74971
|
-
|
|
74972
|
-
|
|
74979
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
74980
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
74981
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
|
|
74982
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
74983
|
+
if (bracketed && isIPvFuture(input)) {
|
|
74984
|
+
input = input.toLowerCase();
|
|
74985
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
74986
|
+
}
|
|
74987
|
+
if (findToken(input, ":") < 2) {
|
|
74988
|
+
return { host, isIPV6: false, error: bracketed };
|
|
74989
|
+
}
|
|
74990
|
+
let zoneIdentifier = "";
|
|
74991
|
+
const zoneSeparator = input.indexOf("%");
|
|
74992
|
+
if (zoneSeparator !== -1) {
|
|
74993
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
74994
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
74995
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
74996
|
+
input = input.slice(0, zoneSeparator);
|
|
74997
|
+
}
|
|
74998
|
+
const address = normalizeIPv6Address(input);
|
|
74999
|
+
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
75000
|
+
return {
|
|
75001
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
75002
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
75003
|
+
isIPV6: true
|
|
75004
|
+
};
|
|
74973
75005
|
}
|
|
74974
75006
|
function findToken(str, token) {
|
|
74975
75007
|
let ind = 0;
|
|
@@ -75088,7 +75120,8 @@ var require_utils5 = __commonJS({
|
|
|
75088
75120
|
function normalizePathEncoding(input) {
|
|
75089
75121
|
let output = "";
|
|
75090
75122
|
for (let i = 0; i < input.length; i++) {
|
|
75091
|
-
|
|
75123
|
+
const ch = input[i];
|
|
75124
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
75092
75125
|
const hex4 = input.slice(i + 1, i + 3);
|
|
75093
75126
|
if (isHexPair(hex4)) {
|
|
75094
75127
|
const normalizedHex = hex4.toUpperCase();
|
|
@@ -75102,10 +75135,152 @@ var require_utils5 = __commonJS({
|
|
|
75102
75135
|
continue;
|
|
75103
75136
|
}
|
|
75104
75137
|
}
|
|
75105
|
-
if (isPathCharacter(
|
|
75106
|
-
output +=
|
|
75138
|
+
if (isPathCharacter(ch)) {
|
|
75139
|
+
output += ch;
|
|
75140
|
+
} else {
|
|
75141
|
+
const code = input.charCodeAt(i);
|
|
75142
|
+
if (code < 128) {
|
|
75143
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
75144
|
+
} else if (code < 55296 || code > 57343) {
|
|
75145
|
+
output += percentEncodeNonAscii(code);
|
|
75146
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
75147
|
+
const low = input.charCodeAt(i + 1);
|
|
75148
|
+
if (low >= 56320 && low <= 57343) {
|
|
75149
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75150
|
+
i++;
|
|
75151
|
+
} else {
|
|
75152
|
+
output += percentEncodeNonAscii(65533);
|
|
75153
|
+
}
|
|
75154
|
+
} else {
|
|
75155
|
+
output += percentEncodeNonAscii(65533);
|
|
75156
|
+
}
|
|
75157
|
+
}
|
|
75158
|
+
}
|
|
75159
|
+
return output;
|
|
75160
|
+
}
|
|
75161
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
75162
|
+
let output = "";
|
|
75163
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
75164
|
+
for (let i = 0; i < input.length; i++) {
|
|
75165
|
+
const ch = input[i];
|
|
75166
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
75167
|
+
const hex4 = input.slice(i + 1, i + 3);
|
|
75168
|
+
if (isHexPair(hex4)) {
|
|
75169
|
+
output += "%" + hex4.toUpperCase();
|
|
75170
|
+
i += 2;
|
|
75171
|
+
continue;
|
|
75172
|
+
}
|
|
75173
|
+
}
|
|
75174
|
+
if (ch === "/") {
|
|
75175
|
+
firstSegment = false;
|
|
75176
|
+
}
|
|
75177
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
75178
|
+
output += ch;
|
|
75179
|
+
} else {
|
|
75180
|
+
const code = input.charCodeAt(i);
|
|
75181
|
+
if (code < 128) {
|
|
75182
|
+
output += BYTE_HEX[code];
|
|
75183
|
+
} else if (code < 55296 || code > 57343) {
|
|
75184
|
+
output += percentEncodeNonAscii(code);
|
|
75185
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
75186
|
+
const low = input.charCodeAt(i + 1);
|
|
75187
|
+
if (low >= 56320 && low <= 57343) {
|
|
75188
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75189
|
+
i++;
|
|
75190
|
+
} else {
|
|
75191
|
+
output += percentEncodeNonAscii(65533);
|
|
75192
|
+
}
|
|
75193
|
+
} else {
|
|
75194
|
+
output += percentEncodeNonAscii(65533);
|
|
75195
|
+
}
|
|
75196
|
+
}
|
|
75197
|
+
}
|
|
75198
|
+
return output;
|
|
75199
|
+
}
|
|
75200
|
+
function encodeComponent(input, isAllowed) {
|
|
75201
|
+
let output = "";
|
|
75202
|
+
for (let i = 0; i < input.length; i++) {
|
|
75203
|
+
const ch = input[i];
|
|
75204
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
75205
|
+
const hex4 = input.slice(i + 1, i + 3);
|
|
75206
|
+
if (isHexPair(hex4)) {
|
|
75207
|
+
output += "%" + hex4.toUpperCase();
|
|
75208
|
+
i += 2;
|
|
75209
|
+
continue;
|
|
75210
|
+
}
|
|
75211
|
+
}
|
|
75212
|
+
if (isAllowed(ch)) {
|
|
75213
|
+
output += ch;
|
|
75214
|
+
} else {
|
|
75215
|
+
const code = input.charCodeAt(i);
|
|
75216
|
+
if (code < 128) {
|
|
75217
|
+
output += BYTE_HEX[code];
|
|
75218
|
+
} else if (code < 55296 || code > 57343) {
|
|
75219
|
+
output += percentEncodeNonAscii(code);
|
|
75220
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
75221
|
+
const low = input.charCodeAt(i + 1);
|
|
75222
|
+
if (low >= 56320 && low <= 57343) {
|
|
75223
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75224
|
+
i++;
|
|
75225
|
+
} else {
|
|
75226
|
+
output += percentEncodeNonAscii(65533);
|
|
75227
|
+
}
|
|
75228
|
+
} else {
|
|
75229
|
+
output += percentEncodeNonAscii(65533);
|
|
75230
|
+
}
|
|
75231
|
+
}
|
|
75232
|
+
}
|
|
75233
|
+
return output;
|
|
75234
|
+
}
|
|
75235
|
+
function encodeUserinfo(input) {
|
|
75236
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
75237
|
+
}
|
|
75238
|
+
function encodeQuery(input) {
|
|
75239
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
75240
|
+
}
|
|
75241
|
+
function encodeFragment(input) {
|
|
75242
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
75243
|
+
}
|
|
75244
|
+
function isEscapeSafe(cp) {
|
|
75245
|
+
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;
|
|
75246
|
+
}
|
|
75247
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
75248
|
+
let output = "";
|
|
75249
|
+
for (let i = 0; i < input.length; i++) {
|
|
75250
|
+
const ch = input[i];
|
|
75251
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
75252
|
+
const hex4 = input.slice(i + 1, i + 3);
|
|
75253
|
+
if (isHexPair(hex4)) {
|
|
75254
|
+
const normalizedHex = hex4.toUpperCase();
|
|
75255
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
75256
|
+
if (isUnreserved(decoded)) {
|
|
75257
|
+
output += decoded;
|
|
75258
|
+
} else {
|
|
75259
|
+
output += "%" + normalizedHex;
|
|
75260
|
+
}
|
|
75261
|
+
i += 2;
|
|
75262
|
+
continue;
|
|
75263
|
+
}
|
|
75264
|
+
}
|
|
75265
|
+
if (isQueryFragmentCharacter(ch)) {
|
|
75266
|
+
output += ch;
|
|
75107
75267
|
} else {
|
|
75108
|
-
|
|
75268
|
+
const code = input.charCodeAt(i);
|
|
75269
|
+
if (code < 128) {
|
|
75270
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
75271
|
+
} else if (code < 55296 || code > 57343) {
|
|
75272
|
+
output += percentEncodeNonAscii(code);
|
|
75273
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
75274
|
+
const low = input.charCodeAt(i + 1);
|
|
75275
|
+
if (low >= 56320 && low <= 57343) {
|
|
75276
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
75277
|
+
i++;
|
|
75278
|
+
} else {
|
|
75279
|
+
output += percentEncodeNonAscii(65533);
|
|
75280
|
+
}
|
|
75281
|
+
} else {
|
|
75282
|
+
output += percentEncodeNonAscii(65533);
|
|
75283
|
+
}
|
|
75109
75284
|
}
|
|
75110
75285
|
}
|
|
75111
75286
|
return output;
|
|
@@ -75128,14 +75303,18 @@ var require_utils5 = __commonJS({
|
|
|
75128
75303
|
function recomposeAuthority(component) {
|
|
75129
75304
|
const uriTokens = [];
|
|
75130
75305
|
if (component.userinfo !== void 0) {
|
|
75131
|
-
uriTokens.push(component.userinfo);
|
|
75306
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
75132
75307
|
uriTokens.push("@");
|
|
75133
75308
|
}
|
|
75134
75309
|
if (component.host !== void 0) {
|
|
75135
|
-
let host =
|
|
75310
|
+
let host = component.host;
|
|
75136
75311
|
if (!isIPv4(host)) {
|
|
75137
|
-
|
|
75138
|
-
if (ipV6res.isIPV6
|
|
75312
|
+
let ipV6res = normalizeIPv6(host);
|
|
75313
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
75314
|
+
host = normalizePercentEncoding(host, true);
|
|
75315
|
+
ipV6res = normalizeIPv6(host);
|
|
75316
|
+
}
|
|
75317
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
75139
75318
|
host = `[${ipV6res.escapedHost}]`;
|
|
75140
75319
|
} else {
|
|
75141
75320
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -75155,6 +75334,11 @@ var require_utils5 = __commonJS({
|
|
|
75155
75334
|
reescapeHostDelimiters,
|
|
75156
75335
|
normalizePercentEncoding,
|
|
75157
75336
|
normalizePathEncoding,
|
|
75337
|
+
serializePathEncoding,
|
|
75338
|
+
normalizeQueryFragmentEncoding,
|
|
75339
|
+
encodeUserinfo,
|
|
75340
|
+
encodeQuery,
|
|
75341
|
+
encodeFragment,
|
|
75158
75342
|
escapePreservingEscapes,
|
|
75159
75343
|
removeDotSegments,
|
|
75160
75344
|
isIPv4,
|
|
@@ -75165,12 +75349,12 @@ var require_utils5 = __commonJS({
|
|
|
75165
75349
|
}
|
|
75166
75350
|
});
|
|
75167
75351
|
|
|
75168
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
75352
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js
|
|
75169
75353
|
var require_schemes = __commonJS({
|
|
75170
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
75354
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
75171
75355
|
"use strict";
|
|
75172
75356
|
var { isUUID } = require_utils5();
|
|
75173
|
-
var URN_REG =
|
|
75357
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
75174
75358
|
var supportedSchemeNames = (
|
|
75175
75359
|
/** @type {const} */
|
|
75176
75360
|
[
|
|
@@ -75231,9 +75415,10 @@ var require_schemes = __commonJS({
|
|
|
75231
75415
|
wsComponent.secure = void 0;
|
|
75232
75416
|
}
|
|
75233
75417
|
if (wsComponent.resourceName) {
|
|
75234
|
-
const
|
|
75418
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
75419
|
+
const path4 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
75235
75420
|
wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
|
|
75236
|
-
wsComponent.query =
|
|
75421
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
75237
75422
|
wsComponent.resourceName = void 0;
|
|
75238
75423
|
}
|
|
75239
75424
|
wsComponent.fragment = void 0;
|
|
@@ -75245,7 +75430,7 @@ var require_schemes = __commonJS({
|
|
|
75245
75430
|
return urnComponent;
|
|
75246
75431
|
}
|
|
75247
75432
|
const matches = urnComponent.path.match(URN_REG);
|
|
75248
|
-
if (matches) {
|
|
75433
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
75249
75434
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
75250
75435
|
urnComponent.nid = matches[1].toLowerCase();
|
|
75251
75436
|
urnComponent.nss = matches[2];
|
|
@@ -75375,12 +75560,21 @@ var require_schemes = __commonJS({
|
|
|
75375
75560
|
}
|
|
75376
75561
|
});
|
|
75377
75562
|
|
|
75378
|
-
// node_modules/.pnpm/fast-uri@3.1.
|
|
75563
|
+
// node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js
|
|
75379
75564
|
var require_fast_uri = __commonJS({
|
|
75380
|
-
"node_modules/.pnpm/fast-uri@3.1.
|
|
75565
|
+
"node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js"(exports, module) {
|
|
75381
75566
|
"use strict";
|
|
75382
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
75567
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils5();
|
|
75383
75568
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
75569
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
75570
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
75571
|
+
function decodeValidScheme(scheme) {
|
|
75572
|
+
const decodedScheme = unescape(String(scheme));
|
|
75573
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
75574
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
75575
|
+
}
|
|
75576
|
+
return decodedScheme;
|
|
75577
|
+
}
|
|
75384
75578
|
function normalize3(uri, options) {
|
|
75385
75579
|
if (typeof uri === "string") {
|
|
75386
75580
|
uri = /** @type {T} */
|
|
@@ -75393,12 +75587,34 @@ var require_fast_uri = __commonJS({
|
|
|
75393
75587
|
}
|
|
75394
75588
|
function resolve3(baseURI, relativeURI, options) {
|
|
75395
75589
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
75396
|
-
const {
|
|
75397
|
-
|
|
75398
|
-
|
|
75590
|
+
const {
|
|
75591
|
+
parsed: baseParsed,
|
|
75592
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
75593
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
75594
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
75595
|
+
malformedHost: baseMalformedHost,
|
|
75596
|
+
malformedScheme: baseMalformedScheme
|
|
75597
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
75598
|
+
const {
|
|
75599
|
+
parsed: relativeParsed,
|
|
75600
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
75601
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
75602
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
75603
|
+
malformedHost: relativeMalformedHost,
|
|
75604
|
+
malformedScheme: relativeMalformedScheme
|
|
75605
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
75606
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
75399
75607
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
75400
75608
|
}
|
|
75401
75609
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
75610
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
75611
|
+
const resolvedHost = resolved.host;
|
|
75612
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
75613
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
75614
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
75615
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
75616
|
+
throw new Error(resolved.error);
|
|
75617
|
+
}
|
|
75402
75618
|
schemelessOptions.skipEscape = true;
|
|
75403
75619
|
return serialize(resolved, schemelessOptions);
|
|
75404
75620
|
}
|
|
@@ -75458,7 +75674,7 @@ var require_fast_uri = __commonJS({
|
|
|
75458
75674
|
function equal(uriA, uriB, options) {
|
|
75459
75675
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
75460
75676
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
75461
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA
|
|
75677
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
75462
75678
|
}
|
|
75463
75679
|
function serialize(cmpts, opts) {
|
|
75464
75680
|
const component = {
|
|
@@ -75479,19 +75695,22 @@ var require_fast_uri = __commonJS({
|
|
|
75479
75695
|
};
|
|
75480
75696
|
const options = Object.assign({}, opts);
|
|
75481
75697
|
const uriTokens = [];
|
|
75698
|
+
if (component.scheme) {
|
|
75699
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
75700
|
+
}
|
|
75482
75701
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
75483
75702
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
75703
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
75704
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
75484
75705
|
if (component.path !== void 0) {
|
|
75485
75706
|
if (!options.skipEscape) {
|
|
75486
|
-
component.path =
|
|
75487
|
-
if (component.scheme !== void 0) {
|
|
75488
|
-
component.path = component.path.split("%3A").join(":");
|
|
75489
|
-
}
|
|
75707
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
75490
75708
|
} else {
|
|
75491
75709
|
component.path = normalizePercentEncoding(component.path);
|
|
75492
75710
|
}
|
|
75493
75711
|
}
|
|
75494
75712
|
if (options.reference !== "suffix" && component.scheme) {
|
|
75713
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
75495
75714
|
uriTokens.push(component.scheme, ":");
|
|
75496
75715
|
}
|
|
75497
75716
|
const authority = recomposeAuthority(component);
|
|
@@ -75509,16 +75728,19 @@ var require_fast_uri = __commonJS({
|
|
|
75509
75728
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
75510
75729
|
s = removeDotSegments(s);
|
|
75511
75730
|
}
|
|
75731
|
+
if (pathNoScheme) {
|
|
75732
|
+
s = serializePathEncoding(s, true);
|
|
75733
|
+
}
|
|
75512
75734
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") {
|
|
75513
75735
|
s = "/%2F" + s.slice(2);
|
|
75514
75736
|
}
|
|
75515
75737
|
uriTokens.push(s);
|
|
75516
75738
|
}
|
|
75517
75739
|
if (component.query !== void 0) {
|
|
75518
|
-
uriTokens.push("?", component.query);
|
|
75740
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
75519
75741
|
}
|
|
75520
75742
|
if (component.fragment !== void 0) {
|
|
75521
|
-
uriTokens.push("#", component.fragment);
|
|
75743
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
75522
75744
|
}
|
|
75523
75745
|
return uriTokens.join("");
|
|
75524
75746
|
}
|
|
@@ -75534,6 +75756,32 @@ var require_fast_uri = __commonJS({
|
|
|
75534
75756
|
}
|
|
75535
75757
|
return void 0;
|
|
75536
75758
|
}
|
|
75759
|
+
function hasMalformedPercentEncoding(component) {
|
|
75760
|
+
if (component === void 0) return false;
|
|
75761
|
+
let percent = component.indexOf("%");
|
|
75762
|
+
while (percent !== -1) {
|
|
75763
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
75764
|
+
return true;
|
|
75765
|
+
}
|
|
75766
|
+
percent = component.indexOf("%", percent + 3);
|
|
75767
|
+
}
|
|
75768
|
+
return false;
|
|
75769
|
+
}
|
|
75770
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
75771
|
+
const host = matches[4];
|
|
75772
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host[0] === "[" && host[host.length - 1] === "]") && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
75773
|
+
}
|
|
75774
|
+
function canonicalizeHost(parsed2, options, schemeHandler, isIP) {
|
|
75775
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed2.host && parsed2.host[0] !== "[" && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed2.host)) {
|
|
75776
|
+
try {
|
|
75777
|
+
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
75778
|
+
} catch (e) {
|
|
75779
|
+
parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
75780
|
+
return true;
|
|
75781
|
+
}
|
|
75782
|
+
}
|
|
75783
|
+
return false;
|
|
75784
|
+
}
|
|
75537
75785
|
function parseWithStatus(uri, opts) {
|
|
75538
75786
|
const options = Object.assign({}, opts);
|
|
75539
75787
|
const parsed2 = {
|
|
@@ -75546,6 +75794,11 @@ var require_fast_uri = __commonJS({
|
|
|
75546
75794
|
fragment: void 0
|
|
75547
75795
|
};
|
|
75548
75796
|
let malformedAuthorityOrPort = false;
|
|
75797
|
+
let malformedPercentEncoding = false;
|
|
75798
|
+
let malformedSchemeSpecific = false;
|
|
75799
|
+
let malformedHost = false;
|
|
75800
|
+
let malformedIPLiteral = false;
|
|
75801
|
+
let malformedScheme = false;
|
|
75549
75802
|
let isIP = false;
|
|
75550
75803
|
if (options.reference === "suffix") {
|
|
75551
75804
|
if (options.scheme) {
|
|
@@ -75582,6 +75835,19 @@ var require_fast_uri = __commonJS({
|
|
|
75582
75835
|
parsed2.path = matches[6] || "";
|
|
75583
75836
|
parsed2.query = matches[7];
|
|
75584
75837
|
parsed2.fragment = matches[8];
|
|
75838
|
+
if (parsed2.scheme !== void 0) {
|
|
75839
|
+
const decodedScheme = unescape(parsed2.scheme);
|
|
75840
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
75841
|
+
parsed2.scheme = decodedScheme.toLowerCase();
|
|
75842
|
+
} else {
|
|
75843
|
+
parsed2.error = parsed2.error || MALFORMED_SCHEME_ERROR;
|
|
75844
|
+
malformedScheme = true;
|
|
75845
|
+
}
|
|
75846
|
+
}
|
|
75847
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
75848
|
+
if (malformedPercentEncoding) {
|
|
75849
|
+
parsed2.error = parsed2.error || "URI contains malformed percent-encoding.";
|
|
75850
|
+
}
|
|
75585
75851
|
if (isNaN(parsed2.port)) {
|
|
75586
75852
|
parsed2.port = matches[5];
|
|
75587
75853
|
}
|
|
@@ -75593,9 +75859,15 @@ var require_fast_uri = __commonJS({
|
|
|
75593
75859
|
if (parsed2.host) {
|
|
75594
75860
|
const ipv4result = isIPv4(parsed2.host);
|
|
75595
75861
|
if (ipv4result === false) {
|
|
75862
|
+
const bracketedIPLiteral = parsed2.host[0] === "[" && parsed2.host[parsed2.host.length - 1] === "]";
|
|
75596
75863
|
const ipv6result = normalizeIPv6(parsed2.host);
|
|
75597
|
-
|
|
75598
|
-
|
|
75864
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
75865
|
+
malformedIPLiteral = bracketedIPLiteral && ipv6result.error === true;
|
|
75866
|
+
parsed2.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
75867
|
+
if (malformedIPLiteral) {
|
|
75868
|
+
parsed2.error = parsed2.error || "URI host is malformed.";
|
|
75869
|
+
malformedAuthorityOrPort = true;
|
|
75870
|
+
}
|
|
75599
75871
|
} else {
|
|
75600
75872
|
isIP = true;
|
|
75601
75873
|
}
|
|
@@ -75613,42 +75885,34 @@ var require_fast_uri = __commonJS({
|
|
|
75613
75885
|
parsed2.error = parsed2.error || "URI is not a " + options.reference + " reference.";
|
|
75614
75886
|
}
|
|
75615
75887
|
const schemeHandler = getSchemeHandler(options.scheme || parsed2.scheme);
|
|
75616
|
-
|
|
75617
|
-
if (parsed2.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed2.host)) {
|
|
75618
|
-
try {
|
|
75619
|
-
parsed2.host = new URL("http://" + parsed2.host).hostname;
|
|
75620
|
-
} catch (e) {
|
|
75621
|
-
parsed2.error = parsed2.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
75622
|
-
}
|
|
75623
|
-
}
|
|
75624
|
-
}
|
|
75888
|
+
malformedHost = canonicalizeHost(parsed2, options, schemeHandler, isIP);
|
|
75625
75889
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
75626
75890
|
if (uri.indexOf("%") !== -1) {
|
|
75627
|
-
if (parsed2.
|
|
75628
|
-
parsed2.
|
|
75629
|
-
|
|
75630
|
-
if (parsed2.host !== void 0) {
|
|
75631
|
-
parsed2.host = reescapeHostDelimiters(unescape(parsed2.host), isIP);
|
|
75891
|
+
if (parsed2.host !== void 0 && !malformedIPLiteral) {
|
|
75892
|
+
const host = isIP ? parsed2.host : normalizePercentEncoding(parsed2.host, true);
|
|
75893
|
+
parsed2.host = reescapeHostDelimiters(host, isIP);
|
|
75632
75894
|
}
|
|
75633
75895
|
}
|
|
75634
75896
|
if (parsed2.path) {
|
|
75635
75897
|
parsed2.path = normalizePathEncoding(parsed2.path);
|
|
75636
75898
|
}
|
|
75899
|
+
if (parsed2.query) {
|
|
75900
|
+
parsed2.query = normalizeQueryFragmentEncoding(parsed2.query);
|
|
75901
|
+
}
|
|
75637
75902
|
if (parsed2.fragment) {
|
|
75638
|
-
|
|
75639
|
-
parsed2.fragment = encodeURI(decodeURIComponent(parsed2.fragment));
|
|
75640
|
-
} catch {
|
|
75641
|
-
parsed2.error = parsed2.error || "URI malformed";
|
|
75642
|
-
}
|
|
75903
|
+
parsed2.fragment = normalizeQueryFragmentEncoding(parsed2.fragment);
|
|
75643
75904
|
}
|
|
75644
75905
|
}
|
|
75645
75906
|
if (schemeHandler && schemeHandler.parse) {
|
|
75646
75907
|
schemeHandler.parse(parsed2, options);
|
|
75908
|
+
if (schemeHandler === SCHEMES.urn && parsed2.nid === void 0) {
|
|
75909
|
+
malformedSchemeSpecific = true;
|
|
75910
|
+
}
|
|
75647
75911
|
}
|
|
75648
75912
|
} else {
|
|
75649
75913
|
parsed2.error = parsed2.error || "URI can not be parsed.";
|
|
75650
75914
|
}
|
|
75651
|
-
return { parsed: parsed2, malformedAuthorityOrPort };
|
|
75915
|
+
return { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
75652
75916
|
}
|
|
75653
75917
|
function parse6(uri, opts) {
|
|
75654
75918
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -75657,20 +75921,28 @@ var require_fast_uri = __commonJS({
|
|
|
75657
75921
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
75658
75922
|
}
|
|
75659
75923
|
function normalizeStringWithStatus(uri, opts) {
|
|
75660
|
-
const { parsed: parsed2, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
75924
|
+
const { parsed: parsed2, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
75661
75925
|
return {
|
|
75662
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed2, opts),
|
|
75663
|
-
malformedAuthorityOrPort
|
|
75926
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed2, opts),
|
|
75927
|
+
malformedAuthorityOrPort,
|
|
75928
|
+
malformedPercentEncoding,
|
|
75929
|
+
malformedSchemeSpecific,
|
|
75930
|
+
malformedHost,
|
|
75931
|
+
malformedScheme
|
|
75664
75932
|
};
|
|
75665
75933
|
}
|
|
75666
75934
|
function normalizeComparableURI(uri, opts) {
|
|
75667
|
-
if (typeof uri
|
|
75668
|
-
|
|
75669
|
-
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
75935
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
75936
|
+
return void 0;
|
|
75670
75937
|
}
|
|
75671
|
-
|
|
75672
|
-
|
|
75938
|
+
let value2;
|
|
75939
|
+
try {
|
|
75940
|
+
value2 = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
75941
|
+
} catch {
|
|
75942
|
+
return void 0;
|
|
75673
75943
|
}
|
|
75944
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value2, opts);
|
|
75945
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
75674
75946
|
}
|
|
75675
75947
|
var fastUri = {
|
|
75676
75948
|
SCHEMES,
|
|
@@ -80932,137 +81204,6 @@ var require_light = __commonJS({
|
|
|
80932
81204
|
}
|
|
80933
81205
|
});
|
|
80934
81206
|
|
|
80935
|
-
// node_modules/.pnpm/content-type@2.0.0/node_modules/content-type/dist/index.js
|
|
80936
|
-
var require_dist4 = __commonJS({
|
|
80937
|
-
"node_modules/.pnpm/content-type@2.0.0/node_modules/content-type/dist/index.js"(exports) {
|
|
80938
|
-
"use strict";
|
|
80939
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80940
|
-
exports.format = format2;
|
|
80941
|
-
exports.parse = parse6;
|
|
80942
|
-
var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
|
|
80943
|
-
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
80944
|
-
var QUOTE_REGEXP = /[\\"]/g;
|
|
80945
|
-
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
80946
|
-
var NullObject = /* @__PURE__ */ (() => {
|
|
80947
|
-
const C = function() {
|
|
80948
|
-
};
|
|
80949
|
-
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
80950
|
-
return C;
|
|
80951
|
-
})();
|
|
80952
|
-
function format2(obj) {
|
|
80953
|
-
const { type: type2, parameters } = obj;
|
|
80954
|
-
if (!type2 || !TYPE_REGEXP.test(type2)) {
|
|
80955
|
-
throw new TypeError(`Invalid type: ${type2}`);
|
|
80956
|
-
}
|
|
80957
|
-
let result = type2;
|
|
80958
|
-
if (parameters) {
|
|
80959
|
-
for (const param of Object.keys(parameters)) {
|
|
80960
|
-
if (!TOKEN_REGEXP.test(param)) {
|
|
80961
|
-
throw new TypeError(`Invalid parameter name: ${param}`);
|
|
80962
|
-
}
|
|
80963
|
-
result += `; ${param}=${qstring(parameters[param])}`;
|
|
80964
|
-
}
|
|
80965
|
-
}
|
|
80966
|
-
return result;
|
|
80967
|
-
}
|
|
80968
|
-
function parse6(header, options) {
|
|
80969
|
-
const len = header.length;
|
|
80970
|
-
let index = skipOWS(header, 0, len);
|
|
80971
|
-
const valueStart = index;
|
|
80972
|
-
index = skipValue(header, index, len);
|
|
80973
|
-
const valueEnd = trailingOWS(header, valueStart, index);
|
|
80974
|
-
const type2 = header.slice(valueStart, valueEnd).toLowerCase();
|
|
80975
|
-
const parameters = options?.parameters === false ? new NullObject() : parseParameters(header, index, len);
|
|
80976
|
-
return { type: type2, parameters };
|
|
80977
|
-
}
|
|
80978
|
-
var SP = 32;
|
|
80979
|
-
var HTAB = 9;
|
|
80980
|
-
var SEMI = 59;
|
|
80981
|
-
var EQ = 61;
|
|
80982
|
-
var DQUOTE = 34;
|
|
80983
|
-
var BSLASH = 92;
|
|
80984
|
-
function parseParameters(header, index, len) {
|
|
80985
|
-
const parameters = new NullObject();
|
|
80986
|
-
parameter: while (index < len) {
|
|
80987
|
-
index = skipOWS(header, index + 1, len);
|
|
80988
|
-
const keyStart = index;
|
|
80989
|
-
while (index < len) {
|
|
80990
|
-
const code = header.charCodeAt(index);
|
|
80991
|
-
if (code === SEMI)
|
|
80992
|
-
continue parameter;
|
|
80993
|
-
if (code === EQ) {
|
|
80994
|
-
const keyEnd = trailingOWS(header, keyStart, index);
|
|
80995
|
-
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
80996
|
-
index = skipOWS(header, index + 1, len);
|
|
80997
|
-
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
80998
|
-
index++;
|
|
80999
|
-
let value2 = "";
|
|
81000
|
-
while (index < len) {
|
|
81001
|
-
const code2 = header.charCodeAt(index++);
|
|
81002
|
-
if (code2 === DQUOTE) {
|
|
81003
|
-
index = skipValue(header, index, len);
|
|
81004
|
-
if (parameters[key] === void 0)
|
|
81005
|
-
parameters[key] = value2;
|
|
81006
|
-
break;
|
|
81007
|
-
}
|
|
81008
|
-
if (code2 === BSLASH && index < len) {
|
|
81009
|
-
value2 += header[index++];
|
|
81010
|
-
continue;
|
|
81011
|
-
}
|
|
81012
|
-
value2 += String.fromCharCode(code2);
|
|
81013
|
-
}
|
|
81014
|
-
continue parameter;
|
|
81015
|
-
}
|
|
81016
|
-
const valueStart = index;
|
|
81017
|
-
index = skipValue(header, index, len);
|
|
81018
|
-
if (parameters[key] === void 0) {
|
|
81019
|
-
const valueEnd = trailingOWS(header, valueStart, index);
|
|
81020
|
-
parameters[key] = header.slice(valueStart, valueEnd);
|
|
81021
|
-
}
|
|
81022
|
-
continue parameter;
|
|
81023
|
-
}
|
|
81024
|
-
index++;
|
|
81025
|
-
}
|
|
81026
|
-
}
|
|
81027
|
-
return parameters;
|
|
81028
|
-
}
|
|
81029
|
-
function skipValue(str, index, len) {
|
|
81030
|
-
while (index < len) {
|
|
81031
|
-
const char = str.charCodeAt(index);
|
|
81032
|
-
if (char === SEMI)
|
|
81033
|
-
break;
|
|
81034
|
-
index++;
|
|
81035
|
-
}
|
|
81036
|
-
return index;
|
|
81037
|
-
}
|
|
81038
|
-
function skipOWS(header, index, len) {
|
|
81039
|
-
while (index < len) {
|
|
81040
|
-
const char = header.charCodeAt(index);
|
|
81041
|
-
if (char !== SP && char !== HTAB)
|
|
81042
|
-
break;
|
|
81043
|
-
index++;
|
|
81044
|
-
}
|
|
81045
|
-
return index;
|
|
81046
|
-
}
|
|
81047
|
-
function trailingOWS(header, start, end) {
|
|
81048
|
-
while (end > start) {
|
|
81049
|
-
const char = header.charCodeAt(end - 1);
|
|
81050
|
-
if (char !== SP && char !== HTAB)
|
|
81051
|
-
break;
|
|
81052
|
-
end--;
|
|
81053
|
-
}
|
|
81054
|
-
return end;
|
|
81055
|
-
}
|
|
81056
|
-
function qstring(str) {
|
|
81057
|
-
if (TOKEN_REGEXP.test(str))
|
|
81058
|
-
return str;
|
|
81059
|
-
if (TEXT_REGEXP.test(str))
|
|
81060
|
-
return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
|
|
81061
|
-
throw new TypeError(`Invalid parameter value: ${str}`);
|
|
81062
|
-
}
|
|
81063
|
-
}
|
|
81064
|
-
});
|
|
81065
|
-
|
|
81066
81207
|
// node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Event.js
|
|
81067
81208
|
var require_Event = __commonJS({
|
|
81068
81209
|
"node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Event.js"(exports, module) {
|
|
@@ -83105,7 +83246,7 @@ var require_select = __commonJS({
|
|
|
83105
83246
|
var compareDocumentPosition = function(a, b) {
|
|
83106
83247
|
return a.compareDocumentPosition(b);
|
|
83107
83248
|
};
|
|
83108
|
-
var
|
|
83249
|
+
var order2 = function(a, b) {
|
|
83109
83250
|
return compareDocumentPosition(a, b) & 2 ? 1 : -1;
|
|
83110
83251
|
};
|
|
83111
83252
|
var next2 = function(el) {
|
|
@@ -83786,7 +83927,7 @@ var require_select = __commonJS({
|
|
|
83786
83927
|
}
|
|
83787
83928
|
}
|
|
83788
83929
|
}
|
|
83789
|
-
results.sort(
|
|
83930
|
+
results.sort(order2);
|
|
83790
83931
|
}
|
|
83791
83932
|
return results;
|
|
83792
83933
|
};
|
|
@@ -103673,7 +103814,12 @@ var providers = {
|
|
|
103673
103814
|
displayName: "O3",
|
|
103674
103815
|
resolve: "openai/o3",
|
|
103675
103816
|
effort: ["low", "medium", "high"],
|
|
103676
|
-
openRouterResolve: "openrouter/openai/o3"
|
|
103817
|
+
openRouterResolve: "openrouter/openai/o3",
|
|
103818
|
+
// OpenRouter publishes a reasoning TOGGLE for o3 where direct OpenAI
|
|
103819
|
+
// publishes a ladder, so the route genuinely has no rungs. `[]` rather
|
|
103820
|
+
// than omitting the field: an absent openRouterEffort falls through to
|
|
103821
|
+
// `effort` and would send a rung this route rejects.
|
|
103822
|
+
openRouterEffort: []
|
|
103677
103823
|
}
|
|
103678
103824
|
}
|
|
103679
103825
|
}),
|
|
@@ -103837,7 +103983,21 @@ var providers = {
|
|
|
103837
103983
|
resolve: "opencode/claude-opus-5",
|
|
103838
103984
|
effort: ["low", "medium", "high", "xhigh", "max"],
|
|
103839
103985
|
openRouterResolve: "openrouter/anthropic/claude-opus-5",
|
|
103840
|
-
subagentModel: "claude-sonnet"
|
|
103986
|
+
subagentModel: "claude-sonnet",
|
|
103987
|
+
// TEMPORARY — clear this ONLY when opus completes a run through opencode,
|
|
103988
|
+
// never when the endpoint merely answers. Zen LISTS claude-opus-5 in
|
|
103989
|
+
// /zen/v1/models, so the catalog test passes; on 2026-08-25 the endpoint
|
|
103990
|
+
// itself answered 503 `Upstream request failed: Endpoint is unavailable.`
|
|
103991
|
+
// (measured 5/5; claude-sonnet-5, claude-opus-4-8, claude-haiku-4-5 and
|
|
103992
|
+
// claude-fable-5 all 200 on the same key). opencode retries above the AI
|
|
103993
|
+
// SDK emitting no part.updated, so a run just produces nothing until it is
|
|
103994
|
+
// killed — metaideas/init logged six zero-output failures from 2026-08-23.
|
|
103995
|
+
// The 503 has since cleared and the model is STILL unusable: re-measured
|
|
103996
|
+
// 2026-08-26, direct POST /zen/v1/messages is 10/10 200 at 1.3-4.1s while
|
|
103997
|
+
// `opencode run --model opencode/claude-opus-5` on the same trivial prompt
|
|
103998
|
+
// emitted nothing for 240s in CI. A raw-endpoint 200 is not runtime
|
|
103999
|
+
// availability. see wiki/opencode-silent-stall.md
|
|
104000
|
+
fallback: "opencode/claude-sonnet"
|
|
103841
104001
|
},
|
|
103842
104002
|
"claude-sonnet": {
|
|
103843
104003
|
displayName: "Claude Sonnet",
|
|
@@ -103967,22 +104127,139 @@ var providers = {
|
|
|
103967
104127
|
}
|
|
103968
104128
|
}
|
|
103969
104129
|
}),
|
|
104130
|
+
// OpenCode Go is a separate $10/mo subscription from Zen, served on its own
|
|
104131
|
+
// base URL (`https://opencode.ai/zen/go/v1`) but authenticated with the SAME
|
|
104132
|
+
// `OPENCODE_API_KEY`. it carries the open-weight coding models plus a couple
|
|
104133
|
+
// of frontier ones, and 14 of the ids below are served ONLY here — Zen's
|
|
104134
|
+
// `/v1/models` does not list glm-5.3*, qwen3.7/3.8-*, mimo-*, longcat-2.0,
|
|
104135
|
+
// hy3 or muse-spark. so for a Go subscriber this provider is not a duplicate
|
|
104136
|
+
// route to Zen, it is the only route to most of what they pay for.
|
|
104137
|
+
// like `opencode` and `openrouter` this is a ROUTER, not a vendor: slugs and
|
|
104138
|
+
// display names mirror the upstream brand tier, and the picker groups them
|
|
104139
|
+
// under the upstream vendor.
|
|
103970
104140
|
"opencode-go": provider({
|
|
103971
104141
|
displayName: "OpenCode Go",
|
|
103972
104142
|
envVars: ["OPENCODE_API_KEY"],
|
|
103973
104143
|
models: {
|
|
104144
|
+
// Z.ai — the plan's flagship coding family, and the only route the
|
|
104145
|
+
// catalog offers to GLM at all.
|
|
104146
|
+
glm: {
|
|
104147
|
+
displayName: "GLM",
|
|
104148
|
+
resolve: "opencode-go/glm-5.3",
|
|
104149
|
+
effort: ["low", "high", "max"],
|
|
104150
|
+
openRouterResolve: "openrouter/z-ai/glm-5.3",
|
|
104151
|
+
preferred: true,
|
|
104152
|
+
subagentModel: "glm-flash"
|
|
104153
|
+
},
|
|
104154
|
+
"glm-flash": {
|
|
104155
|
+
displayName: "GLM Flash",
|
|
104156
|
+
resolve: "opencode-go/glm-5.3-flash",
|
|
104157
|
+
effort: ["low", "high", "max"],
|
|
104158
|
+
openRouterResolve: "openrouter/z-ai/glm-5.3-flash"
|
|
104159
|
+
},
|
|
104160
|
+
// legacy alias — the slug pinned a version instead of a brand tier and
|
|
104161
|
+
// was already resolving to 5.2 under a "GLM 5.2" label. folds forward to
|
|
104162
|
+
// the tier slug; 16 repos and 9 accounts still hold it.
|
|
103974
104163
|
"glm-5.1": {
|
|
103975
104164
|
displayName: "GLM 5.2",
|
|
103976
104165
|
resolve: "opencode-go/glm-5.2",
|
|
103977
104166
|
effort: ["high", "max"],
|
|
103978
104167
|
openRouterEffort: ["high", "xhigh"],
|
|
103979
104168
|
openRouterResolve: "openrouter/z-ai/glm-5.2",
|
|
103980
|
-
|
|
104169
|
+
fallback: "opencode-go/glm"
|
|
104170
|
+
},
|
|
104171
|
+
// Moonshot — parity with moonshotai/* and openrouter/*.
|
|
104172
|
+
"kimi-k3": {
|
|
104173
|
+
displayName: "Kimi K3",
|
|
104174
|
+
resolve: "opencode-go/kimi-k3",
|
|
104175
|
+
// Go publishes a single rung for K3 where the OpenRouter route
|
|
104176
|
+
// publishes three, so every position lands on `max` here.
|
|
104177
|
+
effort: ["max"],
|
|
104178
|
+
openRouterEffort: ["low", "high", "max"],
|
|
104179
|
+
openRouterResolve: "openrouter/moonshotai/kimi-k3",
|
|
104180
|
+
subagentModel: "kimi-k2"
|
|
103981
104181
|
},
|
|
103982
104182
|
"kimi-k2": {
|
|
103983
104183
|
displayName: "Kimi K2",
|
|
103984
104184
|
resolve: "opencode-go/kimi-k2.7-code",
|
|
103985
104185
|
openRouterResolve: "openrouter/moonshotai/kimi-k2.7-code"
|
|
104186
|
+
},
|
|
104187
|
+
// DeepSeek and Muse Spark are deliberately ABSENT even though Go serves
|
|
104188
|
+
// them and prices DeepSeek Pro below Zen. each sits behind a per-workspace
|
|
104189
|
+
// opt-in that is off by default — measured, the run dies with
|
|
104190
|
+
// `RegionError` ("only available hosted in China") and `DataPolicyError`
|
|
104191
|
+
// ("collects data used to improve its quality"). that toggle lives on the
|
|
104192
|
+
// CUSTOMER's OpenCode workspace, so no change here can satisfy it, and a
|
|
104193
|
+
// picker row that fails for almost everyone is worse than none. DeepSeek
|
|
104194
|
+
// stays reachable ungated via `deepseek/*`, `opencode/*` and
|
|
104195
|
+
// `openrouter/*`; both remain runnable by full specifier once opted in.
|
|
104196
|
+
// Alibaba — new vendor family for the catalog; Zen serves neither tier.
|
|
104197
|
+
"qwen-max": {
|
|
104198
|
+
displayName: "Qwen Max",
|
|
104199
|
+
resolve: "opencode-go/qwen3.8-max",
|
|
104200
|
+
// both routes publish rungs, and they are different sets rather than
|
|
104201
|
+
// different spellings of one — OpenRouter carries a `minimal` and a
|
|
104202
|
+
// `high` the Go route does not.
|
|
104203
|
+
effort: ["low", "medium", "xhigh"],
|
|
104204
|
+
openRouterEffort: ["minimal", "low", "medium", "high", "xhigh"],
|
|
104205
|
+
openRouterResolve: "openrouter/qwen/qwen3.8-max"
|
|
104206
|
+
},
|
|
104207
|
+
"qwen-plus": {
|
|
104208
|
+
displayName: "Qwen Plus",
|
|
104209
|
+
resolve: "opencode-go/qwen3.7-plus",
|
|
104210
|
+
openRouterResolve: "openrouter/qwen/qwen3.7-plus"
|
|
104211
|
+
},
|
|
104212
|
+
// MiniMax — parity with opencode/* and openrouter/*; the m2 slug pins the
|
|
104213
|
+
// line for DB stability while the resolve tracks the current m2.7.
|
|
104214
|
+
"minimax-m3": {
|
|
104215
|
+
displayName: "MiniMax M3",
|
|
104216
|
+
resolve: "opencode-go/minimax-m3",
|
|
104217
|
+
openRouterResolve: "openrouter/minimax/minimax-m3"
|
|
104218
|
+
},
|
|
104219
|
+
"minimax-m2.5": {
|
|
104220
|
+
displayName: "MiniMax M2",
|
|
104221
|
+
resolve: "opencode-go/minimax-m2.7",
|
|
104222
|
+
openRouterResolve: "openrouter/minimax/minimax-m2.7"
|
|
104223
|
+
},
|
|
104224
|
+
// Xiaomi — Go-only; Zen serves the free `mimo-v2-pro-free` promo instead.
|
|
104225
|
+
"mimo-pro": {
|
|
104226
|
+
displayName: "MiMo Pro",
|
|
104227
|
+
resolve: "opencode-go/mimo-v2.5-pro",
|
|
104228
|
+
openRouterResolve: "openrouter/xiaomi/mimo-v2.5-pro"
|
|
104229
|
+
},
|
|
104230
|
+
// Meituan — Go-only.
|
|
104231
|
+
longcat: {
|
|
104232
|
+
displayName: "LongCat",
|
|
104233
|
+
resolve: "opencode-go/longcat-2.0",
|
|
104234
|
+
openRouterResolve: "openrouter/meituan/longcat-2.0"
|
|
104235
|
+
},
|
|
104236
|
+
// Tencent — Go-only, and the cheapest model on the plan by an order of
|
|
104237
|
+
// magnitude (0.0175/0.0725). Hy3 succeeds the Hunyuan 2.0 line, so the
|
|
104238
|
+
// generation is part of the product name the way Kimi K2/K3 is.
|
|
104239
|
+
hy3: {
|
|
104240
|
+
displayName: "Hy3",
|
|
104241
|
+
resolve: "opencode-go/hy3",
|
|
104242
|
+
effort: ["none", "low", "high"],
|
|
104243
|
+
openRouterResolve: "openrouter/tencent/hy3"
|
|
104244
|
+
},
|
|
104245
|
+
// xAI and OpenAI — the two non-open models on the plan. same list price as
|
|
104246
|
+
// Zen, but a Go subscription covers them where Zen meters them.
|
|
104247
|
+
// Go is the only route that has retired grok-4.5 (models.dev marks
|
|
104248
|
+
// `opencode-go/grok-4.5` deprecated while every other provider still
|
|
104249
|
+
// serves it), so this alias LEADS `xai/grok` by a generation. a mirror
|
|
104250
|
+
// that leads is safe; it is the trailing case that rots — see
|
|
104251
|
+
// wiki/models-catalog.md on `opencode/kimi-k2`.
|
|
104252
|
+
grok: {
|
|
104253
|
+
displayName: "Grok",
|
|
104254
|
+
resolve: "opencode-go/grok-4.6",
|
|
104255
|
+
effort: ["low", "medium", "high", "xhigh"],
|
|
104256
|
+
openRouterResolve: "openrouter/x-ai/grok-4.6"
|
|
104257
|
+
},
|
|
104258
|
+
"gpt-luna": {
|
|
104259
|
+
displayName: "GPT Luna",
|
|
104260
|
+
resolve: "opencode-go/gpt-5.6-luna",
|
|
104261
|
+
effort: ["none", "low", "medium", "high", "xhigh", "max"],
|
|
104262
|
+
openRouterResolve: "openrouter/openai/gpt-5.6-luna"
|
|
103986
104263
|
}
|
|
103987
104264
|
}
|
|
103988
104265
|
}),
|
|
@@ -104159,7 +104436,6 @@ var providers = {
|
|
|
104159
104436
|
"o4-mini": {
|
|
104160
104437
|
displayName: "O4 Mini",
|
|
104161
104438
|
resolve: "openrouter/openai/o4-mini",
|
|
104162
|
-
effort: ["low", "medium", "high"],
|
|
104163
104439
|
openRouterResolve: "openrouter/openai/o4-mini"
|
|
104164
104440
|
},
|
|
104165
104441
|
"gemini-pro": {
|
|
@@ -104660,7 +104936,6 @@ function logTokenTable(t) {
|
|
|
104660
104936
|
|
|
104661
104937
|
// utils/globals.ts
|
|
104662
104938
|
import { existsSync } from "node:fs";
|
|
104663
|
-
var isCloudflareSandbox = !!process.env.CLOUDFLARE_APPLICATION_ID && !!process.env.SANDBOX_VERSION;
|
|
104664
104939
|
var isGitHubActions = !!process.env.GITHUB_ACTIONS;
|
|
104665
104940
|
var isInsideDocker = existsSync("/.dockerenv");
|
|
104666
104941
|
|
|
@@ -105191,7 +105466,7 @@ var import_semver = __toESM(require_semver2(), 1);
|
|
|
105191
105466
|
// package.json
|
|
105192
105467
|
var package_default = {
|
|
105193
105468
|
name: "pullfrog",
|
|
105194
|
-
version: "0.1.
|
|
105469
|
+
version: "0.1.65",
|
|
105195
105470
|
type: "module",
|
|
105196
105471
|
bin: {
|
|
105197
105472
|
pullfrog: "dist/cli.mjs",
|
|
@@ -123191,7 +123466,7 @@ Fuse.use = function(...plugins) {
|
|
|
123191
123466
|
};
|
|
123192
123467
|
var entry_default = Fuse;
|
|
123193
123468
|
|
|
123194
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123469
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/compose.js
|
|
123195
123470
|
var compose = (middleware, onError, onNotFound) => {
|
|
123196
123471
|
return (context, next2) => {
|
|
123197
123472
|
let index = -1;
|
|
@@ -123235,10 +123510,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
123235
123510
|
};
|
|
123236
123511
|
};
|
|
123237
123512
|
|
|
123238
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123513
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/request/constants.js
|
|
123239
123514
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
123240
123515
|
|
|
123241
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123516
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/buffer.js
|
|
123242
123517
|
var bufferToFormData = (arrayBuffer, contentType) => {
|
|
123243
123518
|
const response = new Response(arrayBuffer, {
|
|
123244
123519
|
headers: {
|
|
@@ -123249,7 +123524,9 @@ var bufferToFormData = (arrayBuffer, contentType) => {
|
|
|
123249
123524
|
return response.formData();
|
|
123250
123525
|
};
|
|
123251
123526
|
|
|
123252
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123527
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/body.js
|
|
123528
|
+
var MAX_NESTING_DEPTH = 32;
|
|
123529
|
+
var MAX_NESTED_OBJECTS = 1e4;
|
|
123253
123530
|
var isRawRequest = (request2) => "headers" in request2;
|
|
123254
123531
|
var parseBody = async (request2, options = /* @__PURE__ */ Object.create(null)) => {
|
|
123255
123532
|
const { all = false, dot = false } = options;
|
|
@@ -123282,6 +123559,7 @@ async function parseFormData(request2, options) {
|
|
|
123282
123559
|
}
|
|
123283
123560
|
function convertFormDataToBodyData(formData, options) {
|
|
123284
123561
|
const form = /* @__PURE__ */ Object.create(null);
|
|
123562
|
+
const nestingState = { count: 0 };
|
|
123285
123563
|
formData.forEach((value2, key) => {
|
|
123286
123564
|
const shouldParseAllValues = options.all || key.endsWith("[]");
|
|
123287
123565
|
if (!shouldParseAllValues) {
|
|
@@ -123294,7 +123572,7 @@ function convertFormDataToBodyData(formData, options) {
|
|
|
123294
123572
|
Object.entries(form).forEach(([key, value2]) => {
|
|
123295
123573
|
const shouldParseDotValues = key.includes(".");
|
|
123296
123574
|
if (shouldParseDotValues) {
|
|
123297
|
-
handleParsingNestedValues(form, key, value2);
|
|
123575
|
+
handleParsingNestedValues(form, key, value2, nestingState);
|
|
123298
123576
|
delete form[key];
|
|
123299
123577
|
}
|
|
123300
123578
|
});
|
|
@@ -123317,25 +123595,34 @@ var handleParsingAllValues = (form, key, value2) => {
|
|
|
123317
123595
|
}
|
|
123318
123596
|
}
|
|
123319
123597
|
};
|
|
123320
|
-
var handleParsingNestedValues = (form, key, value2) => {
|
|
123598
|
+
var handleParsingNestedValues = (form, key, value2, state) => {
|
|
123321
123599
|
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
123322
123600
|
return;
|
|
123323
123601
|
}
|
|
123324
123602
|
let nestedForm = form;
|
|
123325
|
-
const keys = key.split(".");
|
|
123603
|
+
const keys = key.split(".", MAX_NESTING_DEPTH + 2);
|
|
123604
|
+
if (keys.length > MAX_NESTING_DEPTH + 1) {
|
|
123605
|
+
throwNestingLimitExceeded();
|
|
123606
|
+
}
|
|
123326
123607
|
keys.forEach((key2, index) => {
|
|
123327
123608
|
if (index === keys.length - 1) {
|
|
123328
123609
|
nestedForm[key2] = value2;
|
|
123329
123610
|
} else {
|
|
123330
123611
|
if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
|
|
123612
|
+
if (state.count++ >= MAX_NESTED_OBJECTS) {
|
|
123613
|
+
throwNestingLimitExceeded();
|
|
123614
|
+
}
|
|
123331
123615
|
nestedForm[key2] = /* @__PURE__ */ Object.create(null);
|
|
123332
123616
|
}
|
|
123333
123617
|
nestedForm = nestedForm[key2];
|
|
123334
123618
|
}
|
|
123335
123619
|
});
|
|
123336
123620
|
};
|
|
123621
|
+
var throwNestingLimitExceeded = () => {
|
|
123622
|
+
throw new Error("Nesting limit exceeded");
|
|
123623
|
+
};
|
|
123337
123624
|
|
|
123338
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123625
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/url.js
|
|
123339
123626
|
var splitPath = (path4) => {
|
|
123340
123627
|
const paths = path4.split("/");
|
|
123341
123628
|
if (paths[0] === "") {
|
|
@@ -123441,13 +123728,13 @@ var checkOptionalParameter = (path4) => {
|
|
|
123441
123728
|
if (segment !== "" && !/\:/.test(segment)) {
|
|
123442
123729
|
basePath += "/" + segment;
|
|
123443
123730
|
} else if (/\:/.test(segment)) {
|
|
123444
|
-
if (
|
|
123731
|
+
if (segment.charCodeAt(segment.length - 1) === 63) {
|
|
123445
123732
|
if (results.length === 0 && basePath === "") {
|
|
123446
123733
|
results.push("/");
|
|
123447
123734
|
} else {
|
|
123448
123735
|
results.push(basePath);
|
|
123449
123736
|
}
|
|
123450
|
-
const optionalSegment = segment.
|
|
123737
|
+
const optionalSegment = segment.slice(0, -1);
|
|
123451
123738
|
basePath += "/" + optionalSegment;
|
|
123452
123739
|
results.push(basePath);
|
|
123453
123740
|
} else {
|
|
@@ -123465,6 +123752,10 @@ var _decodeURI = (value2) => {
|
|
|
123465
123752
|
return tryDecodeURIComponent(value2);
|
|
123466
123753
|
};
|
|
123467
123754
|
var _getQueryParam = (url4, key, multiple) => {
|
|
123755
|
+
const hashIndex = url4.indexOf("#", 8);
|
|
123756
|
+
if (hashIndex !== -1) {
|
|
123757
|
+
url4 = url4.slice(0, hashIndex);
|
|
123758
|
+
}
|
|
123468
123759
|
let encoded;
|
|
123469
123760
|
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
|
|
123470
123761
|
let keyIndex2 = url4.indexOf("?", 8);
|
|
@@ -123537,7 +123828,7 @@ var getQueryParams = (url4, key) => {
|
|
|
123537
123828
|
};
|
|
123538
123829
|
var decodeURIComponent_ = decodeURIComponent;
|
|
123539
123830
|
|
|
123540
|
-
// node_modules/.pnpm/hono@4.13.
|
|
123831
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/request.js
|
|
123541
123832
|
var HonoRequest = class {
|
|
123542
123833
|
/**
|
|
123543
123834
|
* `.raw` can get the raw Request object.
|
|
@@ -123581,13 +123872,13 @@ var HonoRequest = class {
|
|
|
123581
123872
|
return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
|
|
123582
123873
|
}
|
|
123583
123874
|
#getDecodedParam(key) {
|
|
123584
|
-
const paramKey = this.#matchResult[0][this.routeIndex][1][key];
|
|
123875
|
+
const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key];
|
|
123585
123876
|
const param = this.#getParamValue(paramKey);
|
|
123586
123877
|
return param && tryDecodeURIComponent(param);
|
|
123587
123878
|
}
|
|
123588
123879
|
#getAllDecodedParams() {
|
|
123589
123880
|
const decoded = {};
|
|
123590
|
-
const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]);
|
|
123881
|
+
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
123591
123882
|
for (const key of keys) {
|
|
123592
123883
|
const value2 = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
|
|
123593
123884
|
if (value2 !== void 0) {
|
|
@@ -123818,7 +124109,7 @@ var HonoRequest = class {
|
|
|
123818
124109
|
}
|
|
123819
124110
|
};
|
|
123820
124111
|
|
|
123821
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124112
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/html.js
|
|
123822
124113
|
var HtmlEscapedCallbackPhase = {
|
|
123823
124114
|
Stringify: 1,
|
|
123824
124115
|
BeforeStream: 2,
|
|
@@ -123860,7 +124151,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
123860
124151
|
}
|
|
123861
124152
|
};
|
|
123862
124153
|
|
|
123863
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124154
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/context.js
|
|
123864
124155
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
123865
124156
|
var setDefaultContentType = (contentType, headers) => {
|
|
123866
124157
|
return {
|
|
@@ -124062,6 +124353,10 @@ var Context = class {
|
|
|
124062
124353
|
* c.header('X-Message', 'Hello!')
|
|
124063
124354
|
* c.header('Content-Type', 'text/plain')
|
|
124064
124355
|
*
|
|
124356
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
124357
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
124358
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
124359
|
+
*
|
|
124065
124360
|
* return c.body('Thank you for coming')
|
|
124066
124361
|
* })
|
|
124067
124362
|
* ```
|
|
@@ -124282,7 +124577,7 @@ var Context = class {
|
|
|
124282
124577
|
};
|
|
124283
124578
|
};
|
|
124284
124579
|
|
|
124285
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124580
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router.js
|
|
124286
124581
|
var METHOD_NAME_ALL = "ALL";
|
|
124287
124582
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
124288
124583
|
var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
|
|
@@ -124290,10 +124585,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
124290
124585
|
var UnsupportedPathError = class extends Error {
|
|
124291
124586
|
};
|
|
124292
124587
|
|
|
124293
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124588
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/utils/constants.js
|
|
124294
124589
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
124295
124590
|
|
|
124296
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124591
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/hono-base.js
|
|
124297
124592
|
var notFoundHandler = (c) => {
|
|
124298
124593
|
return c.text("404 Not Found", 404);
|
|
124299
124594
|
};
|
|
@@ -124670,7 +124965,10 @@ var Hono = class _Hono {
|
|
|
124670
124965
|
};
|
|
124671
124966
|
};
|
|
124672
124967
|
|
|
124673
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124968
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/utils.js
|
|
124969
|
+
var createNullObject = () => /* @__PURE__ */ Object.create(null);
|
|
124970
|
+
|
|
124971
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
124674
124972
|
var emptyParam = [];
|
|
124675
124973
|
function match(method, path4) {
|
|
124676
124974
|
const matchers2 = this.buildAllMatchers();
|
|
@@ -124691,7 +124989,7 @@ function match(method, path4) {
|
|
|
124691
124989
|
return match22(method, path4);
|
|
124692
124990
|
}
|
|
124693
124991
|
|
|
124694
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124992
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
124695
124993
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
124696
124994
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
124697
124995
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -124720,7 +125018,7 @@ var Node = class _Node {
|
|
|
124720
125018
|
// handler index of a dynamic path, or -1 for a static path terminal
|
|
124721
125019
|
#index;
|
|
124722
125020
|
#varIndex;
|
|
124723
|
-
#children =
|
|
125021
|
+
#children = createNullObject();
|
|
124724
125022
|
insert(tokens, index, paramMap, context, isStatic) {
|
|
124725
125023
|
let node2 = this;
|
|
124726
125024
|
for (let i = 0, len = tokens.length; i < len; i++) {
|
|
@@ -124798,13 +125096,13 @@ var Node = class _Node {
|
|
|
124798
125096
|
}
|
|
124799
125097
|
};
|
|
124800
125098
|
|
|
124801
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125099
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
124802
125100
|
var Trie = class {
|
|
124803
125101
|
#context = { varIndex: 0 };
|
|
124804
125102
|
#root = new Node();
|
|
124805
125103
|
#index = 0;
|
|
124806
125104
|
// dynamic path -> [handler index, param assoc]; static paths are not registered
|
|
124807
|
-
paths =
|
|
125105
|
+
paths = createNullObject();
|
|
124808
125106
|
insert(path4, isStatic) {
|
|
124809
125107
|
if (isStatic) {
|
|
124810
125108
|
this.#root.insert(path4.split(""), 0, [], this.#context, true);
|
|
@@ -124862,23 +125160,17 @@ var Trie = class {
|
|
|
124862
125160
|
}
|
|
124863
125161
|
};
|
|
124864
125162
|
|
|
124865
|
-
// node_modules/.pnpm/hono@4.13.
|
|
124866
|
-
var wildcardRegExpCache =
|
|
125163
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
125164
|
+
var wildcardRegExpCache = createNullObject();
|
|
124867
125165
|
function buildWildcardRegExp(path4) {
|
|
124868
125166
|
return wildcardRegExpCache[path4] ??= new RegExp(
|
|
124869
|
-
|
|
124870
|
-
|
|
124871
|
-
(
|
|
125167
|
+
`^${path4.replace(
|
|
125168
|
+
/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
|
|
125169
|
+
(match22, metaChar) => metaChar ? `\\${metaChar}` : match22 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match22 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`
|
|
124872
125170
|
)}$`
|
|
124873
125171
|
);
|
|
124874
125172
|
}
|
|
124875
|
-
function clearWildcardRegExpCache() {
|
|
124876
|
-
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
124877
|
-
}
|
|
124878
125173
|
function findMiddleware(middleware, path4) {
|
|
124879
|
-
if (!middleware) {
|
|
124880
|
-
return void 0;
|
|
124881
|
-
}
|
|
124882
125174
|
for (const k2 of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
|
|
124883
125175
|
if (buildWildcardRegExp(k2).test(path4)) {
|
|
124884
125176
|
return [...middleware[k2]];
|
|
@@ -124892,8 +125184,8 @@ var RegExpRouter = class {
|
|
|
124892
125184
|
#routes;
|
|
124893
125185
|
#tries;
|
|
124894
125186
|
constructor() {
|
|
124895
|
-
this.#middleware = { [METHOD_NAME_ALL]:
|
|
124896
|
-
this.#routes = { [METHOD_NAME_ALL]:
|
|
125187
|
+
this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
|
|
125188
|
+
this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
|
|
124897
125189
|
this.#tries = { [METHOD_NAME_ALL]: new Trie() };
|
|
124898
125190
|
}
|
|
124899
125191
|
#insertPath(method, path4) {
|
|
@@ -124906,121 +125198,90 @@ var RegExpRouter = class {
|
|
|
124906
125198
|
add(method, path4, handler2) {
|
|
124907
125199
|
const middleware = this.#middleware;
|
|
124908
125200
|
const routes = this.#routes;
|
|
124909
|
-
if (!middleware
|
|
125201
|
+
if (!middleware) {
|
|
124910
125202
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
124911
125203
|
}
|
|
124912
125204
|
if (!middleware[method]) {
|
|
124913
125205
|
this.#tries[method] = new Trie();
|
|
124914
|
-
[middleware, routes]
|
|
124915
|
-
handlerMap[method] =
|
|
124916
|
-
|
|
125206
|
+
for (const handlerMap of [middleware, routes]) {
|
|
125207
|
+
handlerMap[method] = createNullObject();
|
|
125208
|
+
for (const p in handlerMap[METHOD_NAME_ALL]) {
|
|
124917
125209
|
handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]];
|
|
124918
125210
|
this.#insertPath(method, p);
|
|
124919
|
-
}
|
|
124920
|
-
}
|
|
125211
|
+
}
|
|
125212
|
+
}
|
|
124921
125213
|
}
|
|
124922
125214
|
if (path4 === "/*") {
|
|
124923
125215
|
path4 = "*";
|
|
124924
125216
|
}
|
|
124925
|
-
const
|
|
125217
|
+
const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
|
|
124926
125218
|
if (/\*$/.test(path4)) {
|
|
124927
125219
|
const re = buildWildcardRegExp(path4);
|
|
124928
|
-
|
|
124929
|
-
if (
|
|
125220
|
+
for (const m of methods) {
|
|
125221
|
+
if (!middleware[m][path4]) {
|
|
124930
125222
|
this.#insertPath(m, path4);
|
|
124931
125223
|
middleware[m][path4] = findMiddleware(middleware[m], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
|
|
124932
125224
|
}
|
|
124933
|
-
}
|
|
124934
|
-
|
|
124935
|
-
|
|
124936
|
-
|
|
124937
|
-
re.test(p) &&
|
|
124938
|
-
}
|
|
124939
|
-
}
|
|
124940
|
-
});
|
|
124941
|
-
Object.keys(routes).forEach((m) => {
|
|
124942
|
-
if (method === METHOD_NAME_ALL || method === m) {
|
|
124943
|
-
Object.keys(routes[m]).forEach(
|
|
124944
|
-
(p) => re.test(p) && routes[m][p].push([handler2, paramCount])
|
|
124945
|
-
);
|
|
125225
|
+
}
|
|
125226
|
+
for (const handlerMap of [middleware, routes]) {
|
|
125227
|
+
for (const m of methods) {
|
|
125228
|
+
for (const p in handlerMap[m]) {
|
|
125229
|
+
re.test(p) && handlerMap[m][p].push([handler2, path4]);
|
|
125230
|
+
}
|
|
124946
125231
|
}
|
|
124947
|
-
}
|
|
125232
|
+
}
|
|
124948
125233
|
return;
|
|
124949
125234
|
}
|
|
124950
125235
|
const paths = checkOptionalParameter(path4) || [path4];
|
|
124951
|
-
for (
|
|
124952
|
-
const
|
|
124953
|
-
|
|
124954
|
-
|
|
124955
|
-
|
|
124956
|
-
this.#insertPath(m, path22);
|
|
124957
|
-
routes[m][path22] = [
|
|
124958
|
-
...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
|
|
124959
|
-
];
|
|
124960
|
-
}
|
|
124961
|
-
routes[m][path22].push([handler2, paramCount - len + i + 1]);
|
|
125236
|
+
for (const path22 of paths) {
|
|
125237
|
+
for (const m of methods) {
|
|
125238
|
+
if (!routes[m][path22]) {
|
|
125239
|
+
this.#insertPath(m, path22);
|
|
125240
|
+
routes[m][path22] = findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
|
|
124962
125241
|
}
|
|
124963
|
-
|
|
125242
|
+
routes[m][path22].push([handler2, path22]);
|
|
125243
|
+
}
|
|
124964
125244
|
}
|
|
124965
125245
|
}
|
|
124966
125246
|
match = match;
|
|
124967
125247
|
buildAllMatchers() {
|
|
124968
|
-
const matchers2 =
|
|
124969
|
-
Object.keys(this.#routes)
|
|
124970
|
-
matchers2[method]
|
|
124971
|
-
}
|
|
125248
|
+
const matchers2 = createNullObject();
|
|
125249
|
+
for (const method of Object.keys(this.#routes)) {
|
|
125250
|
+
matchers2[method] = this.#buildMatcher(method);
|
|
125251
|
+
}
|
|
124972
125252
|
this.#middleware = this.#routes = this.#tries = void 0;
|
|
124973
|
-
|
|
125253
|
+
wildcardRegExpCache = createNullObject();
|
|
124974
125254
|
return matchers2;
|
|
124975
125255
|
}
|
|
124976
125256
|
#buildMatcher(method) {
|
|
124977
125257
|
const middleware = this.#middleware[method];
|
|
124978
125258
|
const routes = this.#routes[method];
|
|
124979
125259
|
const trie = this.#tries[method];
|
|
124980
|
-
const staticMap =
|
|
125260
|
+
const staticMap = createNullObject();
|
|
124981
125261
|
const handlerData = [];
|
|
124982
|
-
[
|
|
125262
|
+
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
125263
|
+
for (const r of [middleware, routes]) {
|
|
124983
125264
|
for (const path4 in r) {
|
|
124984
125265
|
const handlers2 = r[path4];
|
|
124985
125266
|
const pathData = trie.paths[path4];
|
|
124986
125267
|
if (!pathData) {
|
|
124987
|
-
staticMap[path4] = [handlers2.map(([h]) => [h,
|
|
124988
|
-
continue;
|
|
124989
|
-
}
|
|
124990
|
-
const paramAssoc = pathData[1];
|
|
124991
|
-
handlerData[pathData[0]] = handlers2.map(([h, paramCount]) => {
|
|
124992
|
-
const paramIndexMap = /* @__PURE__ */ Object.create(null);
|
|
124993
|
-
paramCount -= 1;
|
|
124994
|
-
for (; paramCount >= 0; paramCount--) {
|
|
124995
|
-
const [key, value2] = paramAssoc[paramCount];
|
|
124996
|
-
paramIndexMap[key] = value2;
|
|
124997
|
-
}
|
|
124998
|
-
return [h, paramIndexMap];
|
|
124999
|
-
});
|
|
125000
|
-
}
|
|
125001
|
-
});
|
|
125002
|
-
const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
|
|
125003
|
-
for (let i = 0, len = handlerData.length; i < len; i++) {
|
|
125004
|
-
for (let j2 = 0, len2 = handlerData[i].length; j2 < len2; j2++) {
|
|
125005
|
-
const map2 = handlerData[i][j2]?.[1];
|
|
125006
|
-
if (!map2) {
|
|
125268
|
+
staticMap[path4] = [handlers2.map(([h]) => [h, createNullObject()]), emptyParam];
|
|
125007
125269
|
continue;
|
|
125008
125270
|
}
|
|
125009
|
-
|
|
125010
|
-
|
|
125011
|
-
|
|
125012
|
-
|
|
125271
|
+
handlerData[pathData[0]] = handlers2.map(([h, handlerPath]) => [
|
|
125272
|
+
h,
|
|
125273
|
+
trie.paths[handlerPath][1].reduceRight((map2, [key], i) => {
|
|
125274
|
+
map2[key] = paramReplacementMap[pathData[1][i][1]];
|
|
125275
|
+
return map2;
|
|
125276
|
+
}, createNullObject())
|
|
125277
|
+
]);
|
|
125013
125278
|
}
|
|
125014
125279
|
}
|
|
125015
|
-
|
|
125016
|
-
for (const i in indexReplacementMap) {
|
|
125017
|
-
handlerMap[i] = handlerData[indexReplacementMap[i]];
|
|
125018
|
-
}
|
|
125019
|
-
return [regexp, handlerMap, staticMap];
|
|
125280
|
+
return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
|
|
125020
125281
|
}
|
|
125021
125282
|
};
|
|
125022
125283
|
|
|
125023
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125284
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/smart-router/router.js
|
|
125024
125285
|
var SmartRouter = class {
|
|
125025
125286
|
name = "SmartRouter";
|
|
125026
125287
|
#routers = [];
|
|
@@ -125075,78 +125336,53 @@ var SmartRouter = class {
|
|
|
125075
125336
|
}
|
|
125076
125337
|
};
|
|
125077
125338
|
|
|
125078
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125079
|
-
var emptyParams =
|
|
125080
|
-
var
|
|
125081
|
-
for (const _ in children) {
|
|
125082
|
-
return true;
|
|
125083
|
-
}
|
|
125084
|
-
return false;
|
|
125085
|
-
};
|
|
125339
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/trie-router/node.js
|
|
125340
|
+
var emptyParams = createNullObject();
|
|
125341
|
+
var order = 0;
|
|
125086
125342
|
var Node2 = class _Node2 {
|
|
125087
|
-
#methods;
|
|
125088
|
-
#children;
|
|
125089
|
-
#patterns;
|
|
125090
|
-
#
|
|
125343
|
+
#methods = [];
|
|
125344
|
+
#children = createNullObject();
|
|
125345
|
+
#patterns = [];
|
|
125346
|
+
#pattern;
|
|
125091
125347
|
#params = emptyParams;
|
|
125092
|
-
constructor(method, handler2, children) {
|
|
125093
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
125094
|
-
this.#methods = [];
|
|
125095
|
-
if (method && handler2) {
|
|
125096
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
125097
|
-
m[method] = { handler: handler2, possibleKeys: [], score: 0 };
|
|
125098
|
-
this.#methods = [m];
|
|
125099
|
-
}
|
|
125100
|
-
this.#patterns = [];
|
|
125101
|
-
}
|
|
125102
125348
|
insert(method, path4, handler2) {
|
|
125103
|
-
this.#order = ++this.#order;
|
|
125104
125349
|
let curNode = this;
|
|
125105
125350
|
const parts = splitRoutingPath(path4);
|
|
125106
|
-
const possibleKeys =
|
|
125107
|
-
|
|
125108
|
-
|
|
125109
|
-
const nextP = parts[i
|
|
125110
|
-
const pattern = getPattern(p, nextP);
|
|
125111
|
-
const
|
|
125112
|
-
|
|
125113
|
-
|
|
125114
|
-
|
|
125115
|
-
|
|
125116
|
-
|
|
125117
|
-
continue;
|
|
125351
|
+
const possibleKeys = /* @__PURE__ */ new Set();
|
|
125352
|
+
let i = 0;
|
|
125353
|
+
for (const p of parts) {
|
|
125354
|
+
const nextP = parts[++i];
|
|
125355
|
+
const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
125356
|
+
const isParam = Array.isArray(pattern);
|
|
125357
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
125358
|
+
const child = curNode.#children[key] ||= new _Node2();
|
|
125359
|
+
if (pattern && !child.#pattern) {
|
|
125360
|
+
child.#pattern = pattern;
|
|
125361
|
+
curNode.#patterns.push(child);
|
|
125118
125362
|
}
|
|
125119
|
-
curNode
|
|
125120
|
-
if (
|
|
125121
|
-
|
|
125122
|
-
possibleKeys.push(pattern[1]);
|
|
125363
|
+
curNode = child;
|
|
125364
|
+
if (isParam) {
|
|
125365
|
+
possibleKeys.add(pattern[1]);
|
|
125123
125366
|
}
|
|
125124
|
-
curNode = curNode.#children[key];
|
|
125125
125367
|
}
|
|
125126
125368
|
curNode.#methods.push({
|
|
125127
125369
|
[method]: {
|
|
125128
125370
|
handler: handler2,
|
|
125129
|
-
possibleKeys: possibleKeys
|
|
125130
|
-
score:
|
|
125371
|
+
possibleKeys: [...possibleKeys],
|
|
125372
|
+
score: ++order
|
|
125131
125373
|
}
|
|
125132
125374
|
});
|
|
125133
|
-
return curNode;
|
|
125134
125375
|
}
|
|
125135
125376
|
#pushHandlerSets(handlerSets, node2, method, nodeParams, params) {
|
|
125136
125377
|
for (let i = 0, len = node2.#methods.length; i < len; i++) {
|
|
125137
125378
|
const m = node2.#methods[i];
|
|
125138
125379
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
125139
|
-
|
|
125140
|
-
|
|
125141
|
-
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
125380
|
+
if (handlerSet) {
|
|
125381
|
+
handlerSet.params = createNullObject();
|
|
125142
125382
|
handlerSets.push(handlerSet);
|
|
125143
|
-
|
|
125144
|
-
|
|
125145
|
-
|
|
125146
|
-
const processed = processedSet[handlerSet.score];
|
|
125147
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
125148
|
-
processedSet[handlerSet.score] = true;
|
|
125149
|
-
}
|
|
125383
|
+
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
125384
|
+
const key = handlerSet.possibleKeys[i2];
|
|
125385
|
+
handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
125150
125386
|
}
|
|
125151
125387
|
}
|
|
125152
125388
|
}
|
|
@@ -125178,33 +125414,33 @@ var Node2 = class _Node2 {
|
|
|
125178
125414
|
tempNodes.push(nextNode);
|
|
125179
125415
|
}
|
|
125180
125416
|
}
|
|
125181
|
-
for (
|
|
125182
|
-
const pattern =
|
|
125417
|
+
for (const child of node2.#patterns) {
|
|
125418
|
+
const pattern = child.#pattern;
|
|
125183
125419
|
const params = node2.#params === emptyParams ? {} : { ...node2.#params };
|
|
125184
|
-
if (pattern === "
|
|
125185
|
-
|
|
125186
|
-
|
|
125187
|
-
|
|
125188
|
-
|
|
125189
|
-
|
|
125420
|
+
if (typeof pattern === "string") {
|
|
125421
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
125422
|
+
this.#pushHandlerSets(handlerSets, child, method, node2.#params);
|
|
125423
|
+
if (pattern === "*") {
|
|
125424
|
+
child.#params = params;
|
|
125425
|
+
tempNodes.push(child);
|
|
125426
|
+
}
|
|
125190
125427
|
}
|
|
125191
125428
|
continue;
|
|
125192
125429
|
}
|
|
125193
|
-
const [
|
|
125194
|
-
if (!part &&
|
|
125430
|
+
const [, name, matcher] = pattern;
|
|
125431
|
+
if (!part && matcher === true) {
|
|
125195
125432
|
continue;
|
|
125196
125433
|
}
|
|
125197
|
-
|
|
125198
|
-
|
|
125199
|
-
|
|
125200
|
-
partOffsets = new Array(len);
|
|
125434
|
+
if (matcher !== true) {
|
|
125435
|
+
if (!partOffsets) {
|
|
125436
|
+
partOffsets = [];
|
|
125201
125437
|
let offset = path4[0] === "/" ? 1 : 0;
|
|
125202
125438
|
for (let p = 0; p < len; p++) {
|
|
125203
125439
|
partOffsets[p] = offset;
|
|
125204
125440
|
offset += parts[p].length + 1;
|
|
125205
125441
|
}
|
|
125206
125442
|
}
|
|
125207
|
-
const restPathString = path4.
|
|
125443
|
+
const restPathString = path4.slice(partOffsets[i]);
|
|
125208
125444
|
const m = matcher.exec(restPathString);
|
|
125209
125445
|
if (m) {
|
|
125210
125446
|
params[name] = m[0];
|
|
@@ -125218,11 +125454,12 @@ var Node2 = class _Node2 {
|
|
|
125218
125454
|
params
|
|
125219
125455
|
);
|
|
125220
125456
|
}
|
|
125221
|
-
|
|
125457
|
+
for (const _ in child.#children) {
|
|
125222
125458
|
child.#params = params;
|
|
125223
125459
|
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
125224
125460
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
125225
125461
|
targetCurNodes.push(child);
|
|
125462
|
+
break;
|
|
125226
125463
|
}
|
|
125227
125464
|
continue;
|
|
125228
125465
|
}
|
|
@@ -125250,7 +125487,7 @@ var Node2 = class _Node2 {
|
|
|
125250
125487
|
const shifted = curNodesQueue.shift();
|
|
125251
125488
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
125252
125489
|
}
|
|
125253
|
-
if (handlerSets
|
|
125490
|
+
if (handlerSets[1]) {
|
|
125254
125491
|
handlerSets.sort((a, b) => {
|
|
125255
125492
|
return a.score - b.score;
|
|
125256
125493
|
});
|
|
@@ -125259,29 +125496,21 @@ var Node2 = class _Node2 {
|
|
|
125259
125496
|
}
|
|
125260
125497
|
};
|
|
125261
125498
|
|
|
125262
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125499
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/router/trie-router/router.js
|
|
125263
125500
|
var TrieRouter = class {
|
|
125264
125501
|
name = "TrieRouter";
|
|
125265
|
-
#node;
|
|
125266
|
-
constructor() {
|
|
125267
|
-
this.#node = new Node2();
|
|
125268
|
-
}
|
|
125502
|
+
#node = new Node2();
|
|
125269
125503
|
add(method, path4, handler2) {
|
|
125270
|
-
const
|
|
125271
|
-
|
|
125272
|
-
for (let i = 0, len = results.length; i < len; i++) {
|
|
125273
|
-
this.#node.insert(method, results[i], handler2);
|
|
125274
|
-
}
|
|
125275
|
-
return;
|
|
125504
|
+
for (const result of checkOptionalParameter(path4) || [path4]) {
|
|
125505
|
+
this.#node.insert(method, result, handler2);
|
|
125276
125506
|
}
|
|
125277
|
-
this.#node.insert(method, path4, handler2);
|
|
125278
125507
|
}
|
|
125279
125508
|
match(method, path4) {
|
|
125280
125509
|
return this.#node.search(method, path4);
|
|
125281
125510
|
}
|
|
125282
125511
|
};
|
|
125283
125512
|
|
|
125284
|
-
// node_modules/.pnpm/hono@4.13.
|
|
125513
|
+
// node_modules/.pnpm/hono@4.13.5/node_modules/hono/dist/hono.js
|
|
125285
125514
|
var Hono2 = class extends Hono {
|
|
125286
125515
|
/**
|
|
125287
125516
|
* Creates an instance of the Hono class.
|
|
@@ -125296,7 +125525,7 @@ var Hono2 = class extends Hono {
|
|
|
125296
125525
|
}
|
|
125297
125526
|
};
|
|
125298
125527
|
|
|
125299
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
125528
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
125300
125529
|
import { createRequire } from "node:module";
|
|
125301
125530
|
import { randomUUID as randomUUID2, timingSafeEqual } from "node:crypto";
|
|
125302
125531
|
|
|
@@ -132552,11 +132781,11 @@ var require_dataType2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
132552
132781
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
132553
132782
|
}
|
|
132554
132783
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
132555
|
-
const
|
|
132784
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
132556
132785
|
let cond;
|
|
132557
132786
|
switch (dataType) {
|
|
132558
132787
|
case "null":
|
|
132559
|
-
return (0, codegen_1._)`${data} ${
|
|
132788
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
132560
132789
|
case "array":
|
|
132561
132790
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
132562
132791
|
break;
|
|
@@ -132570,7 +132799,7 @@ var require_dataType2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
132570
132799
|
cond = numCond();
|
|
132571
132800
|
break;
|
|
132572
132801
|
default:
|
|
132573
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
132802
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
132574
132803
|
}
|
|
132575
132804
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
132576
132805
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -140895,7 +141124,7 @@ function createMcpHandler(factory, options = {}) {
|
|
|
140895
141124
|
};
|
|
140896
141125
|
}
|
|
140897
141126
|
|
|
140898
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
141127
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
140899
141128
|
import http from "http";
|
|
140900
141129
|
import { Http2ServerRequest } from "http2";
|
|
140901
141130
|
import { Readable } from "stream";
|
|
@@ -146603,11 +146832,11 @@ var require_dataType3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
146603
146832
|
gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
|
|
146604
146833
|
}
|
|
146605
146834
|
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
146606
|
-
const
|
|
146835
|
+
const EQ2 = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
|
146607
146836
|
let cond;
|
|
146608
146837
|
switch (dataType) {
|
|
146609
146838
|
case "null":
|
|
146610
|
-
return (0, codegen_1._)`${data} ${
|
|
146839
|
+
return (0, codegen_1._)`${data} ${EQ2} null`;
|
|
146611
146840
|
case "array":
|
|
146612
146841
|
cond = (0, codegen_1._)`Array.isArray(${data})`;
|
|
146613
146842
|
break;
|
|
@@ -146621,7 +146850,7 @@ var require_dataType3 = /* @__PURE__ */ __commonJSMin2(((exports) => {
|
|
|
146621
146850
|
cond = numCond();
|
|
146622
146851
|
break;
|
|
146623
146852
|
default:
|
|
146624
|
-
return (0, codegen_1._)`typeof ${data} ${
|
|
146853
|
+
return (0, codegen_1._)`typeof ${data} ${EQ2} ${dataType}`;
|
|
146625
146854
|
}
|
|
146626
146855
|
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
|
146627
146856
|
function numCond(_cond = codegen_1.nil) {
|
|
@@ -152300,7 +152529,7 @@ var SseError = class extends Error {
|
|
|
152300
152529
|
}
|
|
152301
152530
|
};
|
|
152302
152531
|
|
|
152303
|
-
// node_modules/.pnpm/mcp-proxy@6.7.
|
|
152532
|
+
// node_modules/.pnpm/mcp-proxy@6.7.11/node_modules/mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs
|
|
152304
152533
|
var __create4 = Object.create;
|
|
152305
152534
|
var __defProp$1 = Object.defineProperty;
|
|
152306
152535
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -152408,6 +152637,12 @@ var InMemoryEventStore = class {
|
|
|
152408
152637
|
get size() {
|
|
152409
152638
|
return this.events.size;
|
|
152410
152639
|
}
|
|
152640
|
+
/**
|
|
152641
|
+
* Keeps event IDs in stream-local insertion order so replay can walk only the
|
|
152642
|
+
* relevant stream instead of sorting the entire global event map on every
|
|
152643
|
+
* reconnect.
|
|
152644
|
+
*/
|
|
152645
|
+
eventIdsByStream = /* @__PURE__ */ new Map();
|
|
152411
152646
|
events = /* @__PURE__ */ new Map();
|
|
152412
152647
|
lastTimestamp = 0;
|
|
152413
152648
|
lastTimestampCounter = 0;
|
|
@@ -152431,15 +152666,15 @@ var InMemoryEventStore = class {
|
|
|
152431
152666
|
if (!lastEventId) return "";
|
|
152432
152667
|
const streamId = await this.getStreamIdForEventId(lastEventId);
|
|
152433
152668
|
if (!streamId) return "";
|
|
152434
|
-
|
|
152435
|
-
|
|
152436
|
-
|
|
152437
|
-
|
|
152438
|
-
|
|
152439
|
-
|
|
152440
|
-
|
|
152441
|
-
|
|
152442
|
-
|
|
152669
|
+
const eventIdsForStream = this.eventIdsByStream.get(streamId);
|
|
152670
|
+
if (!eventIdsForStream) return "";
|
|
152671
|
+
const lastEventIndex = eventIdsForStream.indexOf(lastEventId);
|
|
152672
|
+
if (lastEventIndex === -1) return "";
|
|
152673
|
+
for (let index = lastEventIndex + 1; index < eventIdsForStream.length; index++) {
|
|
152674
|
+
const eventId = eventIdsForStream[index];
|
|
152675
|
+
const storedEvent = this.events.get(eventId);
|
|
152676
|
+
if (!storedEvent) continue;
|
|
152677
|
+
await send(eventId, storedEvent.message);
|
|
152443
152678
|
}
|
|
152444
152679
|
return streamId;
|
|
152445
152680
|
}
|
|
@@ -152453,10 +152688,22 @@ var InMemoryEventStore = class {
|
|
|
152453
152688
|
message,
|
|
152454
152689
|
streamId
|
|
152455
152690
|
});
|
|
152691
|
+
const streamEvents = this.eventIdsByStream.get(streamId) ?? [];
|
|
152692
|
+
streamEvents.push(eventId);
|
|
152693
|
+
this.eventIdsByStream.set(streamId, streamEvents);
|
|
152456
152694
|
while (this.events.size > this.maxEvents) {
|
|
152457
152695
|
const oldestEventId = this.events.keys().next().value;
|
|
152458
152696
|
if (oldestEventId === void 0) break;
|
|
152697
|
+
const oldestEvent = this.events.get(oldestEventId);
|
|
152459
152698
|
this.events.delete(oldestEventId);
|
|
152699
|
+
if (oldestEvent) {
|
|
152700
|
+
const streamEventIds = this.eventIdsByStream.get(oldestEvent.streamId);
|
|
152701
|
+
if (streamEventIds) {
|
|
152702
|
+
const index = streamEventIds.indexOf(oldestEventId);
|
|
152703
|
+
if (index !== -1) streamEventIds.splice(index, 1);
|
|
152704
|
+
if (streamEventIds.length === 0) this.eventIdsByStream.delete(oldestEvent.streamId);
|
|
152705
|
+
}
|
|
152706
|
+
}
|
|
152460
152707
|
}
|
|
152461
152708
|
return eventId;
|
|
152462
152709
|
}
|
|
@@ -169021,6 +169268,34 @@ data: ${JSON.stringify(message)}
|
|
|
169021
169268
|
}
|
|
169022
169269
|
};
|
|
169023
169270
|
var DEFAULT_KEEP_ALIVE_TIMEOUT = 3e5;
|
|
169271
|
+
var addUtf8Charset = (contentType$1) => {
|
|
169272
|
+
if (/;\s*charset=/i.test(contentType$1) || !/^(application\/json|text\/event-stream)(?:\s*;|$)/i.test(contentType$1)) return contentType$1;
|
|
169273
|
+
return `${contentType$1}; charset=utf-8`;
|
|
169274
|
+
};
|
|
169275
|
+
var normalizeResponseHeaders = (headers) => {
|
|
169276
|
+
if (Array.isArray(headers)) return headers.map((value2, index) => {
|
|
169277
|
+
const headerName = headers[index - 1];
|
|
169278
|
+
if (index % 2 === 1 && typeof headerName === "string" && headerName.toLowerCase() === "content-type" && typeof value2 === "string") return addUtf8Charset(value2);
|
|
169279
|
+
return value2;
|
|
169280
|
+
});
|
|
169281
|
+
const normalizedHeaders = { ...headers };
|
|
169282
|
+
for (const [name, value2] of Object.entries(headers)) if (name.toLowerCase() === "content-type" && typeof value2 === "string") normalizedHeaders[name] = addUtf8Charset(value2);
|
|
169283
|
+
return normalizedHeaders;
|
|
169284
|
+
};
|
|
169285
|
+
var ensureUtf8ResponseCharset = (res) => {
|
|
169286
|
+
const originalWriteHead = res.writeHead.bind(res);
|
|
169287
|
+
res.writeHead = ((statusCode, statusMessageOrHeaders, headers) => {
|
|
169288
|
+
const currentContentType = res.getHeader("Content-Type");
|
|
169289
|
+
if (typeof currentContentType === "string") res.setHeader("Content-Type", addUtf8Charset(currentContentType));
|
|
169290
|
+
const responseHeaders = typeof statusMessageOrHeaders === "string" ? headers : statusMessageOrHeaders;
|
|
169291
|
+
if (responseHeaders) {
|
|
169292
|
+
const normalizedHeaders = normalizeResponseHeaders(responseHeaders);
|
|
169293
|
+
if (typeof statusMessageOrHeaders === "string") return originalWriteHead(statusCode, statusMessageOrHeaders, normalizedHeaders);
|
|
169294
|
+
return originalWriteHead(statusCode, normalizedHeaders);
|
|
169295
|
+
}
|
|
169296
|
+
return originalWriteHead(statusCode, statusMessageOrHeaders, headers);
|
|
169297
|
+
});
|
|
169298
|
+
};
|
|
169024
169299
|
var DEFAULT_SESSION_IDLE_TIMEOUT = 18e5;
|
|
169025
169300
|
var SESSION_SWEEP_INTERVAL = 6e4;
|
|
169026
169301
|
var FORCE_CLOSE_GRACE_PERIOD = 1e3;
|
|
@@ -169068,6 +169343,7 @@ var getBody = (request2, maxBodySize = DEFAULT_MAX_BODY_SIZE) => {
|
|
|
169068
169343
|
if (maxBodySize !== false) {
|
|
169069
169344
|
size += chunk.length;
|
|
169070
169345
|
if (size > maxBodySize) {
|
|
169346
|
+
request2.pause();
|
|
169071
169347
|
resolve3({
|
|
169072
169348
|
limit: maxBodySize,
|
|
169073
169349
|
tooLarge: true
|
|
@@ -169173,6 +169449,10 @@ var isScopeChallengeError = (error52) => {
|
|
|
169173
169449
|
var handleResponseError = async (error52, res) => {
|
|
169174
169450
|
if (error52 && typeof error52 === "object" && "status" in error52 && "headers" in error52 && "statusText" in error52 || error52 instanceof Response) {
|
|
169175
169451
|
const responseError = error52;
|
|
169452
|
+
if (res.headersSent) {
|
|
169453
|
+
res.end();
|
|
169454
|
+
return true;
|
|
169455
|
+
}
|
|
169176
169456
|
const fixedHeaders = {};
|
|
169177
169457
|
responseError.headers.forEach((value2, key$1) => {
|
|
169178
169458
|
if (fixedHeaders[key$1]) if (Array.isArray(fixedHeaders[key$1])) fixedHeaders[key$1].push(value2);
|
|
@@ -169248,8 +169528,9 @@ var applyCorsHeaders = (req, res, corsOptions) => {
|
|
|
169248
169528
|
else if (Array.isArray(finalCorsOptions.origin)) allowedOrigin = finalCorsOptions.origin.includes(origin.origin) ? origin.origin : "false";
|
|
169249
169529
|
else if (typeof finalCorsOptions.origin === "function") allowedOrigin = finalCorsOptions.origin(origin.origin) ? origin.origin : "false";
|
|
169250
169530
|
}
|
|
169531
|
+
res.setHeader("Vary", "Origin");
|
|
169251
169532
|
if (allowedOrigin !== "false") res.setHeader("Access-Control-Allow-Origin", allowedOrigin);
|
|
169252
|
-
if (finalCorsOptions.credentials !== void 0) res.setHeader("Access-Control-Allow-Credentials", finalCorsOptions.credentials.toString());
|
|
169533
|
+
if (finalCorsOptions.credentials !== void 0 && allowedOrigin !== "*") res.setHeader("Access-Control-Allow-Credentials", finalCorsOptions.credentials.toString());
|
|
169253
169534
|
if (finalCorsOptions.methods) res.setHeader("Access-Control-Allow-Methods", finalCorsOptions.methods.join(", "));
|
|
169254
169535
|
if (finalCorsOptions.allowedHeaders) {
|
|
169255
169536
|
const allowedHeaders = typeof finalCorsOptions.allowedHeaders === "string" ? finalCorsOptions.allowedHeaders : finalCorsOptions.allowedHeaders.join(", ");
|
|
@@ -169483,8 +169764,16 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
169483
169764
|
});
|
|
169484
169765
|
return true;
|
|
169485
169766
|
}
|
|
169486
|
-
|
|
169487
|
-
|
|
169767
|
+
try {
|
|
169768
|
+
await server.connect(transport);
|
|
169769
|
+
if (onConnect) await onConnect(server);
|
|
169770
|
+
} catch (error52) {
|
|
169771
|
+
if (!isCleaningUp) {
|
|
169772
|
+
isCleaningUp = true;
|
|
169773
|
+
await cleanupServer(server, onClose);
|
|
169774
|
+
}
|
|
169775
|
+
throw error52;
|
|
169776
|
+
}
|
|
169488
169777
|
await transport.handleRequest(req, res, body);
|
|
169489
169778
|
return true;
|
|
169490
169779
|
} else if (stateless && !sessionId && !isInitializeRequest(body)) {
|
|
@@ -169506,8 +169795,13 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
169506
169795
|
});
|
|
169507
169796
|
return true;
|
|
169508
169797
|
}
|
|
169509
|
-
|
|
169510
|
-
|
|
169798
|
+
try {
|
|
169799
|
+
await server.connect(transport);
|
|
169800
|
+
if (onConnect) await onConnect(server);
|
|
169801
|
+
} catch (error52) {
|
|
169802
|
+
await cleanupServer(server, onClose);
|
|
169803
|
+
throw error52;
|
|
169804
|
+
}
|
|
169511
169805
|
await transport.handleRequest(req, res, body);
|
|
169512
169806
|
return true;
|
|
169513
169807
|
} else {
|
|
@@ -169526,6 +169820,11 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
169526
169820
|
await transport.handleRequest(req, res, body);
|
|
169527
169821
|
return true;
|
|
169528
169822
|
} catch (error52) {
|
|
169823
|
+
if (res.headersSent) {
|
|
169824
|
+
console.error("[mcp-proxy] error handling request after headers sent", error52);
|
|
169825
|
+
res.end();
|
|
169826
|
+
return true;
|
|
169827
|
+
}
|
|
169529
169828
|
if (isScopeChallengeError(error52)) {
|
|
169530
169829
|
const response = authMiddleware.getScopeChallengeResponse(error52.data.requiredScopes, error52.data.errorDescription, body?.id);
|
|
169531
169830
|
res.writeHead(response.statusCode, response.headers);
|
|
@@ -169571,7 +169870,13 @@ var handleStreamRequest = async ({ activeTransports, authenticate, authMiddlewar
|
|
|
169571
169870
|
if (lastEventId) console.log(`[mcp-proxy] client reconnecting with Last-Event-ID ${lastEventId} for session ID ${sessionId}`);
|
|
169572
169871
|
else console.log(`[mcp-proxy] establishing new SSE stream for session ID ${sessionId}`);
|
|
169573
169872
|
trackSessionStream(activeTransport, res);
|
|
169574
|
-
|
|
169873
|
+
try {
|
|
169874
|
+
await activeTransport.transport.handleRequest(req, res);
|
|
169875
|
+
} catch (error52) {
|
|
169876
|
+
console.error("[mcp-proxy] error handling stream request", error52);
|
|
169877
|
+
if (res.headersSent) res.end();
|
|
169878
|
+
else res.writeHead(500).end("Error handling request");
|
|
169879
|
+
}
|
|
169575
169880
|
return true;
|
|
169576
169881
|
}
|
|
169577
169882
|
if (req.method === "DELETE" && new URL(req.url, "http://localhost").pathname === endpoint2) {
|
|
@@ -169681,6 +169986,7 @@ var startHTTPServer = async ({ apiKey, authenticate, cors, createServer: createS
|
|
|
169681
169986
|
onListenSubscriptions
|
|
169682
169987
|
}) : void 0;
|
|
169683
169988
|
const requestListener = async (req, res) => {
|
|
169989
|
+
ensureUtf8ResponseCharset(res);
|
|
169684
169990
|
applyCorsHeaders(req, res, cors);
|
|
169685
169991
|
if (req.method === "OPTIONS") {
|
|
169686
169992
|
res.writeHead(204);
|
|
@@ -182053,10 +182359,111 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
182053
182359
|
}
|
|
182054
182360
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
182055
182361
|
|
|
182056
|
-
// node_modules/.pnpm
|
|
182057
|
-
var
|
|
182362
|
+
// node_modules/.pnpm/content-type@3.0.0/node_modules/content-type/dist/index.js
|
|
182363
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
182364
|
+
const C = function() {
|
|
182365
|
+
};
|
|
182366
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
182367
|
+
return C;
|
|
182368
|
+
})();
|
|
182369
|
+
function parse5(header, options) {
|
|
182370
|
+
const stopChar = options?.comma === true ? COMMA : 65536;
|
|
182371
|
+
const len = header.length;
|
|
182372
|
+
let index = skipOWS(header, options?.start ?? 0, len);
|
|
182373
|
+
const valueStart = index;
|
|
182374
|
+
index = skipValue(header, index, len, stopChar);
|
|
182375
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
182376
|
+
const type2 = header.slice(valueStart, valueEnd).toLowerCase();
|
|
182377
|
+
if (options?.parameters === false) {
|
|
182378
|
+
return { type: type2, index, parameters: new NullObject() };
|
|
182379
|
+
}
|
|
182380
|
+
return parseParameters(header, type2, index, len, stopChar);
|
|
182381
|
+
}
|
|
182382
|
+
var SP = 32;
|
|
182383
|
+
var HTAB = 9;
|
|
182384
|
+
var SEMI = 59;
|
|
182385
|
+
var EQ = 61;
|
|
182386
|
+
var DQUOTE = 34;
|
|
182387
|
+
var BSLASH = 92;
|
|
182388
|
+
var COMMA = 44;
|
|
182389
|
+
function parseParameters(header, type2, index, len, stopChar) {
|
|
182390
|
+
const parameters = new NullObject();
|
|
182391
|
+
parameter: while (index < len) {
|
|
182392
|
+
if (header.charCodeAt(index) === stopChar)
|
|
182393
|
+
break;
|
|
182394
|
+
index = skipOWS(header, index + 1, len);
|
|
182395
|
+
const keyStart = index;
|
|
182396
|
+
while (index < len) {
|
|
182397
|
+
const code = header.charCodeAt(index);
|
|
182398
|
+
if (code === stopChar)
|
|
182399
|
+
break parameter;
|
|
182400
|
+
if (code === SEMI)
|
|
182401
|
+
continue parameter;
|
|
182402
|
+
if (code === EQ) {
|
|
182403
|
+
const keyEnd = trailingOWS(header, keyStart, index);
|
|
182404
|
+
const key = header.slice(keyStart, keyEnd).toLowerCase();
|
|
182405
|
+
index = skipOWS(header, index + 1, len);
|
|
182406
|
+
if (index < len && header.charCodeAt(index) === DQUOTE) {
|
|
182407
|
+
index++;
|
|
182408
|
+
let value2 = "";
|
|
182409
|
+
while (index < len) {
|
|
182410
|
+
const code2 = header.charCodeAt(index++);
|
|
182411
|
+
if (code2 === DQUOTE) {
|
|
182412
|
+
index = skipValue(header, index, len, stopChar);
|
|
182413
|
+
if (parameters[key] === void 0)
|
|
182414
|
+
parameters[key] = value2;
|
|
182415
|
+
break;
|
|
182416
|
+
}
|
|
182417
|
+
if (code2 === BSLASH && index < len) {
|
|
182418
|
+
value2 += header[index++];
|
|
182419
|
+
continue;
|
|
182420
|
+
}
|
|
182421
|
+
value2 += String.fromCharCode(code2);
|
|
182422
|
+
}
|
|
182423
|
+
continue parameter;
|
|
182424
|
+
}
|
|
182425
|
+
const valueStart = index;
|
|
182426
|
+
index = skipValue(header, index, len, stopChar);
|
|
182427
|
+
if (parameters[key] === void 0) {
|
|
182428
|
+
const valueEnd = trailingOWS(header, valueStart, index);
|
|
182429
|
+
parameters[key] = header.slice(valueStart, valueEnd);
|
|
182430
|
+
}
|
|
182431
|
+
continue parameter;
|
|
182432
|
+
}
|
|
182433
|
+
index++;
|
|
182434
|
+
}
|
|
182435
|
+
}
|
|
182436
|
+
return { type: type2, index, parameters };
|
|
182437
|
+
}
|
|
182438
|
+
function skipValue(str, index, len, stopChar) {
|
|
182439
|
+
while (index < len) {
|
|
182440
|
+
const code = str.charCodeAt(index);
|
|
182441
|
+
if (code === SEMI || code === stopChar)
|
|
182442
|
+
break;
|
|
182443
|
+
index++;
|
|
182444
|
+
}
|
|
182445
|
+
return index;
|
|
182446
|
+
}
|
|
182447
|
+
function skipOWS(header, index, len) {
|
|
182448
|
+
while (index < len) {
|
|
182449
|
+
const char = header.charCodeAt(index);
|
|
182450
|
+
if (char !== SP && char !== HTAB)
|
|
182451
|
+
break;
|
|
182452
|
+
index++;
|
|
182453
|
+
}
|
|
182454
|
+
return index;
|
|
182455
|
+
}
|
|
182456
|
+
function trailingOWS(header, start, end) {
|
|
182457
|
+
while (end > start) {
|
|
182458
|
+
const char = header.charCodeAt(end - 1);
|
|
182459
|
+
if (char !== SP && char !== HTAB)
|
|
182460
|
+
break;
|
|
182461
|
+
end--;
|
|
182462
|
+
}
|
|
182463
|
+
return end;
|
|
182464
|
+
}
|
|
182058
182465
|
|
|
182059
|
-
// node_modules/.pnpm/json-with-bigint@3.5.
|
|
182466
|
+
// node_modules/.pnpm/json-with-bigint@3.5.12/node_modules/json-with-bigint/json-with-bigint.js
|
|
182060
182467
|
var intRegex = /^-?\d+$/;
|
|
182061
182468
|
var noiseValue = /^-?\d+n+$/;
|
|
182062
182469
|
var originalStringify = JSON.stringify;
|
|
@@ -182313,7 +182720,7 @@ var JSONParseV2 = (text, reviver) => {
|
|
|
182313
182720
|
};
|
|
182314
182721
|
var MAX_INT = Number.MAX_SAFE_INTEGER.toString();
|
|
182315
182722
|
var MAX_DIGITS = MAX_INT.length;
|
|
182316
|
-
var stringsOrLargeNumbers = /"(
|
|
182723
|
+
var stringsOrLargeNumbers = /"(?:[^"\\]|\\.)*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g;
|
|
182317
182724
|
var noiseValueWithQuotes = /^"-?\d+n+"$/;
|
|
182318
182725
|
var applyReviverIteratively = (parsed2, userReviver) => {
|
|
182319
182726
|
const rootHolder = { "": parsed2 };
|
|
@@ -182430,8 +182837,8 @@ var RequestError2 = class extends Error {
|
|
|
182430
182837
|
}
|
|
182431
182838
|
};
|
|
182432
182839
|
|
|
182433
|
-
// node_modules/.pnpm/@octokit+request@10.0.
|
|
182434
|
-
var VERSION3 = "10.0.
|
|
182840
|
+
// node_modules/.pnpm/@octokit+request@10.0.15/node_modules/@octokit/request/dist-bundle/index.js
|
|
182841
|
+
var VERSION3 = "10.0.15";
|
|
182435
182842
|
var defaults_default = {
|
|
182436
182843
|
headers: {
|
|
182437
182844
|
"user-agent": `octokit-request.js/${VERSION3} ${getUserAgent2()}`
|
|
@@ -182549,7 +182956,7 @@ async function getResponseData(response) {
|
|
|
182549
182956
|
if (!contentType) {
|
|
182550
182957
|
return response.text().catch(noop2);
|
|
182551
182958
|
}
|
|
182552
|
-
const mimetype = (
|
|
182959
|
+
const mimetype = parse5(contentType);
|
|
182553
182960
|
if (isJSONResponse(mimetype)) {
|
|
182554
182961
|
let text = "";
|
|
182555
182962
|
try {
|
|
@@ -185921,7 +186328,7 @@ function resolveRepoCtx(ctx, repo) {
|
|
|
185921
186328
|
// node_modules/.pnpm/@toon-format+toon@1.4.0/node_modules/@toon-format/toon/dist/index.mjs
|
|
185922
186329
|
var LIST_ITEM_MARKER = "-";
|
|
185923
186330
|
var LIST_ITEM_PREFIX = "- ";
|
|
185924
|
-
var
|
|
186331
|
+
var COMMA2 = ",";
|
|
185925
186332
|
var PIPE = "|";
|
|
185926
186333
|
var DOT = ".";
|
|
185927
186334
|
var NULL_LITERAL = "null";
|
|
@@ -185931,7 +186338,7 @@ var BACKSLASH = "\\";
|
|
|
185931
186338
|
var DOUBLE_QUOTE = '"';
|
|
185932
186339
|
var TAB = " ";
|
|
185933
186340
|
var DELIMITERS = {
|
|
185934
|
-
comma:
|
|
186341
|
+
comma: COMMA2,
|
|
185935
186342
|
tab: TAB,
|
|
185936
186343
|
pipe: PIPE
|
|
185937
186344
|
};
|
|
@@ -186076,7 +186483,7 @@ function encodeAndJoinPrimitives(values, delimiter2 = DEFAULT_DELIMITER) {
|
|
|
186076
186483
|
function formatHeader(length, options) {
|
|
186077
186484
|
const key = options?.key;
|
|
186078
186485
|
const fields = options?.fields;
|
|
186079
|
-
const delimiter2 = options?.delimiter ??
|
|
186486
|
+
const delimiter2 = options?.delimiter ?? COMMA2;
|
|
186080
186487
|
let header = "";
|
|
186081
186488
|
if (key) header += encodeKey(key);
|
|
186082
186489
|
header += `[${length}${delimiter2 !== DEFAULT_DELIMITER ? delimiter2 : ""}]`;
|
|
@@ -192500,116 +192907,16 @@ function subagentDeniedToolNames(ctx, outputSchema) {
|
|
|
192500
192907
|
return names;
|
|
192501
192908
|
}
|
|
192502
192909
|
|
|
192503
|
-
// utils/agent.ts
|
|
192504
|
-
function hasEnvVar2(name) {
|
|
192505
|
-
const val = process.env[name];
|
|
192506
|
-
return typeof val === "string" && val.length > 0;
|
|
192507
|
-
}
|
|
192508
|
-
function hasClaudeCodeAuth() {
|
|
192509
|
-
return hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN") || hasEnvVar2("ANTHROPIC_API_KEY") || hasEnvVar2("ANTHROPIC_AUTH_TOKEN");
|
|
192510
|
-
}
|
|
192511
|
-
function hasCodexAuth() {
|
|
192512
|
-
return hasEnvVar2("CODEX_AUTH_JSON") || hasEnvVar2("OPENAI_API_KEY");
|
|
192513
|
-
}
|
|
192514
|
-
function hasBedrockAuth() {
|
|
192515
|
-
return hasEnvVar2("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar2("AWS_ACCESS_KEY_ID") && hasEnvVar2("AWS_SECRET_ACCESS_KEY");
|
|
192516
|
-
}
|
|
192517
|
-
function hasVertexAuth() {
|
|
192518
|
-
return hasEnvVar2(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
192519
|
-
}
|
|
192520
|
-
function resolveSlug(slug2) {
|
|
192521
|
-
const alias = resolveDisplayAlias(slug2);
|
|
192522
|
-
if (alias?.routing === "bedrock") {
|
|
192523
|
-
const bedrockId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
192524
|
-
if (!bedrockId) {
|
|
192525
|
-
throw new Error(
|
|
192526
|
-
`${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.`
|
|
192527
|
-
);
|
|
192528
|
-
}
|
|
192529
|
-
return bedrockId;
|
|
192530
|
-
}
|
|
192531
|
-
if (alias?.routing === "vertex") {
|
|
192532
|
-
const vertexId = process.env[VERTEX_MODEL_ID_ENV]?.trim();
|
|
192533
|
-
if (!vertexId) {
|
|
192534
|
-
throw new Error(
|
|
192535
|
-
`${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.`
|
|
192536
|
-
);
|
|
192537
|
-
}
|
|
192538
|
-
return vertexId;
|
|
192539
|
-
}
|
|
192540
|
-
if (alias?.routing === "azure") {
|
|
192541
|
-
const deployment = process.env[AZURE_DEPLOYMENT_ENV]?.trim();
|
|
192542
|
-
if (!deployment) {
|
|
192543
|
-
throw new Error(
|
|
192544
|
-
`${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.`
|
|
192545
|
-
);
|
|
192546
|
-
}
|
|
192547
|
-
return `${AZURE_PROVIDER}/${deployment}`;
|
|
192548
|
-
}
|
|
192549
|
-
if (alias?.routing === "openai-compatible") {
|
|
192550
|
-
const modelId = process.env[OPENAI_COMPATIBLE_MODEL_ENV]?.trim();
|
|
192551
|
-
if (!modelId) {
|
|
192552
|
-
throw new Error(
|
|
192553
|
-
`${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.`
|
|
192554
|
-
);
|
|
192555
|
-
}
|
|
192556
|
-
return `${OPENAI_COMPATIBLE_PROVIDER}/${modelId}`;
|
|
192557
|
-
}
|
|
192558
|
-
return resolveCliModel(slug2);
|
|
192559
|
-
}
|
|
192560
|
-
function resolveModel(ctx) {
|
|
192561
|
-
const envModel = process.env.PULLFROG_MODEL?.trim();
|
|
192562
|
-
if (envModel) {
|
|
192563
|
-
return resolveSlug(envModel) ?? envModel;
|
|
192564
|
-
}
|
|
192565
|
-
const slug2 = ctx.slug?.trim();
|
|
192566
|
-
if (slug2) {
|
|
192567
|
-
const resolved = resolveSlug(slug2);
|
|
192568
|
-
if (resolved) {
|
|
192569
|
-
return resolved;
|
|
192570
|
-
}
|
|
192571
|
-
if (slug2.includes("/")) {
|
|
192572
|
-
log.info(`\xBB "${slug2}" is not a curated alias \u2014 passing through as a raw model specifier`);
|
|
192573
|
-
return slug2;
|
|
192574
|
-
}
|
|
192575
|
-
log.warning(`\xBB unknown model slug "${slug2}" \u2014 agent will auto-select`);
|
|
192576
|
-
}
|
|
192577
|
-
return void 0;
|
|
192578
|
-
}
|
|
192579
|
-
function resolveAgent(ctx) {
|
|
192580
|
-
const envAgent = process.env.PULLFROG_AGENT?.trim();
|
|
192581
|
-
if (envAgent) {
|
|
192582
|
-
if (envAgent in agents) {
|
|
192583
|
-
return agents[envAgent];
|
|
192584
|
-
}
|
|
192585
|
-
log.warning(`\xBB unknown PULLFROG_AGENT="${envAgent}" \u2014 falling through to auto-select`);
|
|
192586
|
-
}
|
|
192587
|
-
if (ctx.proxyModel) return agents.opencode;
|
|
192588
|
-
if (ctx.model && hasBedrockAuth() && process.env[BEDROCK_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
192589
|
-
return isBedrockAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
192590
|
-
}
|
|
192591
|
-
if (ctx.model && hasVertexAuth() && process.env[VERTEX_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
192592
|
-
return isVertexAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
192593
|
-
}
|
|
192594
|
-
if (ctx.model) {
|
|
192595
|
-
try {
|
|
192596
|
-
const provider2 = getModelProvider(ctx.model);
|
|
192597
|
-
if (provider2 === "anthropic" && hasClaudeCodeAuth()) return agents.claude;
|
|
192598
|
-
if (provider2 === "openai" && ctx.codexAgent && hasCodexAuth()) return agents.codex;
|
|
192599
|
-
} catch {
|
|
192600
|
-
}
|
|
192601
|
-
}
|
|
192602
|
-
if (!ctx.model) {
|
|
192603
|
-
if (hasEnvVar2("ANTHROPIC_AUTH_TOKEN") && !hasEnvVar2("ANTHROPIC_API_KEY") && !hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN")) {
|
|
192604
|
-
return agents.claude;
|
|
192605
|
-
}
|
|
192606
|
-
if (ctx.codexAgent && hasCodexAuth() && !hasClaudeCodeAuth()) return agents.codex;
|
|
192607
|
-
}
|
|
192608
|
-
return agents.opencode;
|
|
192609
|
-
}
|
|
192610
|
-
|
|
192611
192910
|
// utils/apiKeys.ts
|
|
192612
192911
|
var MISSING_KEY_MARKER = "no API key found";
|
|
192912
|
+
var BYOK_SLUG_MARKER = "env var is required when the model is set to";
|
|
192913
|
+
var BYOK_CONFIG_MARKER = "selected but required configuration is missing:";
|
|
192914
|
+
var BYOK_SETUP_PATTERN = new RegExp(
|
|
192915
|
+
`^(?:[A-Z][A-Z0-9_]+ ${BYOK_SLUG_MARKER}|[A-Z][\\w-]*(?: [\\w-]+){0,3} ${BYOK_CONFIG_MARKER})`
|
|
192916
|
+
);
|
|
192917
|
+
function isByokSetupError(text) {
|
|
192918
|
+
return BYOK_SETUP_PATTERN.test(text);
|
|
192919
|
+
}
|
|
192613
192920
|
var SECRETS_UNAVAILABLE_MARKER = "couldn't load your Pullfrog secrets";
|
|
192614
192921
|
var ROUTER_UNFUNDED_MARKER = "your Pullfrog Router balance is empty";
|
|
192615
192922
|
var CREDENTIAL_REJECTED_MARKER = "was rejected by its provider";
|
|
@@ -192658,7 +192965,7 @@ function buildMissingApiKeyError(params) {
|
|
|
192658
192965
|
}
|
|
192659
192966
|
function buildBedrockSetupError(params) {
|
|
192660
192967
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
192661
|
-
return `Bedrock model
|
|
192968
|
+
return `Bedrock model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
192662
192969
|
|
|
192663
192970
|
add the missing secret(s) to your GitHub repository at ${githubSecretsUrl}, then reference them in your workflow's \`env:\` block:
|
|
192664
192971
|
|
|
@@ -192672,7 +192979,7 @@ for full setup instructions, see https://docs.pullfrog.com/bedrock`;
|
|
|
192672
192979
|
}
|
|
192673
192980
|
function buildVertexSetupError(params) {
|
|
192674
192981
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
192675
|
-
return `Google Vertex AI model
|
|
192982
|
+
return `Google Vertex AI model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
192676
192983
|
|
|
192677
192984
|
add the missing secret(s) to your GitHub repository at ${githubSecretsUrl}, then reference them in your workflow's \`env:\` block:
|
|
192678
192985
|
|
|
@@ -192685,7 +192992,7 @@ for full setup instructions, see https://docs.pullfrog.com/vertex`;
|
|
|
192685
192992
|
}
|
|
192686
192993
|
function buildOpenAICompatibleSetupError(params) {
|
|
192687
192994
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
192688
|
-
return `OpenAI-compatible model
|
|
192995
|
+
return `OpenAI-compatible model ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
192689
192996
|
|
|
192690
192997
|
only the API key is sensitive \u2014 add it as a secret at ${githubSecretsUrl}. everything else is plain workflow \`env:\`:
|
|
192691
192998
|
|
|
@@ -192704,7 +193011,7 @@ for full setup instructions, see https://docs.pullfrog.com/openai-compatible`;
|
|
|
192704
193011
|
}
|
|
192705
193012
|
function buildAzureSetupError(params) {
|
|
192706
193013
|
const githubSecretsUrl = `https://github.com/${params.owner}/${params.name}/settings/secrets/actions`;
|
|
192707
|
-
return `Azure OpenAI
|
|
193014
|
+
return `Azure OpenAI ${BYOK_CONFIG_MARKER} ${params.missing.join(", ")}.
|
|
192708
193015
|
|
|
192709
193016
|
only the API key is sensitive \u2014 add it as a secret at ${githubSecretsUrl}. the rest is plain workflow \`env:\`:
|
|
192710
193017
|
|
|
@@ -192725,22 +193032,22 @@ is disabled, so long runs grow until Azure refuses them.
|
|
|
192725
193032
|
|
|
192726
193033
|
for full setup instructions, see https://docs.pullfrog.com/azure`;
|
|
192727
193034
|
}
|
|
192728
|
-
function
|
|
193035
|
+
function hasEnvVar2(name) {
|
|
192729
193036
|
const value2 = process.env[name];
|
|
192730
193037
|
return typeof value2 === "string" && value2.length > 0;
|
|
192731
193038
|
}
|
|
192732
193039
|
function modelHasRuntimeAuth(model) {
|
|
192733
193040
|
const authVars = [...getModelEnvVars(model), ...getModelManagedCredentials(model)];
|
|
192734
|
-
return authVars.length === 0 || authVars.some(
|
|
193041
|
+
return authVars.length === 0 || authVars.some(hasEnvVar2);
|
|
192735
193042
|
}
|
|
192736
193043
|
function hasPositiveNumberEnvVar(name) {
|
|
192737
193044
|
return Number(process.env[name]) > 0;
|
|
192738
193045
|
}
|
|
192739
193046
|
function validateOpenAICompatibleSetup(params) {
|
|
192740
193047
|
const missing = [];
|
|
192741
|
-
if (!
|
|
192742
|
-
if (!
|
|
192743
|
-
if (!
|
|
193048
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_BASE_URL_ENV)) missing.push(OPENAI_COMPATIBLE_BASE_URL_ENV);
|
|
193049
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_API_KEY_ENV)) missing.push(OPENAI_COMPATIBLE_API_KEY_ENV);
|
|
193050
|
+
if (!hasEnvVar2(OPENAI_COMPATIBLE_MODEL_ENV)) missing.push(OPENAI_COMPATIBLE_MODEL_ENV);
|
|
192744
193051
|
if (!hasPositiveNumberEnvVar(OPENAI_COMPATIBLE_CONTEXT_ENV))
|
|
192745
193052
|
missing.push(OPENAI_COMPATIBLE_CONTEXT_ENV);
|
|
192746
193053
|
if (!hasPositiveNumberEnvVar(OPENAI_COMPATIBLE_MAX_OUTPUT_ENV))
|
|
@@ -192753,9 +193060,9 @@ function validateOpenAICompatibleSetup(params) {
|
|
|
192753
193060
|
}
|
|
192754
193061
|
function validateAzureSetup(params) {
|
|
192755
193062
|
const missing = [];
|
|
192756
|
-
if (!
|
|
192757
|
-
if (!
|
|
192758
|
-
if (!
|
|
193063
|
+
if (!hasEnvVar2(AZURE_API_KEY_ENV)) missing.push(AZURE_API_KEY_ENV);
|
|
193064
|
+
if (!hasEnvVar2(AZURE_RESOURCE_NAME_ENV)) missing.push(AZURE_RESOURCE_NAME_ENV);
|
|
193065
|
+
if (!hasEnvVar2(AZURE_DEPLOYMENT_ENV)) missing.push(AZURE_DEPLOYMENT_ENV);
|
|
192759
193066
|
if (!hasPositiveNumberEnvVar(AZURE_CONTEXT_ENV)) missing.push(AZURE_CONTEXT_ENV);
|
|
192760
193067
|
if (!hasPositiveNumberEnvVar(AZURE_MAX_OUTPUT_ENV)) missing.push(AZURE_MAX_OUTPUT_ENV);
|
|
192761
193068
|
if (missing.length > 0) {
|
|
@@ -192763,33 +193070,33 @@ function validateAzureSetup(params) {
|
|
|
192763
193070
|
}
|
|
192764
193071
|
}
|
|
192765
193072
|
function validateBedrockSetup(params) {
|
|
192766
|
-
const hasAuth =
|
|
193073
|
+
const hasAuth = hasEnvVar2("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar2("AWS_ACCESS_KEY_ID") && hasEnvVar2("AWS_SECRET_ACCESS_KEY");
|
|
192767
193074
|
const missing = [];
|
|
192768
193075
|
if (!hasAuth)
|
|
192769
193076
|
missing.push("AWS_BEARER_TOKEN_BEDROCK (or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)");
|
|
192770
|
-
if (!
|
|
192771
|
-
if (!
|
|
193077
|
+
if (!hasEnvVar2("AWS_REGION")) missing.push("AWS_REGION");
|
|
193078
|
+
if (!hasEnvVar2(BEDROCK_MODEL_ID_ENV)) missing.push(BEDROCK_MODEL_ID_ENV);
|
|
192772
193079
|
if (missing.length > 0) {
|
|
192773
193080
|
throw new Error(buildBedrockSetupError({ owner: params.owner, name: params.name, missing }));
|
|
192774
193081
|
}
|
|
192775
193082
|
}
|
|
192776
193083
|
function validateVertexSetup(params) {
|
|
192777
|
-
const hasAuth =
|
|
192778
|
-
const hasProject =
|
|
193084
|
+
const hasAuth = hasEnvVar2(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
193085
|
+
const hasProject = hasEnvVar2(GOOGLE_CLOUD_PROJECT_ENV) || readProjectIdFromVertexServiceAccountJson() !== void 0;
|
|
192779
193086
|
const missing = [];
|
|
192780
193087
|
if (!hasAuth) missing.push(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
192781
193088
|
if (!hasProject) missing.push(GOOGLE_CLOUD_PROJECT_ENV);
|
|
192782
|
-
if (!
|
|
192783
|
-
if (!
|
|
193089
|
+
if (!hasEnvVar2(VERTEX_LOCATION_ENV)) missing.push(VERTEX_LOCATION_ENV);
|
|
193090
|
+
if (!hasEnvVar2(VERTEX_MODEL_ID_ENV)) missing.push(VERTEX_MODEL_ID_ENV);
|
|
192784
193091
|
if (missing.length > 0) {
|
|
192785
193092
|
throw new Error(buildVertexSetupError({ owner: params.owner, name: params.name, missing }));
|
|
192786
193093
|
}
|
|
192787
193094
|
}
|
|
192788
193095
|
function hasSingleProviderAuth(agentName) {
|
|
192789
193096
|
if (agentName === "codex") {
|
|
192790
|
-
return
|
|
193097
|
+
return hasEnvVar2("OPENAI_API_KEY") || hasEnvVar2("CODEX_AUTH_JSON");
|
|
192791
193098
|
}
|
|
192792
|
-
return
|
|
193099
|
+
return hasEnvVar2("ANTHROPIC_API_KEY") || hasEnvVar2("ANTHROPIC_AUTH_TOKEN") || hasEnvVar2("CLAUDE_CODE_OAUTH_TOKEN");
|
|
192793
193100
|
}
|
|
192794
193101
|
function validateAgentApiKey(params) {
|
|
192795
193102
|
if (params.model) {
|
|
@@ -192822,7 +193129,7 @@ function validateAgentApiKey(params) {
|
|
|
192822
193129
|
if (params.authorized.has(params.model)) return;
|
|
192823
193130
|
const reason = getModelsFailure();
|
|
192824
193131
|
if (reason) throw new Error(reason);
|
|
192825
|
-
if (getModelEnvVars(params.model).some(
|
|
193132
|
+
if (getModelEnvVars(params.model).some(hasEnvVar2)) return;
|
|
192826
193133
|
throw new Error(
|
|
192827
193134
|
buildKeyError({
|
|
192828
193135
|
owner: params.owner,
|
|
@@ -192869,7 +193176,7 @@ function validateAgentApiKey(params) {
|
|
|
192869
193176
|
}
|
|
192870
193177
|
function isApiKeyAuthError(text) {
|
|
192871
193178
|
if (!text) return false;
|
|
192872
|
-
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);
|
|
193179
|
+
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);
|
|
192873
193180
|
}
|
|
192874
193181
|
function isOAuthCredentialExpiredError(text) {
|
|
192875
193182
|
return (
|
|
@@ -192965,8 +193272,8 @@ function formatApiKeyErrorSummary(params) {
|
|
|
192965
193272
|
`[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)`
|
|
192966
193273
|
].join("\n");
|
|
192967
193274
|
}
|
|
192968
|
-
const subscription = Object.keys(SUBSCRIPTION_CREDENTIALS).find(
|
|
192969
|
-
if (subscription && !
|
|
193275
|
+
const subscription = Object.keys(SUBSCRIPTION_CREDENTIALS).find(hasEnvVar2);
|
|
193276
|
+
if (subscription && !hasEnvVar2("ANTHROPIC_API_KEY")) {
|
|
192970
193277
|
const details = SUBSCRIPTION_CREDENTIALS[subscription];
|
|
192971
193278
|
return [
|
|
192972
193279
|
`**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.`,
|
|
@@ -192981,6 +193288,114 @@ function formatApiKeyErrorSummary(params) {
|
|
|
192981
193288
|
].join("\n");
|
|
192982
193289
|
}
|
|
192983
193290
|
|
|
193291
|
+
// utils/agent.ts
|
|
193292
|
+
function hasEnvVar3(name) {
|
|
193293
|
+
const val = process.env[name];
|
|
193294
|
+
return typeof val === "string" && val.length > 0;
|
|
193295
|
+
}
|
|
193296
|
+
function hasClaudeCodeAuth() {
|
|
193297
|
+
return hasEnvVar3("CLAUDE_CODE_OAUTH_TOKEN") || hasEnvVar3("ANTHROPIC_API_KEY") || hasEnvVar3("ANTHROPIC_AUTH_TOKEN");
|
|
193298
|
+
}
|
|
193299
|
+
function hasCodexAuth() {
|
|
193300
|
+
return hasEnvVar3("CODEX_AUTH_JSON") || hasEnvVar3("OPENAI_API_KEY");
|
|
193301
|
+
}
|
|
193302
|
+
function hasBedrockAuth() {
|
|
193303
|
+
return hasEnvVar3("AWS_BEARER_TOKEN_BEDROCK") || hasEnvVar3("AWS_ACCESS_KEY_ID") && hasEnvVar3("AWS_SECRET_ACCESS_KEY");
|
|
193304
|
+
}
|
|
193305
|
+
function hasVertexAuth() {
|
|
193306
|
+
return hasEnvVar3(VERTEX_SERVICE_ACCOUNT_JSON_ENV);
|
|
193307
|
+
}
|
|
193308
|
+
function resolveSlug(slug2) {
|
|
193309
|
+
const alias = resolveDisplayAlias(slug2);
|
|
193310
|
+
if (alias?.routing === "bedrock") {
|
|
193311
|
+
const bedrockId = process.env[BEDROCK_MODEL_ID_ENV]?.trim();
|
|
193312
|
+
if (!bedrockId) {
|
|
193313
|
+
throw new Error(
|
|
193314
|
+
`${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.`
|
|
193315
|
+
);
|
|
193316
|
+
}
|
|
193317
|
+
return bedrockId;
|
|
193318
|
+
}
|
|
193319
|
+
if (alias?.routing === "vertex") {
|
|
193320
|
+
const vertexId = process.env[VERTEX_MODEL_ID_ENV]?.trim();
|
|
193321
|
+
if (!vertexId) {
|
|
193322
|
+
throw new Error(
|
|
193323
|
+
`${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.`
|
|
193324
|
+
);
|
|
193325
|
+
}
|
|
193326
|
+
return vertexId;
|
|
193327
|
+
}
|
|
193328
|
+
if (alias?.routing === "azure") {
|
|
193329
|
+
const deployment = process.env[AZURE_DEPLOYMENT_ENV]?.trim();
|
|
193330
|
+
if (!deployment) {
|
|
193331
|
+
throw new Error(
|
|
193332
|
+
`${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.`
|
|
193333
|
+
);
|
|
193334
|
+
}
|
|
193335
|
+
return `${AZURE_PROVIDER}/${deployment}`;
|
|
193336
|
+
}
|
|
193337
|
+
if (alias?.routing === "openai-compatible") {
|
|
193338
|
+
const modelId = process.env[OPENAI_COMPATIBLE_MODEL_ENV]?.trim();
|
|
193339
|
+
if (!modelId) {
|
|
193340
|
+
throw new Error(
|
|
193341
|
+
`${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.`
|
|
193342
|
+
);
|
|
193343
|
+
}
|
|
193344
|
+
return `${OPENAI_COMPATIBLE_PROVIDER}/${modelId}`;
|
|
193345
|
+
}
|
|
193346
|
+
return resolveCliModel(slug2);
|
|
193347
|
+
}
|
|
193348
|
+
function resolveModel(ctx) {
|
|
193349
|
+
const envModel = process.env.PULLFROG_MODEL?.trim();
|
|
193350
|
+
if (envModel) {
|
|
193351
|
+
return resolveSlug(envModel) ?? envModel;
|
|
193352
|
+
}
|
|
193353
|
+
const slug2 = ctx.slug?.trim();
|
|
193354
|
+
if (slug2) {
|
|
193355
|
+
const resolved = resolveSlug(slug2);
|
|
193356
|
+
if (resolved) {
|
|
193357
|
+
return resolved;
|
|
193358
|
+
}
|
|
193359
|
+
if (slug2.includes("/")) {
|
|
193360
|
+
log.info(`\xBB "${slug2}" is not a curated alias \u2014 passing through as a raw model specifier`);
|
|
193361
|
+
return slug2;
|
|
193362
|
+
}
|
|
193363
|
+
log.warning(`\xBB unknown model slug "${slug2}" \u2014 agent will auto-select`);
|
|
193364
|
+
}
|
|
193365
|
+
return void 0;
|
|
193366
|
+
}
|
|
193367
|
+
function resolveAgent(ctx) {
|
|
193368
|
+
const envAgent = process.env.PULLFROG_AGENT?.trim();
|
|
193369
|
+
if (envAgent) {
|
|
193370
|
+
if (envAgent in agents) {
|
|
193371
|
+
return agents[envAgent];
|
|
193372
|
+
}
|
|
193373
|
+
log.warning(`\xBB unknown PULLFROG_AGENT="${envAgent}" \u2014 falling through to auto-select`);
|
|
193374
|
+
}
|
|
193375
|
+
if (ctx.proxyModel) return agents.opencode;
|
|
193376
|
+
if (ctx.model && hasBedrockAuth() && process.env[BEDROCK_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
193377
|
+
return isBedrockAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
193378
|
+
}
|
|
193379
|
+
if (ctx.model && hasVertexAuth() && process.env[VERTEX_MODEL_ID_ENV]?.trim() === ctx.model) {
|
|
193380
|
+
return isVertexAnthropicId(ctx.model) ? agents.claude : agents.opencode;
|
|
193381
|
+
}
|
|
193382
|
+
if (ctx.model) {
|
|
193383
|
+
try {
|
|
193384
|
+
const provider2 = getModelProvider(ctx.model);
|
|
193385
|
+
if (provider2 === "anthropic" && hasClaudeCodeAuth()) return agents.claude;
|
|
193386
|
+
if (provider2 === "openai" && ctx.codexAgent && hasCodexAuth()) return agents.codex;
|
|
193387
|
+
} catch {
|
|
193388
|
+
}
|
|
193389
|
+
}
|
|
193390
|
+
if (!ctx.model) {
|
|
193391
|
+
if (hasEnvVar3("ANTHROPIC_AUTH_TOKEN") && !hasEnvVar3("ANTHROPIC_API_KEY") && !hasEnvVar3("CLAUDE_CODE_OAUTH_TOKEN")) {
|
|
193392
|
+
return agents.claude;
|
|
193393
|
+
}
|
|
193394
|
+
if (ctx.codexAgent && hasCodexAuth() && !hasClaudeCodeAuth()) return agents.codex;
|
|
193395
|
+
}
|
|
193396
|
+
return agents.opencode;
|
|
193397
|
+
}
|
|
193398
|
+
|
|
192984
193399
|
// utils/billingErrors.ts
|
|
192985
193400
|
var BillingError = class extends Error {
|
|
192986
193401
|
code;
|
|
@@ -193833,10 +194248,7 @@ async function persistLearnings(ctx) {
|
|
|
193833
194248
|
authorization: `Bearer ${ctx.apiToken}`,
|
|
193834
194249
|
"content-type": "application/json"
|
|
193835
194250
|
},
|
|
193836
|
-
body: JSON.stringify({
|
|
193837
|
-
learnings: current,
|
|
193838
|
-
model: ctx.toolState.model
|
|
193839
|
-
}),
|
|
194251
|
+
body: JSON.stringify({ learnings: current }),
|
|
193840
194252
|
signal: AbortSignal.timeout(1e4)
|
|
193841
194253
|
});
|
|
193842
194254
|
if (!response.ok) {
|
|
@@ -193878,7 +194290,7 @@ async function persistXrepoLearnings(ctx) {
|
|
|
193878
194290
|
authorization: `Bearer ${ctx.apiToken}`,
|
|
193879
194291
|
"content-type": "application/json"
|
|
193880
194292
|
},
|
|
193881
|
-
body: JSON.stringify({ learnings: current
|
|
194293
|
+
body: JSON.stringify({ learnings: current }),
|
|
193882
194294
|
signal: AbortSignal.timeout(1e4)
|
|
193883
194295
|
});
|
|
193884
194296
|
if (!response.ok) {
|
|
@@ -195289,6 +195701,15 @@ ${input.errorMessage}
|
|
|
195289
195701
|
\`\`\``
|
|
195290
195702
|
].join("\n");
|
|
195291
195703
|
}
|
|
195704
|
+
function formatByokSetupSummary(input) {
|
|
195705
|
+
return [
|
|
195706
|
+
"**This repo's model isn't fully set up yet.**",
|
|
195707
|
+
"",
|
|
195708
|
+
input.raw,
|
|
195709
|
+
"",
|
|
195710
|
+
`[Configure model \u2192](${getApiUrl()}/console/${input.owner}/${input.name})`
|
|
195711
|
+
].join("\n");
|
|
195712
|
+
}
|
|
195292
195713
|
function formatProviderModelNotFoundSummary(input) {
|
|
195293
195714
|
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.
|
|
195294
195715
|
|
|
@@ -195344,6 +195765,16 @@ ${body}`, comment: body };
|
|
|
195344
195765
|
});
|
|
195345
195766
|
return { summary: `### \u274C Pullfrog failed
|
|
195346
195767
|
|
|
195768
|
+
${body}`, comment: body };
|
|
195769
|
+
}
|
|
195770
|
+
if (isByokSetupError(input.errorMessage)) {
|
|
195771
|
+
const body = formatByokSetupSummary({
|
|
195772
|
+
owner: input.repo.owner,
|
|
195773
|
+
name: input.repo.name,
|
|
195774
|
+
raw: input.errorMessage
|
|
195775
|
+
});
|
|
195776
|
+
return { summary: `### \u274C Pullfrog failed
|
|
195777
|
+
|
|
195347
195778
|
${body}`, comment: body };
|
|
195348
195779
|
}
|
|
195349
195780
|
const apiKeySource = hangBody ?? input.errorMessage;
|
|
@@ -196652,13 +197083,6 @@ undici/lib/websocket/frame.js:
|
|
|
196652
197083
|
undici/lib/web/websocket/frame.js:
|
|
196653
197084
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
196654
197085
|
|
|
196655
|
-
content-type/dist/index.js:
|
|
196656
|
-
(*!
|
|
196657
|
-
* content-type
|
|
196658
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
196659
|
-
* MIT Licensed
|
|
196660
|
-
*)
|
|
196661
|
-
|
|
196662
197086
|
@mixmark-io/domino/lib/style_parser.js:
|
|
196663
197087
|
(**
|
|
196664
197088
|
* @license
|
|
@@ -196679,7 +197103,7 @@ ieee754/index.js:
|
|
|
196679
197103
|
* MIT Licensed
|
|
196680
197104
|
*)
|
|
196681
197105
|
|
|
196682
|
-
mcp-proxy/dist/startStdioServer-
|
|
197106
|
+
mcp-proxy/dist/startStdioServer-C4sEMMHS.mjs:
|
|
196683
197107
|
(*!
|
|
196684
197108
|
* content-type
|
|
196685
197109
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
@@ -196725,6 +197149,13 @@ mcp-proxy/dist/startStdioServer-BomI-BJR.mjs:
|
|
|
196725
197149
|
* MIT Licensed
|
|
196726
197150
|
*)
|
|
196727
197151
|
|
|
197152
|
+
content-type/dist/index.js:
|
|
197153
|
+
(*!
|
|
197154
|
+
* content-type
|
|
197155
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
197156
|
+
* MIT Licensed
|
|
197157
|
+
*)
|
|
197158
|
+
|
|
196728
197159
|
@octokit/request-error/dist-src/index.js:
|
|
196729
197160
|
(* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist *)
|
|
196730
197161
|
|