gogcli-mcp 2.26.0 → 2.27.1
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/SKILL.md +2 -2
- package/dist/index.js +480 -131
- package/dist/lib.js +484 -132
- package/manifest.json +9 -1
- package/mint.yaml +1 -1
- package/package.json +3 -3
- package/server.json +2 -2
- package/src/lib.ts +6 -0
- package/src/runner.ts +1 -1
- package/src/tools/gmail.ts +136 -5
- package/src/tools/utils.ts +20 -0
- package/src/worker.ts +1 -1
- package/tests/server.test.ts +65 -0
- package/tests/tools/gmail.test.ts +320 -0
package/dist/lib.js
CHANGED
|
@@ -3108,9 +3108,28 @@ var require_utils = __commonJS({
|
|
|
3108
3108
|
"use strict";
|
|
3109
3109
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3110
3110
|
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);
|
|
3111
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
3111
3112
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
3112
3113
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
3113
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
3114
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
3115
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
3116
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
3117
|
+
var BYTE_HEX = new Array(256);
|
|
3118
|
+
{
|
|
3119
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
3120
|
+
for (let i = 0; i < 256; i++) {
|
|
3121
|
+
BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
function percentEncodeNonAscii(cp) {
|
|
3125
|
+
if (cp < 2048) {
|
|
3126
|
+
return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
3127
|
+
}
|
|
3128
|
+
if (cp < 65536) {
|
|
3129
|
+
return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
3130
|
+
}
|
|
3131
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
3132
|
+
}
|
|
3114
3133
|
function stringArrayToHexStripped(input) {
|
|
3115
3134
|
let acc = "";
|
|
3116
3135
|
let code = 0;
|
|
@@ -3135,91 +3154,105 @@ var require_utils = __commonJS({
|
|
|
3135
3154
|
}
|
|
3136
3155
|
return acc;
|
|
3137
3156
|
}
|
|
3157
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
3158
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
3159
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
3138
3160
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
3139
|
-
function
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
if (hex3 !== "") {
|
|
3147
|
-
address.push(hex3);
|
|
3148
|
-
} else {
|
|
3149
|
-
output.error = true;
|
|
3150
|
-
return false;
|
|
3161
|
+
function isZoneIdentifier(zone) {
|
|
3162
|
+
if (zone.length === 0) return false;
|
|
3163
|
+
for (let i = 0; i < zone.length; i++) {
|
|
3164
|
+
if (isZoneCharacter(zone[i])) continue;
|
|
3165
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
3166
|
+
i += 2;
|
|
3167
|
+
continue;
|
|
3151
3168
|
}
|
|
3152
|
-
|
|
3169
|
+
return false;
|
|
3153
3170
|
}
|
|
3154
3171
|
return true;
|
|
3155
3172
|
}
|
|
3156
|
-
function
|
|
3157
|
-
let
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
let
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
}
|
|
3169
|
-
if (cursor === ":") {
|
|
3170
|
-
if (endipv6Encountered === true) {
|
|
3171
|
-
endIpv6 = true;
|
|
3172
|
-
}
|
|
3173
|
-
if (!consume(buffer, address, output)) {
|
|
3174
|
-
break;
|
|
3175
|
-
}
|
|
3176
|
-
if (++tokenCount > 7) {
|
|
3177
|
-
output.error = true;
|
|
3178
|
-
break;
|
|
3179
|
-
}
|
|
3180
|
-
if (i > 0 && input[i - 1] === ":") {
|
|
3181
|
-
endipv6Encountered = true;
|
|
3173
|
+
function compressIPv6ZeroRun(hextets) {
|
|
3174
|
+
let bestStart = -1;
|
|
3175
|
+
let bestLength = 0;
|
|
3176
|
+
let runStart = -1;
|
|
3177
|
+
let runLength = 0;
|
|
3178
|
+
for (let i = 0; i < hextets.length; i++) {
|
|
3179
|
+
if (hextets[i] === "0") {
|
|
3180
|
+
if (runStart === -1) runStart = i;
|
|
3181
|
+
runLength++;
|
|
3182
|
+
if (runLength > bestLength) {
|
|
3183
|
+
bestLength = runLength;
|
|
3184
|
+
bestStart = runStart;
|
|
3182
3185
|
}
|
|
3183
|
-
address.push(":");
|
|
3184
|
-
continue;
|
|
3185
|
-
} else if (cursor === "%") {
|
|
3186
|
-
if (!consume(buffer, address, output)) {
|
|
3187
|
-
break;
|
|
3188
|
-
}
|
|
3189
|
-
consume = consumeIsZone;
|
|
3190
3186
|
} else {
|
|
3191
|
-
|
|
3187
|
+
runStart = -1;
|
|
3188
|
+
runLength = 0;
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
if (bestLength < 2) return hextets.join(":");
|
|
3192
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
3193
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
3194
|
+
return head + "::" + tail;
|
|
3195
|
+
}
|
|
3196
|
+
function normalizeIPv6Address(input) {
|
|
3197
|
+
const compression = input.indexOf("::");
|
|
3198
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
3199
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
3200
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
3201
|
+
if (compression !== -1) {
|
|
3202
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
3203
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
3204
|
+
}
|
|
3205
|
+
const parts = left.concat(right);
|
|
3206
|
+
let hextetCount = 0;
|
|
3207
|
+
for (let i = 0; i < parts.length; i++) {
|
|
3208
|
+
const part = parts[i];
|
|
3209
|
+
if (part === "") return void 0;
|
|
3210
|
+
if (part.indexOf(".") !== -1) {
|
|
3211
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
3212
|
+
hextetCount += 2;
|
|
3192
3213
|
continue;
|
|
3193
3214
|
}
|
|
3215
|
+
if (!isHextet(part)) return void 0;
|
|
3216
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
3217
|
+
hextetCount++;
|
|
3194
3218
|
}
|
|
3195
|
-
if (
|
|
3196
|
-
if (
|
|
3197
|
-
|
|
3198
|
-
} else if (endIpv6) {
|
|
3199
|
-
address.push(buffer.join(""));
|
|
3200
|
-
} else {
|
|
3201
|
-
address.push(stringArrayToHexStripped(buffer));
|
|
3202
|
-
}
|
|
3219
|
+
if (compression === -1) {
|
|
3220
|
+
if (hextetCount !== 8) return void 0;
|
|
3221
|
+
return compressIPv6ZeroRun(parts);
|
|
3203
3222
|
}
|
|
3204
|
-
|
|
3205
|
-
|
|
3223
|
+
if (hextetCount >= 8) return void 0;
|
|
3224
|
+
const expanded = parts.slice(0, left.length);
|
|
3225
|
+
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
3226
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
3227
|
+
return compressIPv6ZeroRun(expanded);
|
|
3206
3228
|
}
|
|
3207
3229
|
function normalizeIPv6(host) {
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
if (
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3230
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
3231
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
3232
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
|
|
3233
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
3234
|
+
if (bracketed && isIPvFuture(input)) {
|
|
3235
|
+
input = input.toLowerCase();
|
|
3236
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
3237
|
+
}
|
|
3238
|
+
if (findToken(input, ":") < 2) {
|
|
3239
|
+
return { host, isIPV6: false, error: bracketed };
|
|
3240
|
+
}
|
|
3241
|
+
let zoneIdentifier = "";
|
|
3242
|
+
const zoneSeparator = input.indexOf("%");
|
|
3243
|
+
if (zoneSeparator !== -1) {
|
|
3244
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
3245
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
3246
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
3247
|
+
input = input.slice(0, zoneSeparator);
|
|
3248
|
+
}
|
|
3249
|
+
const address = normalizeIPv6Address(input);
|
|
3250
|
+
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
3251
|
+
return {
|
|
3252
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
3253
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
3254
|
+
isIPV6: true
|
|
3255
|
+
};
|
|
3223
3256
|
}
|
|
3224
3257
|
function findToken(str, token) {
|
|
3225
3258
|
let ind = 0;
|
|
@@ -3338,7 +3371,8 @@ var require_utils = __commonJS({
|
|
|
3338
3371
|
function normalizePathEncoding(input) {
|
|
3339
3372
|
let output = "";
|
|
3340
3373
|
for (let i = 0; i < input.length; i++) {
|
|
3341
|
-
|
|
3374
|
+
const ch = input[i];
|
|
3375
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
3342
3376
|
const hex3 = input.slice(i + 1, i + 3);
|
|
3343
3377
|
if (isHexPair(hex3)) {
|
|
3344
3378
|
const normalizedHex = hex3.toUpperCase();
|
|
@@ -3352,10 +3386,152 @@ var require_utils = __commonJS({
|
|
|
3352
3386
|
continue;
|
|
3353
3387
|
}
|
|
3354
3388
|
}
|
|
3355
|
-
if (isPathCharacter(
|
|
3356
|
-
output +=
|
|
3389
|
+
if (isPathCharacter(ch)) {
|
|
3390
|
+
output += ch;
|
|
3357
3391
|
} else {
|
|
3358
|
-
|
|
3392
|
+
const code = input.charCodeAt(i);
|
|
3393
|
+
if (code < 128) {
|
|
3394
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
3395
|
+
} else if (code < 55296 || code > 57343) {
|
|
3396
|
+
output += percentEncodeNonAscii(code);
|
|
3397
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
3398
|
+
const low = input.charCodeAt(i + 1);
|
|
3399
|
+
if (low >= 56320 && low <= 57343) {
|
|
3400
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
3401
|
+
i++;
|
|
3402
|
+
} else {
|
|
3403
|
+
output += percentEncodeNonAscii(65533);
|
|
3404
|
+
}
|
|
3405
|
+
} else {
|
|
3406
|
+
output += percentEncodeNonAscii(65533);
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
return output;
|
|
3411
|
+
}
|
|
3412
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
3413
|
+
let output = "";
|
|
3414
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
3415
|
+
for (let i = 0; i < input.length; i++) {
|
|
3416
|
+
const ch = input[i];
|
|
3417
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
3418
|
+
const hex3 = input.slice(i + 1, i + 3);
|
|
3419
|
+
if (isHexPair(hex3)) {
|
|
3420
|
+
output += "%" + hex3.toUpperCase();
|
|
3421
|
+
i += 2;
|
|
3422
|
+
continue;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
if (ch === "/") {
|
|
3426
|
+
firstSegment = false;
|
|
3427
|
+
}
|
|
3428
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
3429
|
+
output += ch;
|
|
3430
|
+
} else {
|
|
3431
|
+
const code = input.charCodeAt(i);
|
|
3432
|
+
if (code < 128) {
|
|
3433
|
+
output += BYTE_HEX[code];
|
|
3434
|
+
} else if (code < 55296 || code > 57343) {
|
|
3435
|
+
output += percentEncodeNonAscii(code);
|
|
3436
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
3437
|
+
const low = input.charCodeAt(i + 1);
|
|
3438
|
+
if (low >= 56320 && low <= 57343) {
|
|
3439
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
3440
|
+
i++;
|
|
3441
|
+
} else {
|
|
3442
|
+
output += percentEncodeNonAscii(65533);
|
|
3443
|
+
}
|
|
3444
|
+
} else {
|
|
3445
|
+
output += percentEncodeNonAscii(65533);
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
return output;
|
|
3450
|
+
}
|
|
3451
|
+
function encodeComponent(input, isAllowed) {
|
|
3452
|
+
let output = "";
|
|
3453
|
+
for (let i = 0; i < input.length; i++) {
|
|
3454
|
+
const ch = input[i];
|
|
3455
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
3456
|
+
const hex3 = input.slice(i + 1, i + 3);
|
|
3457
|
+
if (isHexPair(hex3)) {
|
|
3458
|
+
output += "%" + hex3.toUpperCase();
|
|
3459
|
+
i += 2;
|
|
3460
|
+
continue;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
if (isAllowed(ch)) {
|
|
3464
|
+
output += ch;
|
|
3465
|
+
} else {
|
|
3466
|
+
const code = input.charCodeAt(i);
|
|
3467
|
+
if (code < 128) {
|
|
3468
|
+
output += BYTE_HEX[code];
|
|
3469
|
+
} else if (code < 55296 || code > 57343) {
|
|
3470
|
+
output += percentEncodeNonAscii(code);
|
|
3471
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
3472
|
+
const low = input.charCodeAt(i + 1);
|
|
3473
|
+
if (low >= 56320 && low <= 57343) {
|
|
3474
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
3475
|
+
i++;
|
|
3476
|
+
} else {
|
|
3477
|
+
output += percentEncodeNonAscii(65533);
|
|
3478
|
+
}
|
|
3479
|
+
} else {
|
|
3480
|
+
output += percentEncodeNonAscii(65533);
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
return output;
|
|
3485
|
+
}
|
|
3486
|
+
function encodeUserinfo(input) {
|
|
3487
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
3488
|
+
}
|
|
3489
|
+
function encodeQuery(input) {
|
|
3490
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
3491
|
+
}
|
|
3492
|
+
function encodeFragment(input) {
|
|
3493
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
3494
|
+
}
|
|
3495
|
+
function isEscapeSafe(cp) {
|
|
3496
|
+
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;
|
|
3497
|
+
}
|
|
3498
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
3499
|
+
let output = "";
|
|
3500
|
+
for (let i = 0; i < input.length; i++) {
|
|
3501
|
+
const ch = input[i];
|
|
3502
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
3503
|
+
const hex3 = input.slice(i + 1, i + 3);
|
|
3504
|
+
if (isHexPair(hex3)) {
|
|
3505
|
+
const normalizedHex = hex3.toUpperCase();
|
|
3506
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
3507
|
+
if (isUnreserved(decoded)) {
|
|
3508
|
+
output += decoded;
|
|
3509
|
+
} else {
|
|
3510
|
+
output += "%" + normalizedHex;
|
|
3511
|
+
}
|
|
3512
|
+
i += 2;
|
|
3513
|
+
continue;
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
if (isQueryFragmentCharacter(ch)) {
|
|
3517
|
+
output += ch;
|
|
3518
|
+
} else {
|
|
3519
|
+
const code = input.charCodeAt(i);
|
|
3520
|
+
if (code < 128) {
|
|
3521
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
3522
|
+
} else if (code < 55296 || code > 57343) {
|
|
3523
|
+
output += percentEncodeNonAscii(code);
|
|
3524
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
3525
|
+
const low = input.charCodeAt(i + 1);
|
|
3526
|
+
if (low >= 56320 && low <= 57343) {
|
|
3527
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
3528
|
+
i++;
|
|
3529
|
+
} else {
|
|
3530
|
+
output += percentEncodeNonAscii(65533);
|
|
3531
|
+
}
|
|
3532
|
+
} else {
|
|
3533
|
+
output += percentEncodeNonAscii(65533);
|
|
3534
|
+
}
|
|
3359
3535
|
}
|
|
3360
3536
|
}
|
|
3361
3537
|
return output;
|
|
@@ -3378,14 +3554,18 @@ var require_utils = __commonJS({
|
|
|
3378
3554
|
function recomposeAuthority(component) {
|
|
3379
3555
|
const uriTokens = [];
|
|
3380
3556
|
if (component.userinfo !== void 0) {
|
|
3381
|
-
uriTokens.push(component.userinfo);
|
|
3557
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
3382
3558
|
uriTokens.push("@");
|
|
3383
3559
|
}
|
|
3384
3560
|
if (component.host !== void 0) {
|
|
3385
|
-
let host =
|
|
3561
|
+
let host = component.host;
|
|
3386
3562
|
if (!isIPv4(host)) {
|
|
3387
|
-
|
|
3388
|
-
if (ipV6res.isIPV6
|
|
3563
|
+
let ipV6res = normalizeIPv6(host);
|
|
3564
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
3565
|
+
host = normalizePercentEncoding(host, true);
|
|
3566
|
+
ipV6res = normalizeIPv6(host);
|
|
3567
|
+
}
|
|
3568
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
3389
3569
|
host = `[${ipV6res.escapedHost}]`;
|
|
3390
3570
|
} else {
|
|
3391
3571
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -3394,8 +3574,12 @@ var require_utils = __commonJS({
|
|
|
3394
3574
|
uriTokens.push(host);
|
|
3395
3575
|
}
|
|
3396
3576
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
3577
|
+
const port = String(component.port);
|
|
3578
|
+
if (!isPort(port)) {
|
|
3579
|
+
throw new TypeError("URI port is malformed.");
|
|
3580
|
+
}
|
|
3397
3581
|
uriTokens.push(":");
|
|
3398
|
-
uriTokens.push(
|
|
3582
|
+
uriTokens.push(port);
|
|
3399
3583
|
}
|
|
3400
3584
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
3401
3585
|
}
|
|
@@ -3405,6 +3589,11 @@ var require_utils = __commonJS({
|
|
|
3405
3589
|
reescapeHostDelimiters,
|
|
3406
3590
|
normalizePercentEncoding,
|
|
3407
3591
|
normalizePathEncoding,
|
|
3592
|
+
serializePathEncoding,
|
|
3593
|
+
normalizeQueryFragmentEncoding,
|
|
3594
|
+
encodeUserinfo,
|
|
3595
|
+
encodeQuery,
|
|
3596
|
+
encodeFragment,
|
|
3408
3597
|
escapePreservingEscapes,
|
|
3409
3598
|
removeDotSegments,
|
|
3410
3599
|
isIPv4,
|
|
@@ -3420,7 +3609,7 @@ var require_schemes = __commonJS({
|
|
|
3420
3609
|
"../../node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
3421
3610
|
"use strict";
|
|
3422
3611
|
var { isUUID } = require_utils();
|
|
3423
|
-
var URN_REG =
|
|
3612
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
3424
3613
|
var supportedSchemeNames = (
|
|
3425
3614
|
/** @type {const} */
|
|
3426
3615
|
[
|
|
@@ -3481,9 +3670,10 @@ var require_schemes = __commonJS({
|
|
|
3481
3670
|
wsComponent.secure = void 0;
|
|
3482
3671
|
}
|
|
3483
3672
|
if (wsComponent.resourceName) {
|
|
3484
|
-
const
|
|
3673
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
3674
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
3485
3675
|
wsComponent.path = path && path !== "/" ? path : void 0;
|
|
3486
|
-
wsComponent.query =
|
|
3676
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
3487
3677
|
wsComponent.resourceName = void 0;
|
|
3488
3678
|
}
|
|
3489
3679
|
wsComponent.fragment = void 0;
|
|
@@ -3495,7 +3685,7 @@ var require_schemes = __commonJS({
|
|
|
3495
3685
|
return urnComponent;
|
|
3496
3686
|
}
|
|
3497
3687
|
const matches = urnComponent.path.match(URN_REG);
|
|
3498
|
-
if (matches) {
|
|
3688
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
3499
3689
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
3500
3690
|
urnComponent.nid = matches[1].toLowerCase();
|
|
3501
3691
|
urnComponent.nss = matches[2];
|
|
@@ -3629,8 +3819,17 @@ var require_schemes = __commonJS({
|
|
|
3629
3819
|
var require_fast_uri = __commonJS({
|
|
3630
3820
|
"../../node_modules/fast-uri/index.js"(exports, module) {
|
|
3631
3821
|
"use strict";
|
|
3632
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
3822
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3633
3823
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
3824
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
3825
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
3826
|
+
function decodeValidScheme(scheme) {
|
|
3827
|
+
const decodedScheme = unescape(String(scheme));
|
|
3828
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
3829
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
3830
|
+
}
|
|
3831
|
+
return decodedScheme;
|
|
3832
|
+
}
|
|
3634
3833
|
function normalize(uri, options) {
|
|
3635
3834
|
if (typeof uri === "string") {
|
|
3636
3835
|
uri = /** @type {T} */
|
|
@@ -3643,12 +3842,34 @@ var require_fast_uri = __commonJS({
|
|
|
3643
3842
|
}
|
|
3644
3843
|
function resolve(baseURI, relativeURI, options) {
|
|
3645
3844
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3646
|
-
const {
|
|
3647
|
-
|
|
3648
|
-
|
|
3845
|
+
const {
|
|
3846
|
+
parsed: baseParsed,
|
|
3847
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
3848
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
3849
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
3850
|
+
malformedHost: baseMalformedHost,
|
|
3851
|
+
malformedScheme: baseMalformedScheme
|
|
3852
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
3853
|
+
const {
|
|
3854
|
+
parsed: relativeParsed,
|
|
3855
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
3856
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
3857
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
3858
|
+
malformedHost: relativeMalformedHost,
|
|
3859
|
+
malformedScheme: relativeMalformedScheme
|
|
3860
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
3861
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
3649
3862
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
3650
3863
|
}
|
|
3651
3864
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
3865
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
3866
|
+
const resolvedHost = resolved.host;
|
|
3867
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
3868
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
3869
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
3870
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
3871
|
+
throw new Error(resolved.error);
|
|
3872
|
+
}
|
|
3652
3873
|
schemelessOptions.skipEscape = true;
|
|
3653
3874
|
return serialize(resolved, schemelessOptions);
|
|
3654
3875
|
}
|
|
@@ -3708,7 +3929,7 @@ var require_fast_uri = __commonJS({
|
|
|
3708
3929
|
function equal(uriA, uriB, options) {
|
|
3709
3930
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
3710
3931
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
3711
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA
|
|
3932
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
3712
3933
|
}
|
|
3713
3934
|
function serialize(cmpts, opts) {
|
|
3714
3935
|
const component = {
|
|
@@ -3729,19 +3950,22 @@ var require_fast_uri = __commonJS({
|
|
|
3729
3950
|
};
|
|
3730
3951
|
const options = Object.assign({}, opts);
|
|
3731
3952
|
const uriTokens = [];
|
|
3953
|
+
if (component.scheme) {
|
|
3954
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
3955
|
+
}
|
|
3732
3956
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
3733
3957
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
3958
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
3959
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
3734
3960
|
if (component.path !== void 0) {
|
|
3735
3961
|
if (!options.skipEscape) {
|
|
3736
|
-
component.path =
|
|
3737
|
-
if (component.scheme !== void 0) {
|
|
3738
|
-
component.path = component.path.split("%3A").join(":");
|
|
3739
|
-
}
|
|
3962
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
3740
3963
|
} else {
|
|
3741
3964
|
component.path = normalizePercentEncoding(component.path);
|
|
3742
3965
|
}
|
|
3743
3966
|
}
|
|
3744
3967
|
if (options.reference !== "suffix" && component.scheme) {
|
|
3968
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
3745
3969
|
uriTokens.push(component.scheme, ":");
|
|
3746
3970
|
}
|
|
3747
3971
|
const authority = recomposeAuthority(component);
|
|
@@ -3759,16 +3983,19 @@ var require_fast_uri = __commonJS({
|
|
|
3759
3983
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
3760
3984
|
s = removeDotSegments(s);
|
|
3761
3985
|
}
|
|
3986
|
+
if (pathNoScheme) {
|
|
3987
|
+
s = serializePathEncoding(s, true);
|
|
3988
|
+
}
|
|
3762
3989
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") {
|
|
3763
3990
|
s = "/%2F" + s.slice(2);
|
|
3764
3991
|
}
|
|
3765
3992
|
uriTokens.push(s);
|
|
3766
3993
|
}
|
|
3767
3994
|
if (component.query !== void 0) {
|
|
3768
|
-
uriTokens.push("?", component.query);
|
|
3995
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
3769
3996
|
}
|
|
3770
3997
|
if (component.fragment !== void 0) {
|
|
3771
|
-
uriTokens.push("#", component.fragment);
|
|
3998
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
3772
3999
|
}
|
|
3773
4000
|
return uriTokens.join("");
|
|
3774
4001
|
}
|
|
@@ -3784,6 +4011,35 @@ var require_fast_uri = __commonJS({
|
|
|
3784
4011
|
}
|
|
3785
4012
|
return void 0;
|
|
3786
4013
|
}
|
|
4014
|
+
function hasMalformedPercentEncoding(component) {
|
|
4015
|
+
if (component === void 0) return false;
|
|
4016
|
+
let percent = component.indexOf("%");
|
|
4017
|
+
while (percent !== -1) {
|
|
4018
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
4019
|
+
return true;
|
|
4020
|
+
}
|
|
4021
|
+
percent = component.indexOf("%", percent + 3);
|
|
4022
|
+
}
|
|
4023
|
+
return false;
|
|
4024
|
+
}
|
|
4025
|
+
function isIPLiteral(host) {
|
|
4026
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
4027
|
+
}
|
|
4028
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
4029
|
+
const host = matches[4];
|
|
4030
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
4031
|
+
}
|
|
4032
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
4033
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
4034
|
+
try {
|
|
4035
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
4036
|
+
} catch (e) {
|
|
4037
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
4038
|
+
return true;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
return false;
|
|
4042
|
+
}
|
|
3787
4043
|
function parseWithStatus(uri, opts) {
|
|
3788
4044
|
const options = Object.assign({}, opts);
|
|
3789
4045
|
const parsed = {
|
|
@@ -3796,6 +4052,11 @@ var require_fast_uri = __commonJS({
|
|
|
3796
4052
|
fragment: void 0
|
|
3797
4053
|
};
|
|
3798
4054
|
let malformedAuthorityOrPort = false;
|
|
4055
|
+
let malformedPercentEncoding = false;
|
|
4056
|
+
let malformedSchemeSpecific = false;
|
|
4057
|
+
let malformedHost = false;
|
|
4058
|
+
let malformedIPLiteral = false;
|
|
4059
|
+
let malformedScheme = false;
|
|
3799
4060
|
let isIP = false;
|
|
3800
4061
|
if (options.reference === "suffix") {
|
|
3801
4062
|
if (options.scheme) {
|
|
@@ -3832,6 +4093,19 @@ var require_fast_uri = __commonJS({
|
|
|
3832
4093
|
parsed.path = matches[6] || "";
|
|
3833
4094
|
parsed.query = matches[7];
|
|
3834
4095
|
parsed.fragment = matches[8];
|
|
4096
|
+
if (parsed.scheme !== void 0) {
|
|
4097
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
4098
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
4099
|
+
parsed.scheme = decodedScheme.toLowerCase();
|
|
4100
|
+
} else {
|
|
4101
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
4102
|
+
malformedScheme = true;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
4106
|
+
if (malformedPercentEncoding) {
|
|
4107
|
+
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
4108
|
+
}
|
|
3835
4109
|
if (isNaN(parsed.port)) {
|
|
3836
4110
|
parsed.port = matches[5];
|
|
3837
4111
|
}
|
|
@@ -3843,9 +4117,16 @@ var require_fast_uri = __commonJS({
|
|
|
3843
4117
|
if (parsed.host) {
|
|
3844
4118
|
const ipv4result = isIPv4(parsed.host);
|
|
3845
4119
|
if (ipv4result === false) {
|
|
4120
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
4121
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
3846
4122
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
3847
|
-
|
|
3848
|
-
|
|
4123
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
4124
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
4125
|
+
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
4126
|
+
if (malformedIPLiteral) {
|
|
4127
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
4128
|
+
malformedAuthorityOrPort = true;
|
|
4129
|
+
}
|
|
3849
4130
|
} else {
|
|
3850
4131
|
isIP = true;
|
|
3851
4132
|
}
|
|
@@ -3863,42 +4144,36 @@ var require_fast_uri = __commonJS({
|
|
|
3863
4144
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
3864
4145
|
}
|
|
3865
4146
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
3866
|
-
if (!
|
|
3867
|
-
|
|
3868
|
-
try {
|
|
3869
|
-
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
3870
|
-
} catch (e) {
|
|
3871
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
3872
|
-
}
|
|
3873
|
-
}
|
|
4147
|
+
if (!malformedIPLiteral) {
|
|
4148
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
3874
4149
|
}
|
|
3875
4150
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
3876
4151
|
if (uri.indexOf("%") !== -1) {
|
|
3877
|
-
if (parsed.
|
|
3878
|
-
parsed.
|
|
3879
|
-
|
|
3880
|
-
if (parsed.host !== void 0) {
|
|
3881
|
-
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
4152
|
+
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
4153
|
+
const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
4154
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
3882
4155
|
}
|
|
3883
4156
|
}
|
|
3884
4157
|
if (parsed.path) {
|
|
3885
4158
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
3886
4159
|
}
|
|
4160
|
+
if (parsed.query) {
|
|
4161
|
+
parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
4162
|
+
}
|
|
3887
4163
|
if (parsed.fragment) {
|
|
3888
|
-
|
|
3889
|
-
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
3890
|
-
} catch {
|
|
3891
|
-
parsed.error = parsed.error || "URI malformed";
|
|
3892
|
-
}
|
|
4164
|
+
parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
|
|
3893
4165
|
}
|
|
3894
4166
|
}
|
|
3895
4167
|
if (schemeHandler && schemeHandler.parse) {
|
|
3896
4168
|
schemeHandler.parse(parsed, options);
|
|
4169
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
|
|
4170
|
+
malformedSchemeSpecific = true;
|
|
4171
|
+
}
|
|
3897
4172
|
}
|
|
3898
4173
|
} else {
|
|
3899
4174
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
3900
4175
|
}
|
|
3901
|
-
return { parsed, malformedAuthorityOrPort };
|
|
4176
|
+
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
3902
4177
|
}
|
|
3903
4178
|
function parse3(uri, opts) {
|
|
3904
4179
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -3907,20 +4182,28 @@ var require_fast_uri = __commonJS({
|
|
|
3907
4182
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
3908
4183
|
}
|
|
3909
4184
|
function normalizeStringWithStatus(uri, opts) {
|
|
3910
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
4185
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
3911
4186
|
return {
|
|
3912
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
3913
|
-
malformedAuthorityOrPort
|
|
4187
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
4188
|
+
malformedAuthorityOrPort,
|
|
4189
|
+
malformedPercentEncoding,
|
|
4190
|
+
malformedSchemeSpecific,
|
|
4191
|
+
malformedHost,
|
|
4192
|
+
malformedScheme
|
|
3914
4193
|
};
|
|
3915
4194
|
}
|
|
3916
4195
|
function normalizeComparableURI(uri, opts) {
|
|
3917
|
-
if (typeof uri
|
|
3918
|
-
|
|
3919
|
-
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
4196
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
4197
|
+
return void 0;
|
|
3920
4198
|
}
|
|
3921
|
-
|
|
3922
|
-
|
|
4199
|
+
let value;
|
|
4200
|
+
try {
|
|
4201
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
4202
|
+
} catch {
|
|
4203
|
+
return void 0;
|
|
3923
4204
|
}
|
|
4205
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
4206
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
3924
4207
|
}
|
|
3925
4208
|
var fastUri = {
|
|
3926
4209
|
SCHEMES,
|
|
@@ -23042,7 +23325,7 @@ function activeExecutor() {
|
|
|
23042
23325
|
return runExecutor.getStore() ?? defaultExecutor;
|
|
23043
23326
|
}
|
|
23044
23327
|
var TIMEOUT_MS = 3e4;
|
|
23045
|
-
var MIN_GOG_VERSION = "0.38.
|
|
23328
|
+
var MIN_GOG_VERSION = "0.38.3";
|
|
23046
23329
|
function readonlyEnvEnabled() {
|
|
23047
23330
|
return readEnvVar("GOG_READONLY") !== void 0 && parseBoolEnv("GOG_READONLY", { default: true });
|
|
23048
23331
|
}
|
|
@@ -23681,6 +23964,13 @@ function formatAuthHealth(raw, now) {
|
|
|
23681
23964
|
}
|
|
23682
23965
|
return accounts.map((a) => formatOneAccountHealth(a, now)).join("\n\n");
|
|
23683
23966
|
}
|
|
23967
|
+
function assertNotBoth(inlineParam, fileParam, inlineValue, fileValue) {
|
|
23968
|
+
if (inlineValue !== void 0 && fileValue !== void 0) {
|
|
23969
|
+
throw new Error(
|
|
23970
|
+
`${inlineParam} and ${fileParam} are mutually exclusive \u2014 gog accepts only one of them. Pass ${inlineParam} with the content itself (it is written to a temp file automatically when large), or ${fileParam} with a path that already exists on the gog server.`
|
|
23971
|
+
);
|
|
23972
|
+
}
|
|
23973
|
+
}
|
|
23684
23974
|
|
|
23685
23975
|
// src/tools/api.ts
|
|
23686
23976
|
function registerApiTools(server) {
|
|
@@ -25263,6 +25553,45 @@ function finish(base, itemsKey, merged, token) {
|
|
|
25263
25553
|
}
|
|
25264
25554
|
|
|
25265
25555
|
// src/tools/gmail.ts
|
|
25556
|
+
var replySchema = {
|
|
25557
|
+
messageId: external_exports.string().describe("Gmail message ID to reply to \u2014 the short hex `id` from gog_gmail_get / _search (or gog_gmail_messages_search, gogcli-mcp-gmail only). NOT the threadId, NOT the RFC822 `<\u2026@host>` Message-Id header."),
|
|
25558
|
+
body: external_exports.string().optional().describe("Reply body (plain text; required unless bodyHtml or bodyHtmlFile is set). Any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Note gog strips trailing newlines from a file-delivered body."),
|
|
25559
|
+
bodyHtml: external_exports.string().optional().describe("Reply body (HTML; optional). Pass the HTML itself at any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Mutually exclusive with bodyHtmlFile."),
|
|
25560
|
+
bodyHtmlFile: external_exports.string().optional().describe(`Path to an HTML file that ALREADY EXISTS on the gog server for the reply body. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out. Mutually exclusive with bodyHtml \u2014 supplying both is rejected. You rarely need this: bodyHtml handles large bodies on its own.`),
|
|
25561
|
+
to: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to To (repeatable). Added on top of the recipients inherited from the original message."),
|
|
25562
|
+
cc: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to Cc (repeatable)"),
|
|
25563
|
+
bcc: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to Bcc (repeatable)"),
|
|
25564
|
+
remove: external_exports.array(external_exports.string()).optional().describe("Remove these recipients from all fields (repeatable) \u2014 e.g. to drop someone from a reply-all."),
|
|
25565
|
+
subject: external_exports.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
|
|
25566
|
+
noQuote: external_exports.boolean().optional().describe("Do not include the original message quoted below the reply (default: the original is quoted)"),
|
|
25567
|
+
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Read on the server, base64-encoded with a MIME type inferred from the extension.`),
|
|
25568
|
+
attachInline: attachInlineParam,
|
|
25569
|
+
from: external_exports.string().optional().describe("Send from this email address (must be a verified send-as alias)"),
|
|
25570
|
+
autoFromAddressedAlias: external_exports.boolean().optional().describe("When from is omitted, send from the verified send-as alias the original message was addressed TO, instead of the account's primary address \u2014 so a reply to mail sent to an alias goes back out from that alias. Ignored when from is set."),
|
|
25571
|
+
signature: external_exports.boolean().optional().describe("Append the Gmail signature from the active send-as address"),
|
|
25572
|
+
signatureFrom: external_exports.string().optional().describe("Append the Gmail signature from this send-as email address"),
|
|
25573
|
+
signatureFile: external_exports.string().optional().describe("Append a local signature file (plain text or HTML), read on the gog server"),
|
|
25574
|
+
account: accountParam
|
|
25575
|
+
};
|
|
25576
|
+
function appendReplyFlags(args, f) {
|
|
25577
|
+
assertNotBoth("bodyHtml", "bodyHtmlFile", f.bodyHtml, f.bodyHtmlFile);
|
|
25578
|
+
if (f.body) args.push(payloadArg("body", "body-file", f.body));
|
|
25579
|
+
if (f.bodyHtml) args.push(payloadArg("body-html", "body-html-file", f.bodyHtml, "html"));
|
|
25580
|
+
else if (f.bodyHtmlFile) args.push(`--body-html-file=${f.bodyHtmlFile}`);
|
|
25581
|
+
if (f.to) for (const r of f.to) args.push(`--to=${r}`);
|
|
25582
|
+
if (f.cc) for (const r of f.cc) args.push(`--cc=${r}`);
|
|
25583
|
+
if (f.bcc) for (const r of f.bcc) args.push(`--bcc=${r}`);
|
|
25584
|
+
if (f.remove) for (const r of f.remove) args.push(`--remove=${r}`);
|
|
25585
|
+
if (f.subject) args.push(`--subject=${f.subject}`);
|
|
25586
|
+
if (f.noQuote) args.push("--no-quote");
|
|
25587
|
+
if (f.attach) for (const p of f.attach) args.push(`--attach=${p}`);
|
|
25588
|
+
args.push(...inlineAttachmentArgs("attach", f.attachInline, args));
|
|
25589
|
+
if (f.from) args.push(`--from=${f.from}`);
|
|
25590
|
+
if (f.signature) args.push("--signature");
|
|
25591
|
+
if (f.signatureFrom) args.push(`--signature-from=${f.signatureFrom}`);
|
|
25592
|
+
if (f.signatureFile) args.push(`--signature-file=${f.signatureFile}`);
|
|
25593
|
+
args.push(f.autoFromAddressedAlias ? "--auto-from-addressed-alias" : "--auto-from-addressed-alias=false");
|
|
25594
|
+
}
|
|
25266
25595
|
function registerGmailTools(server) {
|
|
25267
25596
|
server.registerTool("gog_gmail_search", {
|
|
25268
25597
|
description: 'Search Gmail threads using Gmail query syntax (e.g. "from:alice subject:invoice is:unread"). The query is passed verbatim to Gmail; a bare name token (from:alison) matches per Gmail\'s own heuristics, a full address (from:alison@example.com) is exact. To match a contact across several addresses, OR them: from:(a@x.com OR b@y.com). Results are ALWAYS newest-first by Gmail\'s internalDate \u2014 the wrapper sorts them, so the first result is the most recent match and a recent message can never be buried below older ones. IMPORTANT \u2014 a response carrying "truncated": true is an INCOMPLETE view of the matches: NEVER report that a message does not exist, or that there is no such mail, on the strength of one. Page through it (pass nextPageToken back as `pageToken`), set maxPages to walk several pages in one call, or narrow the query, and only then draw a conclusion. If you already know the thread, do not search for it at all \u2014 read it directly with gog_gmail_thread_get, which returns the whole thread and cannot be truncated or mis-ranked.',
|
|
@@ -25315,7 +25644,7 @@ function registerGmailTools(server) {
|
|
|
25315
25644
|
return runOrDiagnose(args, { account });
|
|
25316
25645
|
});
|
|
25317
25646
|
server.registerTool("gog_gmail_send", {
|
|
25318
|
-
description: 'Send an email. Two ways to attach a file: `attach` takes paths READ ON THE GOG SERVER, and `attachInline` takes the bytes themselves. Use attachInline unless you know the file exists on the same machine gog runs on \u2014 on the hosted connector and any remote deployment there is no shared filesystem, so no path you can name resolves there and `attach` will fail with "no such file or directory". When either is used, the JSON result echoes the attached filenames and byte sizes \u2014 check it to confirm the files were embedded.',
|
|
25647
|
+
description: 'Send an email. Two ways to attach a file: `attach` takes paths READ ON THE GOG SERVER, and `attachInline` takes the bytes themselves. Use attachInline unless you know the file exists on the same machine gog runs on \u2014 on the hosted connector and any remote deployment there is no shared filesystem, so no path you can name resolves there and `attach` will fail with "no such file or directory". When either is used, the JSON result echoes the attached filenames and byte sizes \u2014 check it to confirm the files were embedded. NOT the tool for answering a message: replyToMessageId only files this in the right thread \u2014 the subject, recipients and body are entirely yours, and the original is not quoted unless you set quote. Use gog_gmail_reply / gog_gmail_reply_all instead, which inherit all three.',
|
|
25319
25648
|
annotations: { destructiveHint: true },
|
|
25320
25649
|
inputSchema: {
|
|
25321
25650
|
to: external_exports.string().describe("Recipient(s), comma-separated"),
|
|
@@ -25323,23 +25652,43 @@ function registerGmailTools(server) {
|
|
|
25323
25652
|
body: external_exports.string().describe("Email body (plain text). Any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Note gog strips trailing newlines from a file-delivered body."),
|
|
25324
25653
|
cc: external_exports.string().optional().describe("CC recipients, comma-separated"),
|
|
25325
25654
|
bcc: external_exports.string().optional().describe("BCC recipients, comma-separated"),
|
|
25326
|
-
replyToMessageId: external_exports.string().optional().describe(
|
|
25327
|
-
threadId: external_exports.string().optional().describe("Thread ID to
|
|
25655
|
+
replyToMessageId: external_exports.string().optional().describe('Message ID to thread this message against \u2014 sets In-Reply-To/References only. It does NOT quote the original (pass quote for that), inherit its recipients, or prefix the subject with "Re:". For an actual reply use gog_gmail_reply.'),
|
|
25656
|
+
threadId: external_exports.string().optional().describe("Thread ID to thread this message within. Same caveat as replyToMessageId: threading only, no quote and no inherited subject or recipients."),
|
|
25657
|
+
quote: external_exports.boolean().optional().describe("Include the original message quoted below the body. Requires replyToMessageId or threadId. gog quotes by DEFAULT on gmail reply but never on gmail send, so without this a threaded send arrives with the original nowhere in it."),
|
|
25328
25658
|
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Each file is read on the server, base64-encoded with a MIME type inferred from its extension, and added as a multipart attachment.`),
|
|
25329
25659
|
attachInline: attachInlineParam,
|
|
25330
25660
|
account: accountParam
|
|
25331
25661
|
}
|
|
25332
|
-
}, async ({ to, subject, body, cc, bcc, replyToMessageId, threadId, attach, attachInline, account }) => {
|
|
25662
|
+
}, async ({ to, subject, body, cc, bcc, replyToMessageId, threadId, quote, attach, attachInline, account }) => {
|
|
25333
25663
|
const args = ["gmail", "send", `--to=${to}`, `--subject=${subject}`, payloadArg("body", "body-file", body)];
|
|
25334
25664
|
if (cc) args.push(`--cc=${cc}`);
|
|
25335
25665
|
if (bcc) args.push(`--bcc=${bcc}`);
|
|
25336
25666
|
if (replyToMessageId) args.push(`--reply-to-message-id=${replyToMessageId}`);
|
|
25337
25667
|
if (threadId) args.push(`--thread-id=${threadId}`);
|
|
25668
|
+
if (quote) args.push("--quote");
|
|
25338
25669
|
if (attach) for (const path of attach) args.push(`--attach=${path}`);
|
|
25339
25670
|
const inline = inlineAttachmentArgs("attach", attachInline, args);
|
|
25340
25671
|
args.push(...inline);
|
|
25341
25672
|
return runOrDiagnose(args, { account });
|
|
25342
25673
|
});
|
|
25674
|
+
server.registerTool("gog_gmail_reply", {
|
|
25675
|
+
description: 'Reply to a Gmail message (goes to the original sender only). USE THIS, not gog_gmail_send, whenever you are answering a message: it threads off the original AND inherits its "Re:" subject and quotes its body below yours, which gog_gmail_send does not \u2014 a send with replyToMessageId lands in the right thread but reads as a brand-new message, with the original nowhere in it. To answer every participant use gog_gmail_reply_all. The gogcli-mcp-gmail package adds two more routes with the same composition: gog_gmail_autoreply to reply across every message matching a query, and gog_gmail_drafts_reply to stage this exact reply as a draft instead of sending it.',
|
|
25676
|
+
annotations: { destructiveHint: true },
|
|
25677
|
+
inputSchema: replySchema
|
|
25678
|
+
}, async ({ messageId, account, ...flags }) => {
|
|
25679
|
+
const args = ["gmail", "reply", messageId];
|
|
25680
|
+
appendReplyFlags(args, flags);
|
|
25681
|
+
return runOrDiagnose(args, { account });
|
|
25682
|
+
});
|
|
25683
|
+
server.registerTool("gog_gmail_reply_all", {
|
|
25684
|
+
description: 'Reply to all participants of a Gmail message (the sender plus every To/Cc recipient). Same inherited "Re:" subject and quoted original as gog_gmail_reply. Use the remove flag to drop specific recipients from the reply-all. To stage it as a draft rather than send it, use gog_gmail_drafts_reply_all (gogcli-mcp-gmail only).',
|
|
25685
|
+
annotations: { destructiveHint: true },
|
|
25686
|
+
inputSchema: replySchema
|
|
25687
|
+
}, async ({ messageId, account, ...flags }) => {
|
|
25688
|
+
const args = ["gmail", "reply-all", messageId];
|
|
25689
|
+
appendReplyFlags(args, flags);
|
|
25690
|
+
return runOrDiagnose(args, { account });
|
|
25691
|
+
});
|
|
25343
25692
|
registerRunTool(server, { service: "gmail", examples: '"archive", "mark-read", "labels"' });
|
|
25344
25693
|
}
|
|
25345
25694
|
|
|
@@ -25667,7 +26016,7 @@ function registerTasksTools(server) {
|
|
|
25667
26016
|
}
|
|
25668
26017
|
|
|
25669
26018
|
// src/server.ts
|
|
25670
|
-
var VERSION = true ? "2.
|
|
26019
|
+
var VERSION = true ? "2.27.1" : "0.0.0";
|
|
25671
26020
|
var BASE_TOOL_REGISTRARS = [
|
|
25672
26021
|
registerApiTools,
|
|
25673
26022
|
registerAppScriptTools,
|
|
@@ -26178,6 +26527,8 @@ export {
|
|
|
26178
26527
|
VERSION,
|
|
26179
26528
|
accountParam,
|
|
26180
26529
|
annotateTruncatedList,
|
|
26530
|
+
appendReplyFlags,
|
|
26531
|
+
assertNotBoth,
|
|
26181
26532
|
attachInlineParam,
|
|
26182
26533
|
authToolsFor,
|
|
26183
26534
|
diagnose,
|
|
@@ -26209,6 +26560,7 @@ export {
|
|
|
26209
26560
|
registerSheetsTools,
|
|
26210
26561
|
registerSlidesTools,
|
|
26211
26562
|
registerTasksTools,
|
|
26563
|
+
replySchema,
|
|
26212
26564
|
resolvePageToken,
|
|
26213
26565
|
run,
|
|
26214
26566
|
runBinary,
|