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