gogcli-mcp 3.0.0 → 4.0.0

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.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/dist/index.js +273 -748
  4. package/dist/lib.js +375 -785
  5. package/manifest.json +2 -2
  6. package/mint.yaml +37 -33
  7. package/package.json +3 -3
  8. package/server.json +2 -2
  9. package/src/attachments.ts +28 -34
  10. package/src/blob-upload.ts +165 -134
  11. package/src/blob-urls.ts +3 -5
  12. package/src/bootstrap-auth.ts +97 -0
  13. package/src/index.ts +3 -4
  14. package/src/lib.ts +14 -9
  15. package/src/runner.ts +23 -175
  16. package/src/tools/appscript.ts +1 -1
  17. package/src/tools/auth.ts +5 -5
  18. package/src/tools/drive.ts +1 -3
  19. package/src/tools/gmail.ts +9 -9
  20. package/src/tools/utils.ts +12 -58
  21. package/tests/attachments.test.ts +11 -14
  22. package/tests/blob-upload.test.ts +235 -160
  23. package/tests/bootstrap-auth.test.ts +245 -0
  24. package/tests/runner-file-args.test.ts +1 -13
  25. package/tests/runner.test.ts +8 -95
  26. package/tests/sdk-single-copy.test.ts +4 -12
  27. package/tests/tools/auth-401-shapes.test.ts +2 -3
  28. package/tests/tools/auth.test.ts +5 -4
  29. package/tests/tools/drive.test.ts +11 -3
  30. package/tests/tools/gmail.test.ts +2 -2
  31. package/tests/tools/utils.test.ts +1 -50
  32. package/tests/zod-single-copy.test.ts +6 -14
  33. package/tsconfig.json +1 -2
  34. package/vitest.config.ts +2 -12
  35. package/src/auth-log.ts +0 -205
  36. package/src/connector-auth.ts +0 -319
  37. package/src/connector-login.ts +0 -87
  38. package/src/connector-runtime.ts +0 -910
  39. package/src/google-probe.ts +0 -113
  40. package/src/google-token.ts +0 -391
  41. package/src/remote-runner.ts +0 -77
  42. package/src/worker.ts +0 -117
  43. package/tests/auth-log.test.ts +0 -530
  44. package/tests/connector-auth.test.ts +0 -559
  45. package/tests/connector-login.test.ts +0 -151
  46. package/tests/connector-runtime.test.ts +0 -1664
  47. package/tests/google-probe.test.ts +0 -116
  48. package/tests/google-token.test.ts +0 -425
  49. package/tests/remote-runner.test.ts +0 -202
  50. package/tests/worker.test.ts +0 -167
package/dist/lib.js CHANGED
@@ -74,7 +74,6 @@ __export(external_exports, {
74
74
  ZodPrefault: () => ZodPrefault,
75
75
  ZodPreprocess: () => ZodPreprocess,
76
76
  ZodPromise: () => ZodPromise,
77
- ZodProperties: () => ZodProperties,
78
77
  ZodReadonly: () => ZodReadonly,
79
78
  ZodRealError: () => ZodRealError,
80
79
  ZodRecord: () => ZodRecord,
@@ -118,6 +117,7 @@ __export(external_exports, {
118
117
  creditCard: () => creditCard2,
119
118
  cuid: () => cuid3,
120
119
  cuid2: () => cuid22,
120
+ currencyCode: () => currencyCode2,
121
121
  custom: () => custom,
122
122
  date: () => date2,
123
123
  decode: () => decode2,
@@ -211,7 +211,7 @@ __export(external_exports, {
211
211
  preprocess: () => preprocess,
212
212
  prettifyError: () => prettifyError,
213
213
  promise: () => promise,
214
- properties: () => properties,
214
+ properties: () => _properties,
215
215
  property: () => _property,
216
216
  readonly: () => readonly,
217
217
  record: () => record,
@@ -299,6 +299,7 @@ __export(core_exports2, {
299
299
  $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
300
300
  $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
301
301
  $ZodCheckOverwrite: () => $ZodCheckOverwrite,
302
+ $ZodCheckProperties: () => $ZodCheckProperties,
302
303
  $ZodCheckProperty: () => $ZodCheckProperty,
303
304
  $ZodCheckRegex: () => $ZodCheckRegex,
304
305
  $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
@@ -352,7 +353,6 @@ __export(core_exports2, {
352
353
  $ZodPrefault: () => $ZodPrefault,
353
354
  $ZodPreprocess: () => $ZodPreprocess,
354
355
  $ZodPromise: () => $ZodPromise,
355
- $ZodProperties: () => $ZodProperties,
356
356
  $ZodReadonly: () => $ZodReadonly,
357
357
  $ZodRealError: () => $ZodRealError,
358
358
  $ZodRecord: () => $ZodRecord,
@@ -520,6 +520,7 @@ __export(core_exports2, {
520
520
  _xor: () => _xor,
521
521
  base64Charset: () => base64Charset,
522
522
  base64urlCharset: () => base64urlCharset,
523
+ canParseURL: () => canParseURL,
523
524
  clone: () => clone,
524
525
  compile: () => compile,
525
526
  compileFn: () => compileFn,
@@ -542,7 +543,6 @@ __export(core_exports2, {
542
543
  initializeContext: () => initializeContext,
543
544
  isBackEdge: () => isBackEdge,
544
545
  isRecursiveSchema: () => isRecursiveSchema,
545
- isTransforming: () => isTransforming,
546
546
  isValidBase64: () => isValidBase64,
547
547
  isValidBase64URL: () => isValidBase64URL,
548
548
  isValidCIDRv6: () => isValidCIDRv6,
@@ -579,6 +579,7 @@ __export(core_exports2, {
579
579
  util: () => util_exports,
580
580
  validate: () => validate,
581
581
  validateAsync: () => validateAsync,
582
+ validateURL: () => validateURL,
582
583
  version: () => version,
583
584
  withParser: () => withParser
584
585
  });
@@ -1320,9 +1321,6 @@ function members(proto, table) {
1320
1321
  else
1321
1322
  defineBound(proto, key, desc.value);
1322
1323
  }
1323
- for (const sym of Object.getOwnPropertySymbols(table)) {
1324
- defineBound(proto, sym, table[sym]);
1325
- }
1326
1324
  }
1327
1325
  function own(inst, key, value, enumerable = true) {
1328
1326
  Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
@@ -1475,8 +1473,7 @@ function $constructor(name, initializer3, proto, params) {
1475
1473
  } finally {
1476
1474
  _zodDesc.value = void 0;
1477
1475
  }
1478
- }
1479
- if (inst._zod.traits.has(name)) {
1476
+ } else if (inst._zod.traits.has(name)) {
1480
1477
  return;
1481
1478
  }
1482
1479
  inst._zod.traits.add(name);
@@ -1918,6 +1915,7 @@ __export(regexes_exports, {
1918
1915
  creditCard: () => creditCard,
1919
1916
  cuid: () => cuid,
1920
1917
  cuid2: () => cuid2,
1918
+ currencyCode: () => currencyCode,
1921
1919
  date: () => date,
1922
1920
  datetime: () => datetime,
1923
1921
  domain: () => domain,
@@ -2016,6 +2014,7 @@ var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a
2016
2014
  var httpProtocol = /^https?$/;
2017
2015
  var e164 = /^\+[1-9]\d{6,14}$/;
2018
2016
  var creditCard = /^\d(?:[ -]?\d){11,18}$/;
2017
+ var currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;
2019
2018
  var iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
2020
2019
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
2021
2020
  function anchor(source) {
@@ -2500,6 +2499,34 @@ var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst,
2500
2499
  return;
2501
2500
  };
2502
2501
  });
2502
+ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (inst, def) => {
2503
+ $ZodCheck.init(inst, def);
2504
+ hide(inst, Symbol.iterator, function* () {
2505
+ yield inst;
2506
+ });
2507
+ let entries;
2508
+ inst._zod.check = (payload) => {
2509
+ if (payload.value == null) {
2510
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
2511
+ return void 0;
2512
+ }
2513
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
2514
+ const input2 = payload.value;
2515
+ let proms;
2516
+ for (const [key, schema] of entries) {
2517
+ const result = schema._zod.run({ value: input2[key], issues: [] }, {});
2518
+ if (result instanceof Promise) {
2519
+ proms ?? (proms = []);
2520
+ proms.push(result.then((result2) => handleCheckPropertyResult(result2, payload, key)));
2521
+ } else {
2522
+ handleCheckPropertyResult(result, payload, key);
2523
+ }
2524
+ }
2525
+ if (proms)
2526
+ return Promise.all(proms).then(() => void 0);
2527
+ return void 0;
2528
+ };
2529
+ });
2503
2530
  var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
2504
2531
  $ZodCheck.init(inst, def);
2505
2532
  const mimeSet = new Set(def.mime);
@@ -2567,7 +2594,7 @@ ${content.join("\n")}
2567
2594
  var version = {
2568
2595
  major: 4,
2569
2596
  minor: 6,
2570
- patch: 1
2597
+ patch: 5
2571
2598
  };
2572
2599
 
2573
2600
  // ../../node_modules/zod/v4/core/schemas.js
@@ -2755,11 +2782,32 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
2755
2782
  });
2756
2783
  var URL_BAD_FORMAT = 1;
2757
2784
  var URL_UNPARSEABLE = 2;
2785
+ function canParseURL(input2) {
2786
+ try {
2787
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
2788
+ return URL.canParse(input2);
2789
+ new URL(input2);
2790
+ return true;
2791
+ } catch {
2792
+ return false;
2793
+ }
2794
+ }
2795
+ function validateURL(trimmed, def) {
2796
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
2797
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
2798
+ }
2799
+ return parseURLObject(trimmed, def);
2800
+ }
2758
2801
  function parseURLObject(trimmed, def) {
2759
2802
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
2760
2803
  return URL_BAD_FORMAT;
2761
2804
  }
2762
2805
  try {
2806
+ if (typeof URL !== "undefined") {
2807
+ const URLStatic = URL;
2808
+ if (typeof URLStatic.parse === "function")
2809
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
2810
+ }
2763
2811
  return new URL(trimmed);
2764
2812
  } catch {
2765
2813
  return URL_UNPARSEABLE;
@@ -2782,7 +2830,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2782
2830
  inst._zod.check = (payload) => {
2783
2831
  try {
2784
2832
  const trimmed = payload.value.trim();
2785
- const url2 = parseURLObject(trimmed, def);
2833
+ const url2 = validateURL(trimmed, def);
2786
2834
  if (url2 === URL_BAD_FORMAT) {
2787
2835
  payload.issues.push({
2788
2836
  code: "invalid_format",
@@ -2804,6 +2852,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2804
2852
  });
2805
2853
  return;
2806
2854
  }
2855
+ if (url2 === true) {
2856
+ payload.value = stripTabAndNewline(trimmed);
2857
+ return;
2858
+ }
2807
2859
  if (def.hostname && !urlHostnameOk(url2, def.hostname)) {
2808
2860
  payload.issues.push({
2809
2861
  code: "invalid_format",
@@ -2893,12 +2945,7 @@ var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
2893
2945
  function isValidIPv6(value) {
2894
2946
  if (!ipv6Alphabet.test(value))
2895
2947
  return false;
2896
- try {
2897
- new URL(`http://[${value}]`);
2898
- return true;
2899
- } catch {
2900
- return false;
2901
- }
2948
+ return canParseURL(`http://[${value}]`);
2902
2949
  }
2903
2950
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
2904
2951
  def.pattern ?? (def.pattern = ipv6);
@@ -3371,7 +3418,7 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
3371
3418
  return;
3372
3419
  }
3373
3420
  if (result.value === void 0) {
3374
- if (isPresent) {
3421
+ if (isPresent || optin === "defaulted" && !isOptionalOut) {
3375
3422
  final.value[key] = void 0;
3376
3423
  }
3377
3424
  } else {
@@ -3607,16 +3654,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
3607
3654
  doc.write(`
3608
3655
  if (${id}.issues.length) {${prefixStr(id, k)}
3609
3656
  }
3610
-
3611
- if (${id}.value === undefined) {
3612
- if (${isPresent}) {
3613
- newResult[${k}] = undefined;
3614
- }
3657
+ `);
3658
+ if (optin === "defaulted") {
3659
+ doc.write(`newResult[${k}] = ${id}.value;`);
3615
3660
  } else {
3661
+ doc.write(`
3662
+ if (${id}.value !== undefined || ${isPresent}) {
3616
3663
  newResult[${k}] = ${id}.value;
3617
3664
  }
3618
-
3619
3665
  `);
3666
+ }
3620
3667
  }
3621
3668
  }
3622
3669
  doc.write(`payload.value = newResult;`);
@@ -4963,59 +5010,6 @@ function handleRefineResult(result, payload, input2, inst) {
4963
5010
  payload.issues.push(issue(_iss));
4964
5011
  }
4965
5012
  }
4966
- function handlePropertiesResult(result, payload, key) {
4967
- if (result.issues.length) {
4968
- payload.issues.push(...prefixIssues(key, result.issues));
4969
- }
4970
- }
4971
- var $ZodProperties = /* @__PURE__ */ $constructor("$ZodProperties", (inst, def) => {
4972
- $ZodType.init(inst, def);
4973
- $ZodCheck.init(inst, def);
4974
- const memo3 = globalConfig.memoizer;
4975
- memo3?.attach(inst);
4976
- let entries;
4977
- const runShape = (payload, ctx) => {
4978
- entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
4979
- const input2 = payload.value;
4980
- let proms;
4981
- for (const [key, schema] of entries) {
4982
- const result = schema._zod.run({ value: input2[key], issues: [] }, ctx);
4983
- if (result instanceof Promise) {
4984
- proms ?? (proms = []);
4985
- proms.push(result.then((result2) => handlePropertiesResult(result2, payload, key)));
4986
- } else {
4987
- handlePropertiesResult(result, payload, key);
4988
- }
4989
- }
4990
- if (proms)
4991
- return Promise.all(proms).then(() => void 0);
4992
- return void 0;
4993
- };
4994
- inst._zod.parse = (payload, ctx) => {
4995
- const input2 = payload.value;
4996
- if (input2 === null || typeof input2 !== "object" && typeof input2 !== "function") {
4997
- payload.issues.push({ expected: "object", code: "invalid_type", input: input2, inst });
4998
- return payload;
4999
- }
5000
- if (ctx.direction === "backward")
5001
- ctx = { ...ctx, direction: "forward" };
5002
- if (memo3)
5003
- memo3.alloc(inst, payload, input2, ctx);
5004
- const result = runShape(payload, ctx);
5005
- return result instanceof Promise ? result.then(() => payload) : payload;
5006
- };
5007
- inst._zod.check = (payload) => {
5008
- if (payload.value == null) {
5009
- payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
5010
- return void 0;
5011
- }
5012
- return runShape(payload, {});
5013
- };
5014
- }, {
5015
- *[Symbol.iterator]() {
5016
- yield this;
5017
- }
5018
- });
5019
5013
 
5020
5014
  // ../../node_modules/zod/v4/core/memoizer.js
5021
5015
  var $ZodCyclicError = class extends Error {
@@ -5027,7 +5021,7 @@ var $ZodCyclicError = class extends Error {
5027
5021
  var STATE = "~memo";
5028
5022
  var NO_ISSUES = [];
5029
5023
  function isRef(value) {
5030
- return value !== null && (typeof value === "object" || typeof value === "function");
5024
+ return value !== null && typeof value === "object";
5031
5025
  }
5032
5026
  function cloneIssues(issues) {
5033
5027
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
@@ -5076,9 +5070,6 @@ function isRecursive(inst, stack, resolve) {
5076
5070
  check2(def.catchall);
5077
5071
  break;
5078
5072
  }
5079
- case "properties":
5080
- merge2(shape(def.shape, false));
5081
- break;
5082
5073
  case "array":
5083
5074
  check2(def.element);
5084
5075
  break;
@@ -5406,6 +5397,7 @@ var error = () => {
5406
5397
  json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
5407
5398
  e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
5408
5399
  credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",
5400
+ currency_code: "\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",
5409
5401
  iban: "IBAN",
5410
5402
  jwt: "JWT",
5411
5403
  template_literal: "\u0645\u062F\u062E\u0644"
@@ -5517,6 +5509,7 @@ var error2 = () => {
5517
5509
  json_string: "JSON string",
5518
5510
  e164: "E.164 number",
5519
5511
  credit_card: "kredit kart\u0131 n\xF6mr\u0259si",
5512
+ currency_code: "valyuta kodu",
5520
5513
  iban: "IBAN",
5521
5514
  jwt: "JWT",
5522
5515
  template_literal: "input"
@@ -5677,6 +5670,7 @@ var error3 = () => {
5677
5670
  json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
5678
5671
  e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
5679
5672
  credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",
5673
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
5680
5674
  iban: "IBAN",
5681
5675
  jwt: "JWT",
5682
5676
  template_literal: "\u0443\u0432\u043E\u0434"
@@ -5795,6 +5789,7 @@ var error4 = () => {
5795
5789
  json_string: "JSON \u043D\u0438\u0437",
5796
5790
  e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
5797
5791
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",
5792
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
5798
5793
  iban: "IBAN",
5799
5794
  jwt: "JWT",
5800
5795
  template_literal: "\u0432\u0445\u043E\u0434"
@@ -5920,6 +5915,7 @@ var error5 = () => {
5920
5915
  json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",
5921
5916
  e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",
5922
5917
  credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",
5918
+ currency_code: "\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",
5923
5919
  iban: "IBAN",
5924
5920
  jwt: "JWT",
5925
5921
  template_literal: "\u0987\u09A8\u09AA\u09C1\u099F"
@@ -6033,6 +6029,7 @@ var error6 = () => {
6033
6029
  json_string: "cadena JSON",
6034
6030
  e164: "n\xFAmero E.164",
6035
6031
  credit_card: "n\xFAmero de targeta de cr\xE8dit",
6032
+ currency_code: "codi de moneda",
6036
6033
  iban: "IBAN",
6037
6034
  jwt: "JWT",
6038
6035
  template_literal: "entrada"
@@ -6146,6 +6143,7 @@ var error7 = () => {
6146
6143
  json_string: "\u062F\u06D5\u0642\u06CC JSON",
6147
6144
  e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",
6148
6145
  credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",
6146
+ currency_code: "\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",
6149
6147
  iban: "IBAN",
6150
6148
  jwt: "JWT",
6151
6149
  template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5"
@@ -6278,6 +6276,7 @@ var error8 = () => {
6278
6276
  json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
6279
6277
  e164: "\u010D\xEDslo E.164",
6280
6278
  credit_card: "\u010D\xEDslo kreditn\xED karty",
6279
+ currency_code: "k\xF3d m\u011Bny",
6281
6280
  iban: "IBAN",
6282
6281
  jwt: "JWT",
6283
6282
  template_literal: "vstup"
@@ -6394,6 +6393,7 @@ var error9 = () => {
6394
6393
  json_string: "JSON-streng",
6395
6394
  e164: "E.164-nummer",
6396
6395
  credit_card: "kreditkortnummer",
6396
+ currency_code: "valutakode",
6397
6397
  iban: "IBAN",
6398
6398
  jwt: "JWT",
6399
6399
  template_literal: "input"
@@ -6514,6 +6514,7 @@ var error10 = () => {
6514
6514
  json_string: "JSON-String",
6515
6515
  e164: "E.164-Nummer",
6516
6516
  credit_card: "Kreditkartennummer",
6517
+ currency_code: "W\xE4hrungscode",
6517
6518
  iban: "IBAN",
6518
6519
  jwt: "JWT",
6519
6520
  template_literal: "Eingabe"
@@ -6627,6 +6628,7 @@ var error11 = () => {
6627
6628
  json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",
6628
6629
  e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",
6629
6630
  credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",
6631
+ currency_code: "\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",
6630
6632
  iban: "IBAN",
6631
6633
  jwt: "JWT",
6632
6634
  template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"
@@ -6738,6 +6740,7 @@ var error12 = () => {
6738
6740
  base64url: "base64url-encoded string",
6739
6741
  json_string: "JSON string",
6740
6742
  e164: "E.164 number",
6743
+ currency_code: "currency code",
6741
6744
  credit_card: "credit card number",
6742
6745
  iban: "IBAN",
6743
6746
  jwt: "JWT",
@@ -6863,6 +6866,7 @@ var error13 = () => {
6863
6866
  json_string: "JSON-karaktraro",
6864
6867
  e164: "E.164-nombro",
6865
6868
  credit_card: "kreditkarta numero",
6869
+ currency_code: "valuta kodo",
6866
6870
  iban: "IBAN",
6867
6871
  jwt: "JWT",
6868
6872
  template_literal: "enigo"
@@ -6976,6 +6980,7 @@ var error14 = () => {
6976
6980
  json_string: "cadena JSON",
6977
6981
  e164: "n\xFAmero E.164",
6978
6982
  credit_card: "n\xFAmero de tarjeta de cr\xE9dito",
6983
+ currency_code: "c\xF3digo de moneda",
6979
6984
  iban: "IBAN",
6980
6985
  jwt: "JWT",
6981
6986
  template_literal: "entrada"
@@ -7113,6 +7118,7 @@ var error15 = () => {
7113
7118
  json_string: "JSON \u0631\u0634\u062A\u0647",
7114
7119
  e164: "E.164 \u0639\u062F\u062F",
7115
7120
  credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",
7121
+ currency_code: "\u06A9\u062F \u0627\u0631\u0632",
7116
7122
  iban: "IBAN",
7117
7123
  jwt: "JWT",
7118
7124
  template_literal: "\u0648\u0631\u0648\u062F\u06CC"
@@ -7236,6 +7242,7 @@ var error16 = () => {
7236
7242
  json_string: "JSON-merkkijono",
7237
7243
  e164: "E.164-luku",
7238
7244
  credit_card: "luottokortin numero",
7245
+ currency_code: "valuuttakoodi",
7239
7246
  iban: "IBAN",
7240
7247
  jwt: "JWT",
7241
7248
  template_literal: "templaattimerkkijono"
@@ -7348,6 +7355,7 @@ var error17 = () => {
7348
7355
  json_string: "cha\xEEne de caract\xE8res JSON",
7349
7356
  e164: "num\xE9ro au format E.164",
7350
7357
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7358
+ currency_code: "code de devise",
7351
7359
  iban: "IBAN",
7352
7360
  jwt: "JWT",
7353
7361
  template_literal: "entr\xE9e"
@@ -7478,6 +7486,7 @@ var error18 = () => {
7478
7486
  json_string: "cha\xEEne JSON",
7479
7487
  e164: "num\xE9ro E.164",
7480
7488
  credit_card: "num\xE9ro de carte de cr\xE9dit",
7489
+ currency_code: "code de devise",
7481
7490
  iban: "IBAN",
7482
7491
  jwt: "JWT",
7483
7492
  template_literal: "entr\xE9e"
@@ -7590,6 +7599,7 @@ var error19 = () => {
7590
7599
  json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",
7591
7600
  e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0",
7592
7601
  credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",
7602
+ currency_code: "\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",
7593
7603
  iban: "IBAN",
7594
7604
  jwt: "JWT",
7595
7605
  template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"
@@ -7739,6 +7749,7 @@ var error20 = () => {
7739
7749
  json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
7740
7750
  e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
7741
7751
  credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" },
7752
+ currency_code: { label: "\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2", gender: "m" },
7742
7753
  iban: { label: "IBAN", gender: "m" },
7743
7754
  jwt: { label: "JWT", gender: "m" },
7744
7755
  template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" },
@@ -7904,6 +7915,7 @@ var error21 = () => {
7904
7915
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",
7905
7916
  e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E",
7906
7917
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",
7918
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
7907
7919
  iban: "IBAN",
7908
7920
  jwt: "JWT",
7909
7921
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
@@ -8014,6 +8026,7 @@ var error22 = () => {
8014
8026
  json_string: "JSON tekst",
8015
8027
  e164: "E.164 broj",
8016
8028
  credit_card: "broj kreditne kartice",
8029
+ currency_code: "kod valute",
8017
8030
  iban: "IBAN",
8018
8031
  jwt: "JWT",
8019
8032
  template_literal: "unos"
@@ -8141,6 +8154,7 @@ var error23 = () => {
8141
8154
  json_string: "JSON string",
8142
8155
  e164: "E.164 sz\xE1m",
8143
8156
  credit_card: "hitelk\xE1rtyasz\xE1m",
8157
+ currency_code: "p\xE9nznemk\xF3d",
8144
8158
  iban: "IBAN",
8145
8159
  jwt: "JWT",
8146
8160
  template_literal: "bemenet"
@@ -8294,6 +8308,7 @@ var error24 = () => {
8294
8308
  json_string: "JSON \u057F\u0578\u0572",
8295
8309
  e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
8296
8310
  credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",
8311
+ currency_code: "\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",
8297
8312
  iban: "IBAN",
8298
8313
  jwt: "JWT",
8299
8314
  template_literal: "\u0574\u0578\u0582\u057F\u0584"
@@ -8412,6 +8427,7 @@ var error25 = () => {
8412
8427
  json_string: "string JSON",
8413
8428
  e164: "angka E.164",
8414
8429
  credit_card: "nomor kartu kredit",
8430
+ currency_code: "kode mata uang",
8415
8431
  iban: "IBAN",
8416
8432
  jwt: "JWT",
8417
8433
  template_literal: "input"
@@ -8523,6 +8539,7 @@ var error26 = () => {
8523
8539
  json_string: "JSON strengur",
8524
8540
  e164: "E.164 t\xF6lugildi",
8525
8541
  credit_card: "kreditkortan\xFAmer",
8542
+ currency_code: "gjaldmi\xF0ilsk\xF3\xF0i",
8526
8543
  iban: "IBAN",
8527
8544
  jwt: "JWT",
8528
8545
  template_literal: "gildi"
@@ -8637,6 +8654,7 @@ var error27 = () => {
8637
8654
  json_string: "stringa JSON",
8638
8655
  e164: "numero E.164",
8639
8656
  credit_card: "numero di carta di credito",
8657
+ currency_code: "codice valuta",
8640
8658
  iban: "IBAN",
8641
8659
  jwt: "JWT",
8642
8660
  template_literal: "input"
@@ -8750,6 +8768,7 @@ var error28 = () => {
8750
8768
  json_string: "JSON\u6587\u5B57\u5217",
8751
8769
  e164: "E.164\u756A\u53F7",
8752
8770
  credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",
8771
+ currency_code: "\u901A\u8CA8\u30B3\u30FC\u30C9",
8753
8772
  iban: "IBAN",
8754
8773
  jwt: "JWT",
8755
8774
  template_literal: "\u5165\u529B\u5024"
@@ -8862,6 +8881,7 @@ var error29 = () => {
8862
8881
  json_string: "JSON \u10D5\u10D4\u10DA\u10D8",
8863
8882
  e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
8864
8883
  credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
8884
+ currency_code: "\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",
8865
8885
  iban: "IBAN",
8866
8886
  jwt: "JWT",
8867
8887
  template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
@@ -8979,6 +8999,7 @@ var error30 = () => {
8979
8999
  json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
8980
9000
  e164: "\u179B\u17C1\u1781 E.164",
8981
9001
  credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",
9002
+ currency_code: "\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",
8982
9003
  iban: "IBAN",
8983
9004
  jwt: "JWT",
8984
9005
  template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
@@ -9099,6 +9120,7 @@ var error31 = () => {
9099
9120
  json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",
9100
9121
  e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
9101
9122
  credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",
9123
+ currency_code: "\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",
9102
9124
  iban: "IBAN",
9103
9125
  jwt: "JWT",
9104
9126
  template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"
@@ -9214,6 +9236,7 @@ var error32 = () => {
9214
9236
  json_string: "JSON \uBB38\uC790\uC5F4",
9215
9237
  e164: "E.164 \uBC88\uD638",
9216
9238
  credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",
9239
+ currency_code: "\uD1B5\uD654 \uCF54\uB4DC",
9217
9240
  iban: "IBAN",
9218
9241
  jwt: "JWT",
9219
9242
  template_literal: "\uC785\uB825"
@@ -9412,6 +9435,7 @@ var error33 = () => {
9412
9435
  json_string: "JSON eilut\u0117",
9413
9436
  e164: "E.164 numeris",
9414
9437
  credit_card: "kredito kortel\u0117s numeris",
9438
+ currency_code: "valiutos kodas",
9415
9439
  iban: "IBAN",
9416
9440
  jwt: "JWT",
9417
9441
  template_literal: "\u012Fvestis"
@@ -9537,6 +9561,7 @@ var error34 = () => {
9537
9561
  json_string: "JSON \u043D\u0438\u0437\u0430",
9538
9562
  e164: "E.164 \u0431\u0440\u043E\u0458",
9539
9563
  credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",
9564
+ currency_code: "\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",
9540
9565
  iban: "IBAN",
9541
9566
  jwt: "JWT",
9542
9567
  template_literal: "\u0432\u043D\u0435\u0441"
@@ -9651,6 +9676,7 @@ var error35 = () => {
9651
9676
  json_string: "string JSON",
9652
9677
  e164: "nombor E.164",
9653
9678
  credit_card: "nombor kad kredit",
9679
+ currency_code: "kod mata wang",
9654
9680
  iban: "IBAN",
9655
9681
  jwt: "JWT",
9656
9682
  template_literal: "input"
@@ -9763,6 +9789,7 @@ var error36 = () => {
9763
9789
  json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",
9764
9790
  e164: "E.164 \u0928\u092E\u094D\u092C\u0930",
9765
9791
  credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",
9792
+ currency_code: "\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",
9766
9793
  iban: "IBAN",
9767
9794
  jwt: "JWT",
9768
9795
  template_literal: "\u0907\u0928\u092A\u0941\u091F"
@@ -9874,6 +9901,7 @@ var error37 = () => {
9874
9901
  json_string: "JSON string",
9875
9902
  e164: "E.164-nummer",
9876
9903
  credit_card: "creditcardnummer",
9904
+ currency_code: "valutacode",
9877
9905
  iban: "IBAN",
9878
9906
  jwt: "JWT",
9879
9907
  template_literal: "invoer"
@@ -9989,6 +10017,7 @@ var error38 = () => {
9989
10017
  json_string: "JSON-streng",
9990
10018
  e164: "E.164-nummer",
9991
10019
  credit_card: "kredittkortnummer",
10020
+ currency_code: "valutakode",
9992
10021
  iban: "IBAN",
9993
10022
  jwt: "JWT",
9994
10023
  template_literal: "input"
@@ -10102,6 +10131,7 @@ var error39 = () => {
10102
10131
  json_string: "JSON-streng",
10103
10132
  e164: "E.164-nummer",
10104
10133
  credit_card: "kredittkortnummer",
10134
+ currency_code: "valutakode",
10105
10135
  iban: "IBAN",
10106
10136
  jwt: "JWT",
10107
10137
  template_literal: "input"
@@ -10215,6 +10245,7 @@ var error40 = () => {
10215
10245
  json_string: "JSON metin",
10216
10246
  e164: "E.164 say\u0131s\u0131",
10217
10247
  credit_card: "i'tib\xE2r kart\u0131 numaras\u0131",
10248
+ currency_code: "para birimi kodu",
10218
10249
  iban: "IBAN",
10219
10250
  jwt: "JWT",
10220
10251
  template_literal: "giren"
@@ -10329,6 +10360,7 @@ var error41 = () => {
10329
10360
  json_string: "JSON \u0645\u062A\u0646",
10330
10361
  e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
10331
10362
  credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",
10363
+ currency_code: "\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",
10332
10364
  iban: "IBAN",
10333
10365
  jwt: "JWT",
10334
10366
  template_literal: "\u0648\u0631\u0648\u062F\u064A"
@@ -10448,6 +10480,7 @@ var error42 = () => {
10448
10480
  json_string: "ci\u0105g znak\xF3w w formacie JSON",
10449
10481
  e164: "liczba E.164",
10450
10482
  credit_card: "numer karty kredytowej",
10483
+ currency_code: "kod waluty",
10451
10484
  iban: "IBAN",
10452
10485
  jwt: "JWT",
10453
10486
  template_literal: "wej\u015Bcie"
@@ -10562,6 +10595,7 @@ var error43 = () => {
10562
10595
  json_string: "o texto JSON",
10563
10596
  e164: "o n\xFAmero E.164",
10564
10597
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10598
+ currency_code: "o c\xF3digo de moeda",
10565
10599
  iban: "o IBAN",
10566
10600
  jwt: "o JWT",
10567
10601
  template_literal: "a entrada"
@@ -10705,6 +10739,7 @@ var error44 = () => {
10705
10739
  json_string: "o texto JSON",
10706
10740
  e164: "o n\xFAmero E.164",
10707
10741
  credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito",
10742
+ currency_code: "o c\xF3digo de moeda",
10708
10743
  iban: "o IBAN",
10709
10744
  jwt: "o JWT",
10710
10745
  template_literal: "a entrada"
@@ -10849,6 +10884,7 @@ var error45 = () => {
10849
10884
  json_string: "\u0219ir JSON",
10850
10885
  e164: "num\u0103r E.164",
10851
10886
  credit_card: "num\u0103r de card de credit",
10887
+ currency_code: "cod valutar",
10852
10888
  iban: "IBAN",
10853
10889
  jwt: "JWT",
10854
10890
  template_literal: "intrare"
@@ -11021,6 +11057,7 @@ var error46 = () => {
11021
11057
  json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
11022
11058
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
11023
11059
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",
11060
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",
11024
11061
  iban: "IBAN",
11025
11062
  jwt: "JWT",
11026
11063
  template_literal: "\u0432\u0432\u043E\u0434"
@@ -11139,6 +11176,7 @@ var error47 = () => {
11139
11176
  json_string: "re\u0165azec vo form\xE1te JSON",
11140
11177
  e164: "\u010D\xEDslo E.164",
11141
11178
  credit_card: "\u010D\xEDslo kreditnej karty",
11179
+ currency_code: "k\xF3d meny",
11142
11180
  iban: "IBAN",
11143
11181
  jwt: "JWT",
11144
11182
  template_literal: "vstup"
@@ -11255,6 +11293,7 @@ var error48 = () => {
11255
11293
  json_string: "JSON niz",
11256
11294
  e164: "E.164 \u0161tevilka",
11257
11295
  credit_card: "\u0161tevilka kreditne kartice",
11296
+ currency_code: "koda valute",
11258
11297
  iban: "IBAN",
11259
11298
  jwt: "JWT",
11260
11299
  template_literal: "vnos"
@@ -11369,6 +11408,7 @@ var error49 = () => {
11369
11408
  json_string: "JSON-str\xE4ng",
11370
11409
  e164: "E.164-nummer",
11371
11410
  credit_card: "kreditkortsnummer",
11411
+ currency_code: "valutakod",
11372
11412
  iban: "IBAN",
11373
11413
  jwt: "JWT",
11374
11414
  template_literal: "mall-literal"
@@ -11484,6 +11524,7 @@ var error50 = () => {
11484
11524
  json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
11485
11525
  e164: "E.164 \u0B8E\u0BA3\u0BCD",
11486
11526
  credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",
11527
+ currency_code: "\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",
11487
11528
  iban: "IBAN",
11488
11529
  jwt: "JWT",
11489
11530
  template_literal: "input"
@@ -11599,6 +11640,7 @@ var error51 = () => {
11599
11640
  json_string: "\u0441\u0430\u0442\u0440\u0438 JSON",
11600
11641
  e164: "\u0440\u0430\u049B\u0430\u043C\u0438 E.164",
11601
11642
  credit_card: "\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",
11643
+ currency_code: "\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",
11602
11644
  iban: "IBAN",
11603
11645
  jwt: "JWT",
11604
11646
  template_literal: "\u0432\u0443\u0440\u0443\u0434"
@@ -11715,6 +11757,7 @@ var error52 = () => {
11715
11757
  json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
11716
11758
  e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
11717
11759
  credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",
11760
+ currency_code: "\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",
11718
11761
  iban: "IBAN",
11719
11762
  jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
11720
11763
  template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
@@ -11830,6 +11873,7 @@ var error53 = () => {
11830
11873
  json_string: "JSON setiri",
11831
11874
  e164: "E.164 nomeri",
11832
11875
  credit_card: "kredit kartyny\u0148 nomeri",
11876
+ currency_code: "wal\xFDuta kody",
11833
11877
  iban: "IBAN",
11834
11878
  jwt: "JWT",
11835
11879
  template_literal: "\u015Fablon"
@@ -11937,6 +11981,7 @@ var error54 = () => {
11937
11981
  json_string: "JSON dizesi",
11938
11982
  e164: "E.164 say\u0131s\u0131",
11939
11983
  credit_card: "kredi kart\u0131 numaras\u0131",
11984
+ currency_code: "para birimi kodu",
11940
11985
  iban: "IBAN",
11941
11986
  jwt: "JWT",
11942
11987
  template_literal: "\u015Eablon dizesi"
@@ -12047,6 +12092,7 @@ var error55 = () => {
12047
12092
  json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
12048
12093
  e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
12049
12094
  credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",
12095
+ currency_code: "\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",
12050
12096
  iban: "IBAN",
12051
12097
  jwt: "JWT",
12052
12098
  template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
@@ -12165,6 +12211,7 @@ var error56 = () => {
12165
12211
  json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
12166
12212
  e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
12167
12213
  credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",
12214
+ currency_code: "\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",
12168
12215
  iban: "IBAN",
12169
12216
  jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
12170
12217
  template_literal: "\u0627\u0646 \u067E\u0679"
@@ -12280,6 +12327,7 @@ var error57 = () => {
12280
12327
  json_string: "JSON satr",
12281
12328
  e164: "E.164 raqam",
12282
12329
  credit_card: "kredit karta raqami",
12330
+ currency_code: "valyuta kodi",
12283
12331
  iban: "IBAN",
12284
12332
  jwt: "JWT",
12285
12333
  template_literal: "kirish"
@@ -12393,6 +12441,7 @@ var error58 = () => {
12393
12441
  json_string: "chu\u1ED7i JSON",
12394
12442
  e164: "s\u1ED1 E.164",
12395
12443
  credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",
12444
+ currency_code: "m\xE3 ti\u1EC1n t\u1EC7",
12396
12445
  iban: "IBAN",
12397
12446
  jwt: "JWT",
12398
12447
  template_literal: "\u0111\u1EA7u v\xE0o"
@@ -12506,6 +12555,7 @@ var error59 = () => {
12506
12555
  json_string: "JSON\u5B57\u7B26\u4E32",
12507
12556
  e164: "E.164\u53F7\u7801",
12508
12557
  credit_card: "\u4FE1\u7528\u5361\u53F7",
12558
+ currency_code: "\u8D27\u5E01\u4EE3\u7801",
12509
12559
  iban: "IBAN",
12510
12560
  jwt: "JWT",
12511
12561
  template_literal: "\u8F93\u5165"
@@ -12620,6 +12670,7 @@ var error60 = () => {
12620
12670
  json_string: "JSON \u5B57\u4E32",
12621
12671
  e164: "E.164 \u6578\u503C",
12622
12672
  credit_card: "\u4FE1\u7528\u5361\u865F",
12673
+ currency_code: "\u8CA8\u5E63\u4EE3\u78BC",
12623
12674
  iban: "IBAN",
12624
12675
  jwt: "JWT",
12625
12676
  template_literal: "\u8F38\u5165"
@@ -12732,6 +12783,7 @@ var error61 = () => {
12732
12783
  json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
12733
12784
  e164: "n\u1ECD\u0301mb\xE0 E.164",
12734
12785
  credit_card: "n\u1ECDmba kaadi gbese",
12786
+ currency_code: "koodu ow\xF3",
12735
12787
  iban: "IBAN",
12736
12788
  jwt: "JWT",
12737
12789
  template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
@@ -13110,7 +13162,7 @@ function generateChecks(doc, ctx, schema, accessor) {
13110
13162
  generatePropertyCheck(doc, ctx, def, currentAccessor);
13111
13163
  break;
13112
13164
  case "properties":
13113
- generatePropertiesChecks(doc, ctx, def, currentAccessor, false);
13165
+ generatePropertiesChecks(doc, ctx, def, currentAccessor);
13114
13166
  break;
13115
13167
  case "overwrite": {
13116
13168
  const newAccessor = newVar(ctx);
@@ -13220,11 +13272,11 @@ function generateMimeTypeCheck(doc, ctx, def, accessor) {
13220
13272
  doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`);
13221
13273
  }
13222
13274
  }
13223
- function generatePropertiesChecks(doc, ctx, def, accessor, schemaRole) {
13275
+ function generatePropertiesChecks(doc, ctx, def, accessor) {
13224
13276
  if (def.when) {
13225
13277
  throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
13226
13278
  }
13227
- doc.write(schemaRole ? `if (${accessor} === null || (typeof ${accessor} !== "object" && typeof ${accessor} !== "function")) return INVALID;` : `if (${accessor} == null) return INVALID;`);
13279
+ doc.write(`if (${accessor} == null) return INVALID;`);
13228
13280
  const shape = def.shape;
13229
13281
  for (const key of Reflect.ownKeys(shape)) {
13230
13282
  const keyExpr = typeof key === "symbol" ? addConstant(ctx, key) : esc(key);
@@ -13314,7 +13366,7 @@ var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([
13314
13366
  "uuid",
13315
13367
  "xid"
13316
13368
  ]);
13317
- function generateStringFormatCheck(doc, ctx, def, accessor) {
13369
+ function generateStringFormatCheck(doc, ctx, def, accessor, needsValue = true) {
13318
13370
  const fmt = def.format;
13319
13371
  if (fmt === "base64") {
13320
13372
  const validator = addConstant(ctx, isValidBase64);
@@ -13354,7 +13406,7 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
13354
13406
  }
13355
13407
  const formatDef = def;
13356
13408
  if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) {
13357
- const parseConst = addConstant(ctx, parseURLObject);
13409
+ const parseConst = addConstant(ctx, validateURL);
13358
13410
  const defConst = addConstant(ctx, def);
13359
13411
  const trimVar = newVar(ctx);
13360
13412
  const urlVar = newVar(ctx);
@@ -13369,6 +13421,8 @@ function generateStringFormatCheck(doc, ctx, def, accessor) {
13369
13421
  const protocolConst = addConstant(ctx, urlProtocolOk);
13370
13422
  doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`);
13371
13423
  }
13424
+ if (!needsValue)
13425
+ return null;
13372
13426
  const outputVar = newVar(ctx);
13373
13427
  const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`;
13374
13428
  doc.write(`const ${outputVar} = ${outputExpr};`);
@@ -13428,7 +13482,7 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13428
13482
  let typeAccessor;
13429
13483
  switch (type) {
13430
13484
  case "string":
13431
- typeAccessor = generateStringCheck(doc, ctx, schema, accessor);
13485
+ typeAccessor = generateStringCheck(doc, ctx, schema, accessor, buildsValue);
13432
13486
  break;
13433
13487
  case "number":
13434
13488
  typeAccessor = generateNumberCheck(doc, schema, accessor);
@@ -13534,10 +13588,6 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13534
13588
  case "custom":
13535
13589
  typeAccessor = generateCustomCheck(doc, ctx, schema, accessor);
13536
13590
  break;
13537
- case "properties":
13538
- generatePropertiesChecks(doc, ctx, schema._zod.def, accessor, true);
13539
- typeAccessor = accessor;
13540
- break;
13541
13591
  case "transform":
13542
13592
  typeAccessor = generateTransformCheck(doc, ctx, schema, accessor);
13543
13593
  break;
@@ -13553,12 +13603,12 @@ function generateCheck(doc, ctx, schema, accessor, needsValue = true) {
13553
13603
  return null;
13554
13604
  return generateChecks(doc, ctx, schema, typeAccessor);
13555
13605
  }
13556
- function generateStringCheck(doc, ctx, schema, accessor) {
13606
+ function generateStringCheck(doc, ctx, schema, accessor, needsValue = true) {
13557
13607
  doc.write(`if (typeof ${accessor} !== "string") return INVALID;`);
13558
13608
  const def = schema._zod.def;
13559
13609
  if (def.format === void 0)
13560
13610
  return accessor;
13561
- return generateStringFormatCheck(doc, ctx, def, accessor);
13611
+ return generateStringFormatCheck(doc, ctx, def, accessor, needsValue);
13562
13612
  }
13563
13613
  function generateNumberCheck(doc, schema, accessor) {
13564
13614
  doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`);
@@ -13676,7 +13726,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
13676
13726
  }
13677
13727
  }
13678
13728
  const outputVar = newVar(ctx);
13679
- const hasConditionalKeys = allKeys.some((k) => mayOutputUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
13729
+ const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
13680
13730
  if (!buildsValue) {
13681
13731
  if (unknownKeysMode === "schema") {
13682
13732
  const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null;
@@ -13703,7 +13753,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
13703
13753
  const out = propOutputs.get(k);
13704
13754
  if (dropsWhenAbsent(propShape[k])) {
13705
13755
  doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
13706
- } else if (mayOutputUndefined(propShape[k])) {
13756
+ } else if (mayOmitUndefined(propShape[k])) {
13707
13757
  doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`);
13708
13758
  } else {
13709
13759
  doc.write(`${outputVar}[${kx}] = ${out};`);
@@ -13836,6 +13886,9 @@ function fastPathAcceptsAbsence(schema) {
13836
13886
  function dropsWhenAbsent(schema) {
13837
13887
  return schema._zod.optin === "optional" && schema._zod.optout === "optional";
13838
13888
  }
13889
+ function mayOmitUndefined(schema) {
13890
+ return (schema._zod.optin !== "defaulted" || schema._zod.optout === "optional") && mayOutputUndefined(schema);
13891
+ }
13839
13892
  function mayOutputUndefined(schema) {
13840
13893
  const def = schema._zod.def;
13841
13894
  switch (def.type) {
@@ -14455,20 +14508,18 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
14455
14508
  }
14456
14509
 
14457
14510
  // ../../node_modules/zod/v4/core/api.js
14511
+ function snapshotChecks(def) {
14512
+ if (def.checks)
14513
+ def.checks = [...def.checks];
14514
+ return def;
14515
+ }
14458
14516
  // @__NO_SIDE_EFFECTS__
14459
14517
  function _string(Class2, params) {
14460
- return new Class2({
14461
- type: "string",
14462
- ...normalizeParams(params)
14463
- });
14518
+ return new Class2(snapshotChecks({ type: "string", ...normalizeParams(params) }));
14464
14519
  }
14465
14520
  // @__NO_SIDE_EFFECTS__
14466
14521
  function _coercedString(Class2, params) {
14467
- return new Class2({
14468
- type: "string",
14469
- coerce: true,
14470
- ...normalizeParams(params)
14471
- });
14522
+ return new Class2(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
14472
14523
  }
14473
14524
  // @__NO_SIDE_EFFECTS__
14474
14525
  function _email(Class2, params) {
@@ -14772,20 +14823,11 @@ function _isoDuration(Class2, params) {
14772
14823
  }
14773
14824
  // @__NO_SIDE_EFFECTS__
14774
14825
  function _number(Class2, params) {
14775
- return new Class2({
14776
- type: "number",
14777
- checks: [],
14778
- ...normalizeParams(params)
14779
- });
14826
+ return new Class2(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
14780
14827
  }
14781
14828
  // @__NO_SIDE_EFFECTS__
14782
14829
  function _coercedNumber(Class2, params) {
14783
- return new Class2({
14784
- type: "number",
14785
- coerce: true,
14786
- checks: [],
14787
- ...normalizeParams(params)
14788
- });
14830
+ return new Class2(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
14789
14831
  }
14790
14832
  // @__NO_SIDE_EFFECTS__
14791
14833
  function _int(Class2, params) {
@@ -15127,9 +15169,8 @@ function _property(property, schema, params) {
15127
15169
  });
15128
15170
  }
15129
15171
  // @__NO_SIDE_EFFECTS__
15130
- function _properties(Class2, shape, params) {
15131
- return new Class2({
15132
- type: "properties",
15172
+ function _properties(shape, params) {
15173
+ return new $ZodCheckProperties({
15133
15174
  check: "properties",
15134
15175
  shape,
15135
15176
  ...normalizeParams(params)
@@ -15764,11 +15805,11 @@ function foldObjects(members2) {
15764
15805
  }
15765
15806
  objects.push(member);
15766
15807
  }
15767
- const properties2 = {};
15808
+ const properties = {};
15768
15809
  const required2 = /* @__PURE__ */ new Set();
15769
15810
  for (const object2 of objects) {
15770
15811
  for (const key in object2.properties) {
15771
- if (Object.prototype.hasOwnProperty.call(properties2, key))
15812
+ if (Object.prototype.hasOwnProperty.call(properties, key))
15772
15813
  continue;
15773
15814
  const parts = [];
15774
15815
  for (const other of objects) {
@@ -15779,12 +15820,12 @@ function foldObjects(members2) {
15779
15820
  parts.push(part);
15780
15821
  }
15781
15822
  const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
15782
- assignProp(properties2, key, merged);
15823
+ assignProp(properties, key, merged);
15783
15824
  }
15784
15825
  for (const key of object2.required ?? [])
15785
15826
  required2.add(key);
15786
15827
  }
15787
- const folded = { type: "object", properties: properties2 };
15828
+ const folded = { type: "object", properties };
15788
15829
  if (required2.size)
15789
15830
  folded.required = [...required2];
15790
15831
  if (objects.every((object2) => object2.additionalProperties === false)) {
@@ -16406,17 +16447,15 @@ var objectProcessor = (schema, ctx, _json, params) => {
16406
16447
  path: [...params.path, "properties", key]
16407
16448
  }));
16408
16449
  }
16409
- const allKeys = new Set(Object.keys(shape));
16410
- const requiredKeys = new Set([...allKeys].filter((key) => {
16450
+ const requiredKeys = [];
16451
+ for (const key of Object.keys(shape)) {
16411
16452
  const field = def.shape[key];
16412
- if (ctx.io === "input") {
16413
- return inputOptin(field) === void 0;
16414
- } else {
16415
- return field._zod.optout === void 0;
16453
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
16454
+ requiredKeys.push(key);
16416
16455
  }
16417
- }));
16418
- if (requiredKeys.size > 0) {
16419
- json2.required = Array.from(requiredKeys);
16456
+ }
16457
+ if (requiredKeys.length > 0) {
16458
+ json2.required = requiredKeys;
16420
16459
  }
16421
16460
  if (def.catchall?._zod.def.type === "never") {
16422
16461
  json2.additionalProperties = false;
@@ -16430,31 +16469,6 @@ var objectProcessor = (schema, ctx, _json, params) => {
16430
16469
  });
16431
16470
  }
16432
16471
  };
16433
- var propertiesProcessor = (schema, ctx, _json, params) => {
16434
- const json2 = _json;
16435
- const def = schema._zod.def;
16436
- if (Object.getOwnPropertySymbols(def.shape).length && handleUnrepresentable(schema, ctx, json2, params, "Symbol keys cannot be represented in JSON Schema")) {
16437
- return;
16438
- }
16439
- if (ctx.io === "output") {
16440
- for (const key in def.shape) {
16441
- if (isTransforming(def.shape[key]) && handleUnrepresentable(schema, ctx, json2, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
16442
- return;
16443
- }
16444
- }
16445
- }
16446
- json2.type = "object";
16447
- json2.properties = {};
16448
- for (const key in def.shape) {
16449
- assignProp(json2.properties, key, processSchema(def.shape[key], ctx, {
16450
- ...params,
16451
- path: [...params.path, "properties", key]
16452
- }));
16453
- }
16454
- const required2 = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === void 0);
16455
- if (required2.length > 0)
16456
- json2.required = required2;
16457
- };
16458
16472
  var unionProcessor = (schema, ctx, json2, params) => {
16459
16473
  const def = schema._zod.def;
16460
16474
  const isExclusive = def.inclusive === false;
@@ -16774,7 +16788,6 @@ var allProcessors = {
16774
16788
  file: fileProcessor,
16775
16789
  success: successProcessor,
16776
16790
  custom: customProcessor,
16777
- properties: propertiesProcessor,
16778
16791
  function: functionProcessor,
16779
16792
  transform: transformProcessor,
16780
16793
  map: mapProcessor,
@@ -16971,7 +16984,6 @@ __export(schemas_exports2, {
16971
16984
  ZodPrefault: () => ZodPrefault,
16972
16985
  ZodPreprocess: () => ZodPreprocess,
16973
16986
  ZodPromise: () => ZodPromise,
16974
- ZodProperties: () => ZodProperties,
16975
16987
  ZodReadonly: () => ZodReadonly,
16976
16988
  ZodRecord: () => ZodRecord,
16977
16989
  ZodSet: () => ZodSet,
@@ -17009,6 +17021,7 @@ __export(schemas_exports2, {
17009
17021
  creditCard: () => creditCard2,
17010
17022
  cuid: () => cuid3,
17011
17023
  cuid2: () => cuid22,
17024
+ currencyCode: () => currencyCode2,
17012
17025
  custom: () => custom,
17013
17026
  date: () => date2,
17014
17027
  describe: () => describe2,
@@ -17063,7 +17076,6 @@ __export(schemas_exports2, {
17063
17076
  prefault: () => prefault,
17064
17077
  preprocess: () => preprocess,
17065
17078
  promise: () => promise,
17066
- properties: () => properties,
17067
17079
  readonly: () => readonly,
17068
17080
  record: () => record,
17069
17081
  refine: () => refine,
@@ -17117,6 +17129,7 @@ __export(checks_exports2, {
17117
17129
  normalize: () => _normalize,
17118
17130
  overwrite: () => _overwrite,
17119
17131
  positive: () => _positive,
17132
+ properties: () => _properties,
17120
17133
  property: () => _property,
17121
17134
  regex: () => _regex,
17122
17135
  size: () => _size,
@@ -17576,8 +17589,8 @@ function url(params) {
17576
17589
  }
17577
17590
  function httpUrl(params) {
17578
17591
  return _url(ZodURL, {
17579
- protocol: regexes_exports.httpProtocol,
17580
- hostname: regexes_exports.domain,
17592
+ protocol: httpProtocol,
17593
+ hostname: domain,
17581
17594
  ...util_exports.normalizeParams(params)
17582
17595
  });
17583
17596
  }
@@ -17715,10 +17728,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
17715
17728
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
17716
17729
  }
17717
17730
  function hostname2(_params) {
17718
- return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
17731
+ return _stringFormat(ZodCustomStringFormat, "hostname", hostname, _params);
17719
17732
  }
17720
17733
  function hex2(_params) {
17721
- return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
17734
+ return _stringFormat(ZodCustomStringFormat, "hex", hex, _params);
17735
+ }
17736
+ function currencyCode2(_params) {
17737
+ return _stringFormat(ZodCustomStringFormat, "currency_code", currencyCode, _params);
17722
17738
  }
17723
17739
  function hash(alg, params) {
17724
17740
  const enc = params?.enc ?? "hex";
@@ -18583,14 +18599,6 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
18583
18599
  ZodType.init(inst, def);
18584
18600
  inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
18585
18601
  });
18586
- var ZodProperties = /* @__PURE__ */ $constructor("ZodProperties", (inst, def) => {
18587
- _ensureDefaultMemoizer();
18588
- $ZodProperties.init(inst, def);
18589
- ZodType.init(inst, def);
18590
- });
18591
- function properties(shape, params) {
18592
- return _properties(ZodProperties, shape, params);
18593
- }
18594
18602
  function check(fn) {
18595
18603
  const ch = new $ZodCheck({
18596
18604
  check: "custom"
@@ -18614,7 +18622,7 @@ var ZodInstanceOf = /* @__PURE__ */ $constructor("ZodInstanceOf", (inst, def) =>
18614
18622
  ZodCustom.init(inst, def);
18615
18623
  }, {
18616
18624
  properties(shape, params) {
18617
- return this.check(properties(shape, params));
18625
+ return this.check(_properties(shape, params));
18618
18626
  }
18619
18627
  });
18620
18628
  function _instanceof(cls, params = {}) {
@@ -19201,10 +19209,10 @@ function convertBaseSchema(schema, ctx) {
19201
19209
  }
19202
19210
  case "object": {
19203
19211
  const shape = {};
19204
- const properties2 = schema.properties || {};
19212
+ const properties = schema.properties || {};
19205
19213
  const requiredSet = new Set(schema.required || []);
19206
19214
  const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0;
19207
- for (const [key, propSchema] of Object.entries(properties2)) {
19215
+ for (const [key, propSchema] of Object.entries(properties)) {
19208
19216
  const propZodSchema = convertSchema(propSchema, ctx);
19209
19217
  assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
19210
19218
  }
@@ -19449,21 +19457,21 @@ function visit(schema, fnOrHandlers) {
19449
19457
  const h = fnOrHandlers[node2._zod.def.type];
19450
19458
  return h ? h(node2, rewritten) : node2;
19451
19459
  };
19452
- const cache2 = /* @__PURE__ */ new Map();
19460
+ const cache = /* @__PURE__ */ new Map();
19453
19461
  function run2(s) {
19454
- const cached2 = cache2.get(s);
19462
+ const cached2 = cache.get(s);
19455
19463
  if (cached2 === RESOLVING) {
19456
19464
  return new $ZodLazy({
19457
19465
  type: "lazy",
19458
- getter: () => cache2.get(s)
19466
+ getter: () => cache.get(s)
19459
19467
  });
19460
19468
  }
19461
19469
  if (cached2 !== void 0)
19462
19470
  return cached2;
19463
- cache2.set(s, RESOLVING);
19471
+ cache.set(s, RESOLVING);
19464
19472
  const inner = mapInner(s);
19465
19473
  const mapped = fn(inner, inner !== s);
19466
- cache2.set(s, mapped);
19474
+ cache.set(s, mapped);
19467
19475
  return mapped;
19468
19476
  }
19469
19477
  function mapInner(s) {
@@ -19565,18 +19573,6 @@ function visit(schema, fnOrHandlers) {
19565
19573
  const { _cachedInner, ...rest } = def;
19566
19574
  return clone(s, { ...rest, getter: () => run2(original()) });
19567
19575
  }
19568
- case "properties": {
19569
- const oldShape = def.shape;
19570
- let changed = false;
19571
- const newShape = {};
19572
- for (const k of Reflect.ownKeys(oldShape)) {
19573
- const mapped = run2(oldShape[k]);
19574
- if (mapped !== oldShape[k])
19575
- changed = true;
19576
- newShape[k] = mapped;
19577
- }
19578
- return changed ? clone(s, { ...def, shape: newShape }) : s;
19579
- }
19580
19576
  // A leaf by choice: `parts` are regex fragments, not data positions.
19581
19577
  case "template_literal":
19582
19578
  // Leaves.
@@ -26549,8 +26545,8 @@ var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
26549
26545
  const codegen_1 = require_codegen();
26550
26546
  const util_1 = require_util();
26551
26547
  function assignDefaults(it, ty) {
26552
- const { properties: properties2, items } = it.schema;
26553
- if (ty === "object" && properties2) for (const key in properties2) assignDefault(it, key, properties2[key].default);
26548
+ const { properties, items } = it.schema;
26549
+ if (ty === "object" && properties) for (const key in properties) assignDefault(it, key, properties[key].default);
26554
26550
  else if (ty === "array" && Array.isArray(items)) items.forEach((sch, i) => assignDefault(it, i, sch.default));
26555
26551
  }
26556
26552
  exports.assignDefaults = assignDefaults;
@@ -26582,8 +26578,8 @@ var require_code = /* @__PURE__ */ __commonJSMin(((exports) => {
26582
26578
  });
26583
26579
  }
26584
26580
  exports.checkReportMissingProp = checkReportMissingProp;
26585
- function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
26586
- return (0, codegen_1.or)(...properties2.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`)));
26581
+ function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
26582
+ return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`)));
26587
26583
  }
26588
26584
  exports.checkMissingProp = checkMissingProp;
26589
26585
  function reportMissingProp(cxt, missing) {
@@ -28624,8 +28620,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
28624
28620
  return this;
28625
28621
  }
28626
28622
  case "object": {
28627
- const cacheKey2 = schemaKeyRef;
28628
- this._cache.delete(cacheKey2);
28623
+ const cacheKey = schemaKeyRef;
28624
+ this._cache.delete(cacheKey);
28629
28625
  let id = schemaKeyRef[this.opts.schemaId];
28630
28626
  if (id) {
28631
28627
  id = (0, resolve_1.normalizeId)(id);
@@ -28768,10 +28764,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
28768
28764
  Ajv2.ValidationError = validation_error_1.default;
28769
28765
  Ajv2.MissingRefError = ref_error_1.default;
28770
28766
  exports.default = Ajv2;
28771
- function checkOptions(checkOpts, options, msg, log = "error") {
28767
+ function checkOptions(checkOpts, options, msg, log2 = "error") {
28772
28768
  for (const key in checkOpts) {
28773
28769
  const opt = key;
28774
- if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
28770
+ if (opt in options) this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
28775
28771
  }
28776
28772
  }
28777
28773
  function getSchEnv(keyRef) {
@@ -29859,10 +29855,10 @@ var require_properties = /* @__PURE__ */ __commonJSMin(((exports) => {
29859
29855
  const allProps = (0, code_1.allSchemaProperties)(schema);
29860
29856
  for (const prop of allProps) it.definedProperties.add(prop);
29861
29857
  if (it.opts.unevaluated && allProps.length && it.props !== true) it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
29862
- const properties2 = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
29863
- if (properties2.length === 0) return;
29858
+ const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
29859
+ if (properties.length === 0) return;
29864
29860
  const valid = gen.name("valid");
29865
- for (const prop of properties2) {
29861
+ for (const prop of properties) {
29866
29862
  if (hasDefault(prop)) applyPropertySchema(prop);
29867
29863
  else {
29868
29864
  gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
@@ -33040,34 +33036,10 @@ var pageSchema = {
33040
33036
  };
33041
33037
 
33042
33038
  // src/runner.ts
33043
- import { AsyncLocalStorage } from "node:async_hooks";
33044
33039
  import { delimiter, join } from "node:path";
33045
33040
  function isGogFileArg(arg) {
33046
33041
  return typeof arg !== "string";
33047
33042
  }
33048
- var RUNNER_TRANSPORT_BRAND = /* @__PURE__ */ Symbol.for("gogcli.RunnerTransportError");
33049
- var RunnerTransportError = class extends Error {
33050
- kind;
33051
- status;
33052
- constructor(message, kind, status) {
33053
- super(message);
33054
- this.name = "RunnerTransportError";
33055
- this.kind = kind;
33056
- this.status = status;
33057
- Object.defineProperty(this, RUNNER_TRANSPORT_BRAND, { value: true });
33058
- }
33059
- };
33060
- function isRunnerTransportError(err) {
33061
- return err instanceof Error && err[RUNNER_TRANSPORT_BRAND] === true;
33062
- }
33063
- var runExecutor = new AsyncLocalStorage();
33064
- var defaultExecutor;
33065
- function setDefaultGogExecutor(executor) {
33066
- defaultExecutor = executor ? { executor } : void 0;
33067
- }
33068
- function activeExecutor() {
33069
- return runExecutor.getStore() ?? defaultExecutor;
33070
- }
33071
33043
  var TIMEOUT_MS = 3e4;
33072
33044
  var MIN_GOG_VERSION = "0.40.0";
33073
33045
  function readonlyEnvEnabled() {
@@ -33256,32 +33228,14 @@ async function run(args, options = {}) {
33256
33228
  const base = redactMode === "tokens" ? redactGoogleTokens : redactSecrets2;
33257
33229
  const redact = opaqueFields?.length ? (text) => redactPreservingOpaqueFields(text, opaqueFields, base) : base;
33258
33230
  const fullArgs = assembleArgs(args, { account, interactive, readonly: readonly2 });
33259
- const store = activeExecutor();
33260
33231
  try {
33261
- let output2;
33262
- if (spawner) {
33263
- output2 = await spawnExecutor(fullArgs, { timeout, interactive, spawner });
33264
- } else if (store) {
33265
- output2 = await store.executor(fullArgs, { timeout, interactive });
33266
- } else {
33267
- output2 = await spawnExecutor(fullArgs, { timeout, interactive });
33268
- }
33269
- return redact(output2);
33232
+ return redact(await spawnExecutor(fullArgs, { timeout, interactive, spawner }));
33270
33233
  } catch (err) {
33271
- const message = base(err instanceof Error ? err.message : String(err));
33272
- if (isRunnerTransportError(err)) {
33273
- throw new RunnerTransportError(message, err.kind, err.status);
33274
- }
33275
- throw new Error(message);
33234
+ throw new Error(base(err instanceof Error ? err.message : String(err)));
33276
33235
  }
33277
33236
  }
33278
33237
  async function runBinary(args, options = {}) {
33279
33238
  const { account, spawner, timeout, readonly: readonly2 = false } = options;
33280
- if (!spawner && activeExecutor()) {
33281
- throw new Error(
33282
- "Raw byte retrieval is not available over the hosted connector (its transport is text-only). Use the text-extraction path instead, or run the local stdio server to fetch bytes."
33283
- );
33284
- }
33285
33239
  const fullArgs = assembleArgs(args, { account, interactive: false, readonly: readonly2 });
33286
33240
  return spawnExecutor(fullArgs, { timeout, interactive: false, spawner, binary: true });
33287
33241
  }
@@ -33623,14 +33577,6 @@ var AUTH_HINT = "\n\nAuthentication may have expired. Use gog_auth_add to re-aut
33623
33577
  var INVALID_GRANT_HINT = '\n\nThe stored refresh token was rejected (invalid_grant): it has expired or been revoked, so the whole account is signed out and re-authorization is required. The most common cause is the 7-day refresh-token limit Google applies to OAuth apps whose consent screen is still in "Testing" mode. Re-authorize with gog_auth_add (opens a browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless). To stop this recurring, publish the OAuth consent screen to "In production" in the Google Cloud project that owns the OAuth client. Ask the user if they would like to re-authenticate.';
33624
33578
  var TRANSIENT_HINT = "\n\nThis error is often transient. Retry the same call before trying a different approach (do not fall back to smaller writes or row-by-row operations).";
33625
33579
  var GRID_LIMIT_HINT = "\n\nThe target range is outside the sheet's current grid. Add the missing rows or columns first with gog_sheets_insert (dimension: rows or cols), then retry the write.";
33626
- var RUNNER_TRANSPORT_AUTH_HINT = "\n\nThis is the CONNECTOR's own transport auth failing, not your Google sign-in. The gog-runner backend rejected the bearer token this server sent, so the request never reached gog and no Google credential was checked \u2014 the Google account is not the problem and re-authorizing it cannot fix this. An operator must make the Worker secret GOG_RUNNER_KEY equal RUNNER_KEY on the Fly app (wrangler secret put GOG_RUNNER_KEY / fly secrets set RUNNER_KEY), then retry.";
33627
- var RUNNER_TRANSPORT_HINTS = {
33628
- "transport-auth": RUNNER_TRANSPORT_AUTH_HINT,
33629
- // The request itself was malformed, so the runner will refuse it identically
33630
- // every time. Nothing to advise beyond the message the runner already gave.
33631
- "transport-request": "",
33632
- "transport-retryable": TRANSIENT_HINT
33633
- };
33634
33580
  function formatAccountList(raw) {
33635
33581
  try {
33636
33582
  const parsed = JSON.parse(raw);
@@ -33643,12 +33589,11 @@ function formatAccountList(raw) {
33643
33589
  }
33644
33590
  async function diagnose(err) {
33645
33591
  const errText = errorText(err);
33646
- const transportHint = isRunnerTransportError(err) ? RUNNER_TRANSPORT_HINTS[err.kind] : void 0;
33647
33592
  const isInvalidGrant = INVALID_GRANT_PATTERN.test(errText);
33648
33593
  const isTransientError = !DEFINITE_AUTH_PATTERN.test(errText) && TRANSIENT_ERROR_PATTERN.test(errText);
33649
33594
  const isAuthError = !isTransientError && AUTH_ERROR_PATTERN.test(errText);
33650
33595
  const isGridLimitError = GRID_LIMIT_ERROR_PATTERN.test(errText);
33651
- const hint = transportHint ?? (isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "");
33596
+ const hint = isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "";
33652
33597
  try {
33653
33598
  const accounts = formatAccountList(await run(["auth", "list"]));
33654
33599
  return errorResult(`${errText}
@@ -33709,8 +33654,8 @@ function formatOneAccountHealth(a, now) {
33709
33654
  const age = ageInDays(a.created_at, now);
33710
33655
  const ageStr = age === null ? "" : ` Authorized ${age.toFixed(1)} day(s) ago.`;
33711
33656
  if (a.valid === false) {
33712
- const cause2 = INVALID_GRANT_PATTERN.test(a.error ?? "") ? 'refresh token expired or revoked \u2014 commonly the 7-day limit on OAuth consent screens still in "Testing" mode' : a.error?.trim() || "unknown error";
33713
- return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${cause2}.${ageStr} Re-authorize with gog_auth_add (browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless).`;
33657
+ const cause = INVALID_GRANT_PATTERN.test(a.error ?? "") ? 'refresh token expired or revoked \u2014 commonly the 7-day limit on OAuth consent screens still in "Testing" mode' : a.error?.trim() || "unknown error";
33658
+ return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${cause}.${ageStr} Re-authorize with gog_auth_add (browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless).`;
33714
33659
  }
33715
33660
  if (a.valid === true) {
33716
33661
  let line = `\u2713 ${email3}: token valid.${ageStr}`;
@@ -33825,7 +33770,7 @@ function registerAppScriptTools(server) {
33825
33770
  return runOrDiagnose(["appscript", "content", scriptId], { account });
33826
33771
  });
33827
33772
  server.registerTool("gog_appscript_pull", {
33828
- description: "Write a project's files into a local directory, for editing a script as ordinary files. THE DIRECTORY IS RESOLVED WHERE GOG RUNS, which is the caller's own machine only on a local (stdio) deployment: on the hosted connector, or any GOG_RUNNER_URL backend, the files land on that server where the caller cannot reach them. Use gog_appscript_content there instead \u2014 it returns the same source in the response. Existing files are left alone unless overwrite is set. Read-only as far as Google is concerned: nothing is pushed back." + apiEnableNote,
33773
+ description: "Write a project's files into a local directory, for editing a script as ordinary files. THE DIRECTORY IS RESOLVED WHERE GOG RUNS, which is the caller's own machine only on a local (stdio) deployment: on a hosted deployment (e.g. mcp-host) the files land on that server where the caller cannot reach them. Use gog_appscript_content there instead \u2014 it returns the same source in the response. Existing files are left alone unless overwrite is set. Read-only as far as Google is concerned: nothing is pushed back." + apiEnableNote,
33829
33774
  inputSchema: external_exports.object({
33830
33775
  scriptId: scriptIdParam,
33831
33776
  dir: external_exports.string().describe("Destination directory, resolved on the machine where gog runs"),
@@ -33936,7 +33881,7 @@ function registerAuthToolsWith(server, defaultServices) {
33936
33881
  }
33937
33882
  });
33938
33883
  server.registerTool("gog_auth_health", {
33939
- description: 'Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task. On the hosted connector this is the ONLY check that measures Google: a connector showing "connected" or "refreshed" has verified the connector key that reaches the gog machine, and nothing else \u2014 the Google credential lives on that machine and can be dead while the connection looks perfectly healthy.',
33884
+ description: `Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task. On a hosted deployment this is the ONLY check that measures Google: a connector showing "connected" or "refreshed" has verified the client's connection to the MCP host, and nothing else \u2014 the Google credential lives in gog's keyring on that host and can be dead while the connection looks perfectly healthy.`,
33940
33885
  annotations: { readOnlyHint: true },
33941
33886
  inputSchema: external_exports.object({})
33942
33887
  }, async () => {
@@ -33978,7 +33923,7 @@ function registerAuthToolsWith(server, defaultServices) {
33978
33923
  }
33979
33924
  });
33980
33925
  server.registerTool("gog_auth_add_url", {
33981
- description: "Begin REMOTE/headless Google authorization (step 1 of 2). Returns a sign-in URL to open in any browser \u2014 no local server or terminal on the gogcli host is needed, so this works over the hosted connector where the interactive gog_auth_add cannot. Hand the URL to the user; after they sign in, the browser is redirected to a localhost URL that fails to load \u2014 that is expected. They copy that full redirected URL (from the address bar) and you pass it to gog_auth_add_complete. The link is valid for 10 minutes. If you pass a custom `services` here, pass the SAME value to gog_auth_add_complete or the second step will not match this one.",
33926
+ description: "Begin REMOTE/headless Google authorization (step 1 of 2). Returns a sign-in URL to open in any browser \u2014 no local server or terminal on the gogcli host is needed, so this works on a hosted deployment where the interactive gog_auth_add cannot. Hand the URL to the user; after they sign in, the browser is redirected to a localhost URL that fails to load \u2014 that is expected. They copy that full redirected URL (from the address bar) and you pass it to gog_auth_add_complete. The link is valid for 10 minutes. If you pass a custom `services` here, pass the SAME value to gog_auth_add_complete or the second step will not match this one.",
33982
33927
  inputSchema: external_exports.object({
33983
33928
  email: external_exports.string().describe("Google account email to authorize"),
33984
33929
  services: external_exports.string().optional().default(defaultServices).describe(servicesDescribe),
@@ -34227,9 +34172,9 @@ function registerCalendarTools(server) {
34227
34172
 
34228
34173
  // src/attachments.ts
34229
34174
  var MAX_INLINE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
34230
- var RUNNER_MAX_BODY_BYTES = 32 * 1024 * 1024;
34231
- var RUNNER_BODY_JSON_RESERVE_BYTES = 256 * 1024;
34232
- var MAX_REQUEST_PAYLOAD_WIRE_BYTES = RUNNER_MAX_BODY_BYTES - RUNNER_BODY_JSON_RESERVE_BYTES;
34175
+ var REQUEST_MAX_BODY_BYTES = 32 * 1024 * 1024;
34176
+ var REQUEST_BODY_JSON_RESERVE_BYTES = 256 * 1024;
34177
+ var MAX_REQUEST_PAYLOAD_WIRE_BYTES = REQUEST_MAX_BODY_BYTES - REQUEST_BODY_JSON_RESERVE_BYTES;
34233
34178
  var MAX_INLINE_ATTACHMENT_TOTAL_BYTES = Math.floor(MAX_REQUEST_PAYLOAD_WIRE_BYTES * 3 / 4);
34234
34179
  function wireBytesOf(arg) {
34235
34180
  if (typeof arg === "string") return Buffer.byteLength(arg, "utf8");
@@ -34246,7 +34191,7 @@ var inlineAttachmentSchema = external_exports.object({
34246
34191
  )
34247
34192
  });
34248
34193
  var attachInlineParam = external_exports.array(inlineAttachmentSchema).optional().describe(
34249
- `Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on the hosted connector and on any remote deployment. Each entry is {filename, contentBase64} (${INLINE_ATTACHMENT_LIMITS_TEXT}). Can be combined with \`attach\`: the two name disjoint files (paths read on the server vs. bytes sent with the call), and both end up as ordinary attachments on the message.`
34194
+ `Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on a hosted deployment (e.g. mcp-host). Each entry is {filename, contentBase64} (${INLINE_ATTACHMENT_LIMITS_TEXT}). Can be combined with \`attach\`: the two name disjoint files (paths read on the server vs. bytes sent with the call), and both end up as ordinary attachments on the message.`
34250
34195
  );
34251
34196
  function validateFilename(filename, where) {
34252
34197
  if (/[/\\]/.test(filename)) {
@@ -35246,7 +35191,7 @@ function registerDriveTools(server) {
35246
35191
  }
35247
35192
  });
35248
35193
  server.registerTool("gog_drive_read_bytes", {
35249
- description: "Fetch a Drive file's raw bytes and return them base64-encoded as an embedded resource \u2014 the generic fallback for callers that want the file itself (to parse locally) rather than extracted text. For readable text from a PDF, prefer gog_drive_extract_text. NOTE: only works on the local stdio server; over the hosted connector the transport is text-only and this returns a clear error (use gog_drive_extract_text there).",
35194
+ description: "Fetch a Drive file's raw bytes and return them base64-encoded as an embedded resource \u2014 the generic fallback for callers that want the file itself (to parse locally) rather than extracted text. For readable text from a PDF, prefer gog_drive_extract_text.",
35250
35195
  annotations: { readOnlyHint: true },
35251
35196
  inputSchema: external_exports.object({
35252
35197
  fileId: external_exports.string().describe("Drive file ID"),
@@ -35458,7 +35403,7 @@ var replySchema = {
35458
35403
  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."),
35459
35404
  subject: external_exports.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
35460
35405
  noQuote: external_exports.boolean().optional().describe("Do not include the original message quoted below the reply (default: the original is quoted)"),
35461
- 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.`),
35406
+ 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 a hosted deployment (e.g. mcp-host) 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.`),
35462
35407
  attachInline: attachInlineParam,
35463
35408
  from: external_exports.string().optional().describe("Send from this email address (must be a verified send-as alias)"),
35464
35409
  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."),
@@ -35595,7 +35540,7 @@ function registerGmailTools(server) {
35595
35540
  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.'),
35596
35541
  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."),
35597
35542
  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."),
35598
- 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.`),
35543
+ 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 a hosted deployment (e.g. mcp-host) 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.`),
35599
35544
  attachInline: attachInlineParam,
35600
35545
  account: accountParam
35601
35546
  })
@@ -35970,7 +35915,7 @@ function registerTasksTools(server) {
35970
35915
  }
35971
35916
 
35972
35917
  // src/server.ts
35973
- var VERSION = true ? "3.0.0" : "0.0.0";
35918
+ var VERSION = true ? "4.0.0" : "0.0.0";
35974
35919
  var BASE_TOOL_REGISTRARS = [
35975
35920
  registerApiTools,
35976
35921
  registerAppScriptTools,
@@ -35987,488 +35932,68 @@ var BASE_TOOL_REGISTRARS = [
35987
35932
  registerTasksTools
35988
35933
  ];
35989
35934
 
35990
- // src/auth-log.ts
35991
- var FAILURES = /* @__PURE__ */ new Set([
35992
- "token.mint-failed",
35993
- "grant.dead",
35994
- "replay.failed",
35995
- "runner.auth-failed",
35996
- "connect.key-rejected",
35997
- // An enrolment that could not proceed is a failure even though nobody is at
35998
- // fault: it is the only trace a half-enrolled connector leaves behind, and
35999
- // the absence of exactly this record is why DEFECT 4 could not be explained.
36000
- "connect.runner-unreachable",
36001
- "connect.google-unhealthy",
36002
- "refusal.google-unhealthy",
36003
- // The loudest record on this branch, and the only one that means "we cannot
36004
- // explain this". Google refused a real call while a live check of the same
36005
- // credential, taken seconds later, succeeded — so neither the 7-day cliff nor
36006
- // a revoked grant accounts for it. It is filed as a failure precisely because
36007
- // it is the record nobody may scroll past: it is the only evidence that could
36008
- // ever justify building something on the hosted path, and its absence over
36009
- // time is what retires that theory for good.
36010
- "refusal.google-ok"
36011
- ]);
36012
- var PREFIX = "gog-auth ";
36013
- var TAG_CHARS = 12;
36014
- function credentialTag(cacheKeyHash) {
36015
- return cacheKeyHash.slice(0, TAG_CHARS);
36016
- }
36017
- function logAuthTransition(event, context) {
36018
- const record2 = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...context });
36019
- const write = FAILURES.has(event) ? console.error : console.warn;
36020
- write(PREFIX + redactSecrets2(record2));
36021
- }
36022
-
36023
- // src/google-token.ts
36024
- var TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
36025
- var EXPIRY_MARGIN_MS = 12e4;
36026
- var cache = /* @__PURE__ */ new Map();
36027
- var inFlight = /* @__PURE__ */ new Map();
36028
- async function cacheKey(refreshToken, clientId) {
36029
- const data = new TextEncoder().encode(`${clientId}\0${refreshToken}`);
36030
- const digest = await crypto.subtle.digest("SHA-256", data);
36031
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
36032
- }
36033
- function makeAccessTokenSource(env) {
36034
- const direct = readEnvVar("GOG_ACCESS_TOKEN", { env });
36035
- if (direct) return async () => direct;
36036
- const refreshToken = readEnvVar("GOG_REFRESH_TOKEN", { env });
36037
- if (!refreshToken) return void 0;
36038
- const clientId = readEnvVar("GOG_CLIENT_ID", { env });
36039
- const clientSecret = readEnvVar("GOG_CLIENT_SECRET", { env });
36040
- if (!clientId || !clientSecret) {
36041
- const missing = [!clientId && "GOG_CLIENT_ID", !clientSecret && "GOG_CLIENT_SECRET"].filter(Boolean).join(" and ");
36042
- return async () => {
36043
- throw new Error(
36044
- `GOG_REFRESH_TOKEN is set but ${missing} is not, so no access token can be minted. Set the OAuth client alongside the refresh token, or unset GOG_REFRESH_TOKEN to use the backend\u2019s own identity.`
36045
- );
36046
- };
36047
- }
36048
- let keyPromise;
36049
- const key = () => keyPromise ??= cacheKey(refreshToken, clientId);
36050
- const logCacheHits = parseBoolEnv("GOG_AUTH_LOG_CACHE_HITS", { env });
36051
- const read = async () => {
36052
- const k = await key();
36053
- const hit = cache.get(k);
36054
- if (hit && hit.expiresAt - EXPIRY_MARGIN_MS > Date.now()) {
36055
- if (logCacheHits) logAuthTransition("token.cache-hit", { credential: credentialTag(k) });
36056
- return hit.accessToken;
36057
- }
36058
- let pending = inFlight.get(k);
36059
- if (!pending) {
36060
- pending = exchange(refreshToken, clientId, clientSecret).then((minted2) => {
36061
- cache.set(k, minted2);
36062
- logAuthTransition("token.minted", {
36063
- credential: credentialTag(k),
36064
- reason: `valid for ${Math.round((minted2.expiresAt - Date.now()) / 1e3)}s`
36065
- });
36066
- return minted2;
36067
- }).catch((err) => {
36068
- logAuthTransition(err.grantDead ? "grant.dead" : "token.mint-failed", {
36069
- credential: credentialTag(k),
36070
- reason: err.message
36071
- });
36072
- throw err;
36073
- }).finally(() => inFlight.delete(k));
36074
- inFlight.set(k, pending);
36075
- }
36076
- const minted = await pending;
36077
- return minted.accessToken;
36078
- };
36079
- const invalidate = async (rejected) => {
36080
- const k = await key();
36081
- const hit = cache.get(k);
36082
- if (!hit || hit.accessToken !== rejected) {
36083
- logAuthTransition("token.evict-noop", {
36084
- credential: credentialTag(k),
36085
- reason: hit ? "a concurrent caller had already replaced this credential\u2019s token" : "no token was cached for this credential"
36086
- });
36087
- return false;
36088
- }
36089
- cache.delete(k);
36090
- logAuthTransition("token.evicted", {
36091
- credential: credentialTag(k),
36092
- reason: "Google rejected this access token; the next read will mint a new one"
36093
- });
36094
- return true;
36095
- };
36096
- return Object.assign(read, {
36097
- invalidate,
36098
- credentialId: async () => credentialTag(await key())
36099
- });
36100
- }
36101
- var TokenExchangeError = class extends Error {
36102
- /**
36103
- * The REFRESH token is dead (Google's `invalid_grant`), not merely the access
36104
- * token. Carried as a flag rather than re-read from the message, because
36105
- * inferring the author of a failure from prose several authors can produce is
36106
- * precisely the mistake this branch exists to undo. `instanceof` is safe: the
36107
- * class is thrown and caught inside this one module.
36108
- */
36109
- grantDead;
36110
- constructor(message, grantDead) {
36111
- super(message);
36112
- this.grantDead = grantDead;
36113
- }
35935
+ // src/bootstrap-auth.ts
35936
+ import { join as join2 } from "node:path";
35937
+ var AUTH_BOOTSTRAP_MARKER = "auth-bootstrap.sha256";
35938
+ var VARS = ["GOG_CLIENT_ID", "GOG_CLIENT_SECRET", "GOG_REFRESH_TOKEN", "GOG_ACCOUNT"];
35939
+ var log = (line) => {
35940
+ process.stderr.write(`[gogcli-mcp] auth bootstrap: ${line}
35941
+ `);
36114
35942
  };
36115
- async function exchange(refreshToken, clientId, clientSecret) {
36116
- let res;
35943
+ var jsonFile = (name, payload) => ({
35944
+ kind: "file",
35945
+ flag: name,
35946
+ ext: "json",
35947
+ contents: JSON.stringify(payload),
35948
+ positional: true
35949
+ });
35950
+ async function accountListed(account, spawner) {
36117
35951
  try {
36118
- res = await fetch(TOKEN_ENDPOINT, {
36119
- method: "POST",
36120
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
36121
- body: new URLSearchParams({
36122
- grant_type: "refresh_token",
36123
- refresh_token: refreshToken,
36124
- client_id: clientId,
36125
- client_secret: clientSecret
36126
- }).toString()
36127
- });
36128
- } catch (err) {
36129
- throw new TokenExchangeError(
36130
- `the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}`,
36131
- false
36132
- );
36133
- }
36134
- const body = await res.json().catch(() => ({}));
36135
- if (!res.ok) {
36136
- if (body.error === "invalid_grant") {
36137
- throw new TokenExchangeError(
36138
- 'the stored refresh token was rejected (invalid_grant): it has expired or been revoked, so this account must be re-authorized (commonly the 7-day limit on OAuth consent screens still in "Testing" mode). Re-enrol with gog_auth_add_url + gog_auth_add_complete and store the new refresh token.',
36139
- true
36140
- );
36141
- }
36142
- throw new TokenExchangeError(
36143
- `the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})`,
36144
- false
36145
- );
36146
- }
36147
- if (!body.access_token) {
36148
- throw new TokenExchangeError(
36149
- "the access token could not be refreshed: Google returned no access_token",
36150
- false
36151
- );
36152
- }
36153
- const expiresInMs = (body.expires_in ?? 3600) * 1e3;
36154
- return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
36155
- }
36156
-
36157
- // src/google-probe.ts
36158
- var bool = (value) => typeof value === "boolean" ? value : void 0;
36159
- var cause = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
36160
- function readGoogleProbe(body) {
36161
- const record2 = typeof body === "object" && body !== null ? body : {};
36162
- const measured = bool(record2.measured);
36163
- const reported = cause(record2.error);
36164
- if (measured === false) {
36165
- return {
36166
- kind: "unmeasured",
36167
- reason: reported ?? "the runner reported it could not measure the Google layer"
36168
- };
36169
- }
36170
- if (measured === true) {
36171
- if (bool(record2.ok) === true) return { kind: "ok" };
36172
- return {
36173
- kind: "unhealthy",
36174
- reason: reported ?? "the runner reported the Google layer unhealthy with no cause"
36175
- };
35952
+ const out = await run(["auth", "list"], { spawner, account });
35953
+ const accounts = JSON.parse(out).accounts ?? [];
35954
+ return accounts.some((a) => a.email?.toLowerCase() === account.toLowerCase());
35955
+ } catch {
35956
+ return false;
36176
35957
  }
36177
- return {
36178
- kind: "unmeasured",
36179
- reason: reported ? `the runner did not report whether it measured the Google layer; it said: ${reported}` : "the runner did not report whether it measured the Google layer"
36180
- };
36181
35958
  }
36182
-
36183
- // src/connector-runtime.ts
36184
- var DEFAULT_TIMEOUT_MS = 3e4;
36185
- var DEADLINE_GRACE_MS = 5e3;
36186
- var MIN_REPLAY_BUDGET_MS = 1e3;
36187
- var REFUSAL_PROBE_TIMEOUT_MS = 4e3;
36188
- var MIN_PROBE_BUDGET_MS = 1e3;
36189
- var PROBE_INTERVAL_MS = 6e4;
36190
- var RUNNER_GOG_FAILED = 422;
36191
- var RUNNER_DRAINING = 503;
36192
- var RUNNER_BAD_REQUEST = 400;
36193
- var RUNNER_BAD_KEY = 401;
36194
- var GogFailedError = class extends Error {
36195
- /** gog's stderr alone, with no echoed argv mixed in. */
36196
- stderr;
36197
- constructor(message, stderr) {
36198
- super(message);
36199
- this.stderr = stderr;
36200
- }
36201
- };
36202
- var GOOGLE_TOKEN_REJECTED_PATTERN = /Google API error \(401\b|invalid[ _]authentication[ _]credentials|\bACCESS_TOKEN_EXPIRED\b|\binvalid_token\b/i;
36203
- var REFRESH_TOKEN_DEAD_PATTERN = /\binvalid_grant\b/i;
36204
- var READ_ONLY_SUBCOMMANDS = /* @__PURE__ */ new Set([
36205
- "cat",
36206
- "describe",
36207
- "get",
36208
- "info",
36209
- "list",
36210
- "list-slides",
36211
- "ls",
36212
- "metadata",
36213
- "read-slide",
36214
- "search",
36215
- "services",
36216
- "status",
36217
- "structure"
36218
- ]);
36219
- function gogTarget(args) {
36220
- const words = args.filter((arg) => typeof arg === "string");
36221
- let service;
36222
- for (let i = 0; i < words.length; i += 1) {
36223
- const word = words[i];
36224
- if (word.startsWith("-")) {
36225
- if (word === "--account") i += 1;
36226
- continue;
36227
- }
36228
- if (service === void 0) {
36229
- service = word;
36230
- continue;
36231
- }
36232
- return { service, subcommand: word };
36233
- }
36234
- return { service };
36235
- }
36236
- async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt, probeGoogle) {
36237
- if (!(err instanceof GogFailedError)) return void 0;
36238
- const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
36239
- if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
36240
- const { service, subcommand } = gogTarget(args);
36241
- const credential = await readAccessToken?.credentialId?.();
36242
- const where = { credential, service };
36243
- if (grantDead) {
36244
- logAuthTransition("grant.dead", {
36245
- ...where,
36246
- reason: "gog reported invalid_grant: the stored refresh token is dead, so no token can be minted and this account must be re-authorized"
36247
- });
36248
- return void 0;
36249
- }
36250
- if (!used) {
36251
- await probeGoogle(where);
36252
- logAuthTransition("replay.declined", {
36253
- ...where,
36254
- reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
36255
- });
36256
- return void 0;
35959
+ async function bootstrapGogAuth(env = process.env, options = {}) {
35960
+ const values = VARS.map((key) => readEnvVar(key, { env }));
35961
+ const missing = VARS.filter((_key, i) => values[i] === void 0);
35962
+ if (missing.length === VARS.length) return "unconfigured";
35963
+ if (missing.length > 0) {
35964
+ log(`skipped, missing ${missing.join(", ")}`);
35965
+ return "incomplete";
36257
35966
  }
36258
- if (!readAccessToken?.invalidate) {
36259
- logAuthTransition("replay.declined", {
36260
- ...where,
36261
- reason: "this token source cannot mint a replacement, so a replay would resend the rejected token"
36262
- });
36263
- return void 0;
36264
- }
36265
- const evicted = await readAccessToken.invalidate(used);
36266
- if (subcommand === void 0 || !READ_ONLY_SUBCOMMANDS.has(subcommand)) {
36267
- logAuthTransition("replay.declined", {
36268
- ...where,
36269
- reason: `not replayable: '${subcommand ?? "(none)"}' is not a known read-only subcommand and a write could double-apply`
36270
- });
36271
- return void 0;
36272
- }
36273
- if (!evicted) {
36274
- logAuthTransition("replay.declined", {
36275
- ...where,
36276
- reason: "the rejected token was already superseded, so the cache holds the token a replay would send"
36277
- });
36278
- return void 0;
36279
- }
36280
- const fresh = await readAccessToken();
36281
- if (!fresh) {
36282
- logAuthTransition("replay.declined", {
36283
- ...where,
36284
- reason: "the token source produced no token after eviction; replaying without one would act as the backend"
36285
- });
36286
- return void 0;
36287
- }
36288
- const budgetMs = deadlineAt - Date.now();
36289
- if (budgetMs < MIN_REPLAY_BUDGET_MS) {
36290
- logAuthTransition("replay.declined", {
36291
- ...where,
36292
- reason: `only ${budgetMs}ms of the call\u2019s deadline remained, so a replay could only time out; the rejected token was evicted, so the next call mints a fresh one`
36293
- });
36294
- return void 0;
36295
- }
36296
- return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
36297
- }
36298
- function makeFlyExecutor(endpoint, key, readAccessToken) {
36299
- let lastProbeAt = Number.NEGATIVE_INFINITY;
36300
- const probeGoogleAfterRefusal = async (where, deadlineAt) => {
36301
- const record2 = { ...where, endpoint };
36302
- const now = Date.now();
36303
- const remainingMs = deadlineAt - now;
36304
- if (remainingMs < MIN_PROBE_BUDGET_MS) {
36305
- logAuthTransition("refusal.google-unmeasured", {
36306
- ...record2,
36307
- reason: `only ${remainingMs}ms of the call\u2019s deadline remained, so the Google layer was not measured rather than delay the caller\u2019s own error`
36308
- });
36309
- return;
36310
- }
36311
- if (now - lastProbeAt < PROBE_INTERVAL_MS) {
36312
- logAuthTransition("refusal.google-unmeasured", {
36313
- ...record2,
36314
- // "attempted", not "measured". `lastProbeAt` is stamped before the
36315
- // fetch and is deliberately NOT reset when the probe comes back with no
36316
- // verdict (a 404 from a runner too old to have the endpoint, a timeout,
36317
- // a dead socket) — the backend cost this throttle exists to bound was
36318
- // paid either way, and resetting it would let a retry loop storm a
36319
- // runner that is already unwell. So the timestamp stays and the sentence
36320
- // has to be the true one: on this branch a log line may not assert a
36321
- // measurement that never happened, and the previous probe may well have
36322
- // measured nothing at all.
36323
- reason: "a Google probe was attempted recently, so another was not sent: this probe spawns gog on the backend and takes the keyring\u2019s exclusive lock"
36324
- });
36325
- return;
36326
- }
36327
- lastProbeAt = now;
36328
- let event;
36329
- let reason;
36330
- try {
36331
- const res = await fetch(`${endpoint}/health/google`, {
36332
- headers: { Authorization: `Bearer ${key}` },
36333
- // Never more than the probe's own budget, never more than the call has
36334
- // left. `Math.min` rather than a plain constant because the second
36335
- // bound is the caller's, and it outranks ours.
36336
- signal: AbortSignal.timeout(Math.min(REFUSAL_PROBE_TIMEOUT_MS, remainingMs))
36337
- });
36338
- if (!res.ok) {
36339
- event = "refusal.google-unmeasured";
36340
- reason = `the runner did not answer the Google probe (HTTP ${res.status})`;
36341
- } else {
36342
- const verdict = readGoogleProbe(await res.json());
36343
- if (verdict.kind === "ok") {
36344
- event = "refusal.google-ok";
36345
- reason = "Google refused this call, yet a live token check on the same volume succeeded \u2014 so a dead or expired refresh token does not explain this refusal";
36346
- } else {
36347
- event = verdict.kind === "unhealthy" ? "refusal.google-unhealthy" : "refusal.google-unmeasured";
36348
- reason = verdict.reason;
36349
- }
36350
- }
36351
- } catch (err) {
36352
- event = "refusal.google-unmeasured";
36353
- reason = err instanceof Error ? err.message : String(err);
36354
- }
36355
- logAuthTransition(event, { ...record2, reason });
36356
- };
36357
- return async (args, opts) => {
36358
- const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
36359
- const accessToken = await readAccessToken?.();
36360
- const deadlineAt = Date.now() + deadlineMs;
36361
- try {
36362
- return await attempt(endpoint, key, args, accessToken, deadlineMs);
36363
- } catch (err) {
36364
- const replay = await remintAfterGoogleRejection(
36365
- err,
36366
- accessToken,
36367
- args,
36368
- readAccessToken,
36369
- deadlineAt,
36370
- (where2) => probeGoogleAfterRefusal(where2, deadlineAt)
36371
- );
36372
- if (replay === void 0) throw err;
36373
- const where = { credential: replay.credential, service: replay.service, endpoint };
36374
- logAuthTransition("replay.attempted", {
36375
- ...where,
36376
- reason: "Google rejected the access token; replaying this read once with a freshly minted one"
36377
- });
36378
- try {
36379
- const stdout = await attempt(endpoint, key, args, replay.token, replay.budgetMs);
36380
- logAuthTransition("replay.succeeded", where);
36381
- return stdout;
36382
- } catch (replayErr) {
36383
- logAuthTransition("replay.failed", { ...where, reason: String(replayErr) });
36384
- if (replayErr instanceof GogFailedError && GOOGLE_TOKEN_REJECTED_PATTERN.test(replayErr.stderr)) {
36385
- await replay.invalidate(replay.token);
36386
- }
36387
- throw replayErr;
36388
- }
36389
- }
36390
- };
36391
- }
36392
- async function attempt(endpoint, key, args, accessToken, deadlineMs) {
36393
- let res;
35967
+ const [clientId, clientSecret, refreshToken, account] = values;
35968
+ const { spawner } = options;
36394
35969
  try {
36395
- res = await fetch(endpoint + "/run", {
36396
- method: "POST",
36397
- headers: {
36398
- Authorization: "Bearer " + key,
36399
- "Content-Type": "application/json"
36400
- },
36401
- body: JSON.stringify(accessToken ? { args, accessToken } : { args }),
36402
- signal: AbortSignal.timeout(deadlineMs)
36403
- });
36404
- } catch (err) {
36405
- const name = err instanceof Error ? err.name : "";
36406
- if (name === "TimeoutError" || name === "AbortError") {
36407
- throw new RunnerTransportError(
36408
- `gog-runner did not respond within ${deadlineMs}ms (${endpoint}) \u2014 the Fly backend may be cold or wedged`,
36409
- "transport-retryable"
36410
- );
36411
- }
36412
- throw err;
36413
- }
36414
- if (!res.ok) {
36415
- const body = await res.json().catch(() => null);
36416
- const detail = body && typeof body.error === "string" ? body.stderr && body.stderr.trim() && body.stderr.trim() !== body.error.trim() ? `${body.error}
36417
- ${body.stderr}` : body.error : "";
36418
- if (res.status === RUNNER_GOG_FAILED) {
36419
- throw new GogFailedError(
36420
- detail || "gog failed on the runner (no detail supplied)",
36421
- typeof body?.stderr === "string" ? body.stderr : ""
36422
- );
36423
- }
36424
- if (res.status === RUNNER_BAD_KEY) {
36425
- logAuthTransition("runner.auth-failed", {
36426
- service: gogTarget(args).service,
36427
- endpoint,
36428
- reason: "the gog-runner rejected the connector\u2019s bearer token, so gog never ran and no Google credential was read; GOG_RUNNER_KEY does not match the Fly app\u2019s RUNNER_KEY"
36429
- });
36430
- throw new RunnerTransportError(
36431
- "gog-runner rejected the connector's bearer token, so the request never reached gog and no Google credential was involved. The Worker secret GOG_RUNNER_KEY no longer matches RUNNER_KEY on the Fly app; set them to the same value (wrangler secret put GOG_RUNNER_KEY / fly secrets set RUNNER_KEY) and retry.",
36432
- "transport-auth",
36433
- res.status
36434
- );
36435
- }
36436
- if (res.status === RUNNER_BAD_REQUEST) {
36437
- throw new RunnerTransportError(
36438
- detail || "gog-runner rejected the request (no detail supplied)",
36439
- "transport-request",
36440
- res.status
36441
- );
36442
- }
36443
- if (res.status === RUNNER_DRAINING || body?.retryable === true) {
36444
- throw new RunnerTransportError(
36445
- `gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`,
36446
- "transport-retryable",
36447
- res.status
36448
- );
36449
- }
36450
- if (detail) {
36451
- throw new Error(detail);
36452
- }
36453
- throw new RunnerTransportError(
36454
- `gog-runner HTTP ${res.status}: the response did not come from the runner, so the request never reached gog. The backend Machine was most likely starting or shutting down \u2014 this is transient, retry the same call.`,
36455
- "transport-retryable",
36456
- res.status
35970
+ const { createHash } = await import("node:crypto");
35971
+ const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
35972
+ const home = options.home ?? (await import("node:os")).homedir();
35973
+ const dir = join2(home, ".gogcli-mcp");
35974
+ const marker = join2(dir, AUTH_BOOTSTRAP_MARKER);
35975
+ const fingerprint = createHash("sha256").update(values.join("\0")).digest("hex");
35976
+ const previous = await readFile(marker, "utf8").catch(() => void 0);
35977
+ if (previous === fingerprint && await accountListed(account, spawner)) return "present";
35978
+ await run(
35979
+ ["auth", "credentials", "set", jsonFile("credentials", { installed: { client_id: clientId, client_secret: clientSecret } })],
35980
+ { spawner, account }
35981
+ );
35982
+ await run(
35983
+ ["auth", "tokens", "import", jsonFile("token", { email: account, refresh_token: refreshToken })],
35984
+ { spawner, account }
36457
35985
  );
35986
+ await mkdir(dir, { recursive: true, mode: 448 });
35987
+ await chmod(dir, 448);
35988
+ await writeFile(marker, fingerprint, { mode: 384 });
35989
+ await chmod(marker, 384);
35990
+ return "imported";
35991
+ } catch (err) {
35992
+ let message = redactSecrets2(errorText(err));
35993
+ for (const value of [clientSecret, refreshToken]) message = message.split(value).join("[REDACTED]");
35994
+ log(`failed, ${message}`);
35995
+ return "failed";
36458
35996
  }
36459
- const { stdout } = await res.json();
36460
- return stdout;
36461
- }
36462
-
36463
- // src/remote-runner.ts
36464
- function useRemoteGogRunner(env = process.env) {
36465
- const endpoint = readEnvVar("GOG_RUNNER_URL", { env });
36466
- const key = readEnvVar("GOG_RUNNER_KEY", { env });
36467
- if (!endpoint || !key) return false;
36468
- setDefaultGogExecutor(
36469
- makeFlyExecutor(endpoint.replace(/\/+$/, ""), key, makeAccessTokenSource(env))
36470
- );
36471
- return true;
36472
35997
  }
36473
35998
 
36474
35999
  // src/blob-urls.ts
@@ -36547,70 +36072,136 @@ function blobStoreFromEnv() {
36547
36072
  }
36548
36073
 
36549
36074
  // src/blob-upload.ts
36550
- var RUNNER_UPLOAD_TIMEOUT_MS = 125e3;
36075
+ var ATTACHMENT_DOWNLOAD_ROOT = "/tmp/gog-attachments";
36076
+ var MAX_BLOB_UPLOAD_BYTES = 100 * 1024 * 1024;
36077
+ var BLOB_UPLOAD_TIMEOUT_MS = 12e4;
36078
+ var ERROR_BODY_SNIPPET = 512;
36551
36079
  function withoutUrlSecrets(message, url2) {
36552
36080
  let out = url2 ? message.split(url2).join("<signed url>") : message;
36553
36081
  const signature = /[?&]sig=([^&#]+)/.exec(url2)?.[1];
36554
36082
  if (signature) out = out.split(signature).join("<signature>");
36555
36083
  return out;
36556
36084
  }
36557
- async function uploadToBlobStore(request, options = {}) {
36558
- const env = options.env ?? process.env;
36559
- const endpoint = readEnvVar("GOG_RUNNER_URL", { env });
36560
- const key = readEnvVar("GOG_RUNNER_KEY", { env });
36561
- if (!endpoint || !key) {
36562
- throw new Error(
36563
- "no gog runner is configured (GOG_RUNNER_URL + GOG_RUNNER_KEY, both or neither), and the attachment bytes are on the runner's disk rather than here \u2014 so nothing on this side can send them"
36564
- );
36565
- }
36566
- let response;
36085
+ var UploadError = class extends Error {
36086
+ };
36087
+ async function resolveConfined(root, requested) {
36088
+ const path = await import("node:path");
36089
+ const { realpath, stat } = await import("node:fs/promises");
36090
+ const isInside = (base, candidate2) => candidate2 === base || candidate2.startsWith(base + path.sep);
36091
+ const lexicalRoot = path.resolve(root);
36092
+ const candidate = path.resolve(lexicalRoot, requested);
36093
+ if (!isInside(lexicalRoot, candidate)) {
36094
+ throw new UploadError(`the attachment path must be inside ${lexicalRoot}`);
36095
+ }
36096
+ let realFile;
36097
+ let realRoot;
36567
36098
  try {
36568
- response = await fetch(`${endpoint.replace(/\/+$/, "")}/upload`, {
36569
- method: "POST",
36570
- headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json" },
36571
- body: JSON.stringify({ path: request.path, url: request.url, contentType: request.contentType }),
36572
- signal: AbortSignal.timeout(RUNNER_UPLOAD_TIMEOUT_MS)
36573
- });
36099
+ realFile = await realpath(candidate);
36100
+ realRoot = await realpath(lexicalRoot);
36574
36101
  } catch (err) {
36575
- throw new Error(withoutUrlSecrets(
36576
- `the upload to the blob store did not complete: ${err instanceof Error ? err.message : String(err)}`,
36577
- request.url
36578
- ));
36102
+ throw new UploadError(`the downloaded attachment could not be found: ${err.message}`);
36579
36103
  }
36580
- let raw;
36581
- try {
36582
- raw = await response.text();
36583
- } catch (err) {
36584
- throw new Error(withoutUrlSecrets(
36585
- `the upload to the blob store did not complete: the runner's answer could not be read: ${err instanceof Error ? err.message : String(err)}`,
36586
- request.url
36587
- ));
36104
+ if (!isInside(realRoot, realFile)) {
36105
+ throw new UploadError(`the attachment path must be inside ${realRoot}`);
36106
+ }
36107
+ const info = await stat(realFile);
36108
+ if (!info.isFile()) throw new UploadError("the attachment path must name a regular file");
36109
+ if (info.size > MAX_BLOB_UPLOAD_BYTES) {
36110
+ throw new UploadError(
36111
+ `the attachment is ${info.size} bytes; the blob store's maximum is ${MAX_BLOB_UPLOAD_BYTES} bytes`
36112
+ );
36588
36113
  }
36589
- let body = {};
36114
+ return { file: realFile, bytes: info.size };
36115
+ }
36116
+ function parseTarget(url2) {
36117
+ let target;
36590
36118
  try {
36591
- body = JSON.parse(raw);
36119
+ target = new URL(url2);
36592
36120
  } catch {
36593
- body = { error: raw };
36594
36121
  }
36595
- if (!response.ok) {
36596
- throw new Error(withoutUrlSecrets(
36597
- `the runner could not store the attachment (HTTP ${response.status}${body.status ? `, blob store ${body.status}` : ""}): ${body.error ?? "no reason given"}`,
36598
- request.url
36599
- ));
36122
+ if (!target || target.protocol !== "https:" && target.protocol !== "http:") {
36123
+ throw new UploadError("the upload target must be an absolute http(s) URL");
36124
+ }
36125
+ return target;
36126
+ }
36127
+ async function putFile(target, file2, bytes, contentType, timeoutMs) {
36128
+ const { createReadStream } = await import("node:fs");
36129
+ const { pipeline } = await import("node:stream");
36130
+ const transport = target.protocol === "https:" ? await import("node:https") : await import("node:http");
36131
+ return new Promise((resolve, reject) => {
36132
+ let settled = false;
36133
+ const source = createReadStream(file2);
36134
+ const req = transport.request(target, {
36135
+ method: "PUT",
36136
+ headers: { "content-type": contentType, "content-length": String(bytes) }
36137
+ });
36138
+ const finish2 = (settle2) => {
36139
+ if (settled) return;
36140
+ settled = true;
36141
+ clearTimeout(timer);
36142
+ source.destroy();
36143
+ req.destroy();
36144
+ settle2();
36145
+ };
36146
+ const fail = (err) => finish2(() => reject(err));
36147
+ const timer = setTimeout(
36148
+ () => fail(new UploadError(`the upload to the blob store did not finish within ${timeoutMs}ms`)),
36149
+ timeoutMs
36150
+ );
36151
+ req.on("error", fail);
36152
+ req.on("response", (res) => {
36153
+ const chunks = [];
36154
+ let held = 0;
36155
+ res.on("data", (chunk) => {
36156
+ if (held >= ERROR_BODY_SNIPPET) return;
36157
+ chunks.push(chunk);
36158
+ held += chunk.length;
36159
+ });
36160
+ res.on("error", fail);
36161
+ res.on("end", () => finish2(() => resolve({
36162
+ status: res.statusCode,
36163
+ body: Buffer.concat(chunks).toString().slice(0, ERROR_BODY_SNIPPET)
36164
+ })));
36165
+ });
36166
+ pipeline(source, req, (err) => {
36167
+ if (err) fail(err);
36168
+ });
36169
+ });
36170
+ }
36171
+ async function uploadToBlobStore(request, options = {}) {
36172
+ try {
36173
+ const target = parseTarget(request.url);
36174
+ const { file: file2, bytes } = await resolveConfined(options.root ?? ATTACHMENT_DOWNLOAD_ROOT, request.path);
36175
+ const answer = await putFile(
36176
+ target,
36177
+ file2,
36178
+ bytes,
36179
+ request.contentType,
36180
+ options.timeoutMs ?? BLOB_UPLOAD_TIMEOUT_MS
36181
+ );
36182
+ if (answer.status < 200 || answer.status >= 300) {
36183
+ throw new UploadError(`the blob store refused the upload with ${answer.status}: ${answer.body}`.trim());
36184
+ }
36185
+ return { bytes, status: answer.status };
36186
+ } catch (err) {
36187
+ const message = err instanceof UploadError ? err.message : `the upload to the blob store did not complete: ${err.message}`;
36188
+ throw new Error(withoutUrlSecrets(message, request.url));
36600
36189
  }
36601
- return { bytes: body.bytes, status: body.status };
36602
36190
  }
36603
36191
  export {
36192
+ ATTACHMENT_DOWNLOAD_ROOT,
36193
+ AUTH_BOOTSTRAP_MARKER,
36604
36194
  BASE_TOOL_REGISTRARS,
36195
+ BLOB_UPLOAD_TIMEOUT_MS,
36605
36196
  BLOB_URL_DEFAULT_TTL_MS,
36606
36197
  BLOB_URL_MAX_TTL_MS,
36607
36198
  INLINE_ATTACHMENT_LIMITS_TEXT,
36199
+ MAX_BLOB_UPLOAD_BYTES,
36608
36200
  MAX_INLINE_ATTACHMENT_BYTES,
36609
36201
  MAX_INLINE_ATTACHMENT_TOTAL_BYTES,
36610
36202
  MAX_REQUEST_PAYLOAD_WIRE_BYTES,
36611
36203
  MIN_GOG_VERSION,
36612
36204
  PAYLOAD_INLINE_MAX,
36613
- RUNNER_UPLOAD_TIMEOUT_MS,
36614
36205
  VERSION,
36615
36206
  accountParam,
36616
36207
  annotateTruncatedList,
@@ -36619,6 +36210,7 @@ export {
36619
36210
  attachInlineParam,
36620
36211
  authToolsFor,
36621
36212
  blobStoreFromEnv,
36213
+ bootstrapGogAuth,
36622
36214
  createBlobUrlMinter,
36623
36215
  diagnose,
36624
36216
  errorText,
@@ -36657,11 +36249,9 @@ export {
36657
36249
  resultText,
36658
36250
  run,
36659
36251
  runBinary,
36660
- runExecutor,
36661
36252
  runOrDiagnose,
36662
36253
  stripConsumedPageToken,
36663
- uploadToBlobStore,
36664
- useRemoteGogRunner
36254
+ uploadToBlobStore
36665
36255
  };
36666
36256
  /*! Bundled license information:
36667
36257