gogcli-mcp-calendar 4.2.5 → 4.3.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.
package/dist/index.js CHANGED
@@ -2092,8 +2092,8 @@ function emoji() {
2092
2092
  }
2093
2093
  var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
2094
2094
  var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
2095
- var mac = (delimiter2) => {
2096
- const escapedDelim = escapeRegex(delimiter2 ?? ":");
2095
+ var mac = (delimiter3) => {
2096
+ const escapedDelim = escapeRegex(delimiter3 ?? ":");
2097
2097
  return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
2098
2098
  };
2099
2099
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
@@ -5121,7 +5121,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5121
5121
  var NONE = 0;
5122
5122
  var ASSUMED = 1;
5123
5123
  var PROVEN = 2;
5124
- function isRecursive(inst, stack, resolve) {
5124
+ function isRecursive(inst, stack, resolve4) {
5125
5125
  const cached2 = recursive.get(inst);
5126
5126
  if (cached2 !== void 0)
5127
5127
  return cached2 ? PROVEN : NONE;
@@ -5131,7 +5131,7 @@ function isRecursive(inst, stack, resolve) {
5131
5131
  let result = NONE;
5132
5132
  const check2 = (child) => {
5133
5133
  if (result !== PROVEN && child?._zod) {
5134
- const answer = isRecursive(child, stack, resolve);
5134
+ const answer = isRecursive(child, stack, resolve4);
5135
5135
  if (answer > result)
5136
5136
  result = answer;
5137
5137
  }
@@ -5142,7 +5142,7 @@ function isRecursive(inst, stack, resolve) {
5142
5142
  const desc = Object.getOwnPropertyDescriptor(sh, key);
5143
5143
  if (spread && !desc.enumerable)
5144
5144
  continue;
5145
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
5145
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve4) : NONE;
5146
5146
  if (child > answer)
5147
5147
  answer = child;
5148
5148
  }
@@ -5206,7 +5206,7 @@ function isRecursive(inst, stack, resolve) {
5206
5206
  break;
5207
5207
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5208
5208
  case "lazy": {
5209
- const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
5209
+ const inner = def._cachedInner ?? (resolve4 ? inst._zod.innerType : void 0);
5210
5210
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5211
5211
  break;
5212
5212
  }
@@ -24106,14 +24106,14 @@ function inputRequiredRoundsExceededMessage(method, maxRounds) {
24106
24106
  return `Multi-round-trip request '${method}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
24107
24107
  }
24108
24108
  function sleep(ms, signal) {
24109
- return new Promise((resolve, reject) => {
24109
+ return new Promise((resolve4, reject) => {
24110
24110
  if (signal?.aborted) {
24111
24111
  reject(signal.reason instanceof SdkError ? signal.reason : new SdkError(SdkErrorCode.RequestTimeout, String(signal.reason)));
24112
24112
  return;
24113
24113
  }
24114
24114
  const timer = setTimeout(() => {
24115
24115
  signal?.removeEventListener("abort", onAbort);
24116
- resolve();
24116
+ resolve4();
24117
24117
  }, ms);
24118
24118
  const onAbort = () => {
24119
24119
  clearTimeout(timer);
@@ -24907,7 +24907,7 @@ var Protocol = class {
24907
24907
  const flowStartedAt = Date.now();
24908
24908
  let onAbort;
24909
24909
  let cleanupMessageId;
24910
- return new Promise((resolve, reject) => {
24910
+ return new Promise((resolve4, reject) => {
24911
24911
  const earlyReject = (error62) => {
24912
24912
  reject(error62);
24913
24913
  };
@@ -24975,7 +24975,7 @@ var Protocol = class {
24975
24975
  }
24976
24976
  if (decoded.kind === "invalid") return reject(decoded.error);
24977
24977
  if (decoded.kind === "input_required") {
24978
- if (options?.allowInputRequired === true) return resolve(manualInputRequiredValue(decoded));
24978
+ if (options?.allowInputRequired === true) return resolve4(manualInputRequiredValue(decoded));
24979
24979
  const flow = {
24980
24980
  codec: codec2,
24981
24981
  request,
@@ -24987,11 +24987,11 @@ var Protocol = class {
24987
24987
  params
24988
24988
  }, resultSchema, legOptions)
24989
24989
  };
24990
- return resolve(this._resolveNonCompleteResult(decoded, flow));
24990
+ return resolve4(this._resolveNonCompleteResult(decoded, flow));
24991
24991
  }
24992
24992
  const result = decoded.result;
24993
24993
  validateStandardSchema(resultSchema, result).then((parseResult) => {
24994
- if (parseResult.success) resolve(parseResult.data);
24994
+ if (parseResult.success) resolve4(parseResult.data);
24995
24995
  else reject(new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${request.method}: ${parseResult.error}`));
24996
24996
  }, reject);
24997
24997
  });
@@ -27903,7 +27903,7 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
27903
27903
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
27904
27904
  const schOrFunc = root.refs[ref];
27905
27905
  if (schOrFunc) return schOrFunc;
27906
- let _sch = resolve.call(this, root, ref);
27906
+ let _sch = resolve4.call(this, root, ref);
27907
27907
  if (_sch === void 0) {
27908
27908
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
27909
27909
  const { schemaId } = this.opts;
@@ -27929,7 +27929,7 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
27929
27929
  function sameSchemaEnv(s1, s2) {
27930
27930
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
27931
27931
  }
27932
- function resolve(root, ref) {
27932
+ function resolve4(root, ref) {
27933
27933
  let sch;
27934
27934
  while (typeof (sch = this.refs[ref]) == "string") ref = sch;
27935
27935
  return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
@@ -28379,47 +28379,47 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28379
28379
  else if (typeof uri === "object") uri = parse3(serialize(uri, options), options);
28380
28380
  return uri;
28381
28381
  }
28382
- function resolve(baseURI, relativeURI, options) {
28382
+ function resolve4(baseURI, relativeURI, options) {
28383
28383
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
28384
28384
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
28385
28385
  schemelessOptions.skipEscape = true;
28386
28386
  return serialize(resolved, schemelessOptions);
28387
28387
  }
28388
- function resolveComponent(base, relative, options, skipNormalization) {
28388
+ function resolveComponent(base, relative3, options, skipNormalization) {
28389
28389
  const target = {};
28390
28390
  if (!skipNormalization) {
28391
28391
  base = parse3(serialize(base, options), options);
28392
- relative = parse3(serialize(relative, options), options);
28392
+ relative3 = parse3(serialize(relative3, options), options);
28393
28393
  }
28394
28394
  options = options || {};
28395
- if (!options.tolerant && relative.scheme) {
28396
- target.scheme = relative.scheme;
28397
- target.userinfo = relative.userinfo;
28398
- target.host = relative.host;
28399
- target.port = relative.port;
28400
- target.path = removeDotSegments(relative.path || "");
28401
- target.query = relative.query;
28395
+ if (!options.tolerant && relative3.scheme) {
28396
+ target.scheme = relative3.scheme;
28397
+ target.userinfo = relative3.userinfo;
28398
+ target.host = relative3.host;
28399
+ target.port = relative3.port;
28400
+ target.path = removeDotSegments(relative3.path || "");
28401
+ target.query = relative3.query;
28402
28402
  } else {
28403
- if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
28404
- target.userinfo = relative.userinfo;
28405
- target.host = relative.host;
28406
- target.port = relative.port;
28407
- target.path = removeDotSegments(relative.path || "");
28408
- target.query = relative.query;
28403
+ if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
28404
+ target.userinfo = relative3.userinfo;
28405
+ target.host = relative3.host;
28406
+ target.port = relative3.port;
28407
+ target.path = removeDotSegments(relative3.path || "");
28408
+ target.query = relative3.query;
28409
28409
  } else {
28410
- if (!relative.path) {
28410
+ if (!relative3.path) {
28411
28411
  target.path = base.path;
28412
- if (relative.query !== void 0) target.query = relative.query;
28412
+ if (relative3.query !== void 0) target.query = relative3.query;
28413
28413
  else target.query = base.query;
28414
28414
  } else {
28415
- if (relative.path[0] === "/") target.path = removeDotSegments(relative.path);
28415
+ if (relative3.path[0] === "/") target.path = removeDotSegments(relative3.path);
28416
28416
  else {
28417
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) target.path = "/" + relative.path;
28418
- else if (!base.path) target.path = relative.path;
28419
- else target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
28417
+ if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) target.path = "/" + relative3.path;
28418
+ else if (!base.path) target.path = relative3.path;
28419
+ else target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
28420
28420
  target.path = removeDotSegments(target.path);
28421
28421
  }
28422
- target.query = relative.query;
28422
+ target.query = relative3.query;
28423
28423
  }
28424
28424
  target.userinfo = base.userinfo;
28425
28425
  target.host = base.host;
@@ -28427,7 +28427,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28427
28427
  }
28428
28428
  target.scheme = base.scheme;
28429
28429
  }
28430
- target.fragment = relative.fragment;
28430
+ target.fragment = relative3.fragment;
28431
28431
  return target;
28432
28432
  }
28433
28433
  function equal(uriA, uriB, options) {
@@ -28553,7 +28553,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28553
28553
  const fastUri = {
28554
28554
  SCHEMES,
28555
28555
  normalize,
28556
- resolve,
28556
+ resolve: resolve4,
28557
28557
  resolveComponent,
28558
28558
  equal,
28559
28559
  serialize,
@@ -29335,14 +29335,14 @@ var require_ucs2length = /* @__PURE__ */ __commonJSMin(((exports) => {
29335
29335
  function ucs2length(str) {
29336
29336
  const len = str.length;
29337
29337
  let length = 0;
29338
- let pos = 0;
29338
+ let pos2 = 0;
29339
29339
  let value;
29340
- while (pos < len) {
29340
+ while (pos2 < len) {
29341
29341
  length++;
29342
- value = str.charCodeAt(pos++);
29343
- if (value >= 55296 && value <= 56319 && pos < len) {
29344
- value = str.charCodeAt(pos);
29345
- if ((value & 64512) === 56320) pos++;
29342
+ value = str.charCodeAt(pos2++);
29343
+ if (value >= 55296 && value <= 56319 && pos2 < len) {
29344
+ value = str.charCodeAt(pos2);
29345
+ if ((value & 64512) === 56320) pos2++;
29346
29346
  }
29347
29347
  }
29348
29348
  return length;
@@ -33926,7 +33926,7 @@ var StdioServerTransport = class {
33926
33926
  }
33927
33927
  send(message) {
33928
33928
  if (this._closed) return Promise.reject(/* @__PURE__ */ new Error("StdioServerTransport is closed"));
33929
- return new Promise((resolve, reject) => {
33929
+ return new Promise((resolve4, reject) => {
33930
33930
  const json2 = serializeMessage(message);
33931
33931
  let settled = false;
33932
33932
  const onError = (error62) => {
@@ -33941,14 +33941,14 @@ var StdioServerTransport = class {
33941
33941
  settled = true;
33942
33942
  this._stdout.off("error", onError);
33943
33943
  this._stdout.off("drain", onDrain);
33944
- resolve();
33944
+ resolve4();
33945
33945
  };
33946
33946
  this._stdout.once("error", onError);
33947
33947
  if (this._stdout.write(json2)) {
33948
33948
  if (settled) return;
33949
33949
  settled = true;
33950
33950
  this._stdout.off("error", onError);
33951
- resolve();
33951
+ resolve4();
33952
33952
  } else if (!settled) this._stdout.once("drain", onDrain);
33953
33953
  });
33954
33954
  }
@@ -34002,14 +34002,14 @@ var StdioConnectionChannel = class {
34002
34002
  */
34003
34003
  async whenRequestsAnswered(timeoutMs) {
34004
34004
  if (this._closed || this._pendingRequests.size === 0) return true;
34005
- return await new Promise((resolve) => {
34005
+ return await new Promise((resolve4) => {
34006
34006
  const waiter = () => {
34007
34007
  clearTimeout(timer);
34008
- resolve(true);
34008
+ resolve4(true);
34009
34009
  };
34010
34010
  const timer = setTimeout(() => {
34011
34011
  this._drainWaiters = this._drainWaiters.filter((pending) => pending !== waiter);
34012
- resolve(false);
34012
+ resolve4(false);
34013
34013
  }, timeoutMs);
34014
34014
  this._drainWaiters.push(waiter);
34015
34015
  });
@@ -34379,13 +34379,28 @@ var API_KEY_RE = new RegExp([
34379
34379
  "whsec_[A-Za-z0-9]{16,}\\b"
34380
34380
  // webhook signing secret (Stripe-style)
34381
34381
  ].map((p) => `\\b${p}`).join("|"), "g");
34382
- var QUERY_SECRET_RE = /([?&](?:access_token|refresh_token|client_secret|api_?key|signature|token|key|sig)=)[^&#\s"'<>`]+/gi;
34382
+ var QUERY_SECRET_RE = /([?&](?:(?:access|refresh|id|auth|session|csrf|xsrf)[_-]?token|client[_-]?secret|api[_-]?secret|api[_-]?key|password|passwd|signature|token|key|sig)=)[^&#\s"'<>`]+/gi;
34383
+ var OAUTH_CODE_RE = /([?&]code=)(?=[^&#\s"'<>`]{16,})[^&#\s"'<>`]+/gi;
34384
+ var FORM_PASSWORD_RE = /((?:^|[\s,;:"'(\[{])(?:password|passwd)=)[^&#\s"'<>`]+/gim;
34385
+ var HEADER_SECRET_RE = /(\b(?:x[-_][a-z0-9_-]*?(?:api[-_]?key|token|secret|auth)[a-z0-9_-]*|api[-_]?key)\s*:\s*)[^\s,;"'<>`]+/gi;
34383
34386
  var AWS_SIGV4_RE = /([?&]X-Amz-(?:Signature|Security-Token|Credential)=)[^&#\s"'<>`]+/gi;
34384
- var JSON_SECRET_KEYS = "access_token|refresh_token|client_secret|api_?key|password|passwd|secret|token";
34385
- var JSON_SECRET_DQ_RE = new RegExp(`("(?:${JSON_SECRET_KEYS})"\\s*:\\s*")[^"]*(")`, "gi");
34386
- var JSON_SECRET_SQ_RE = new RegExp(`('(?:${JSON_SECRET_KEYS})'\\s*:\\s*')[^']*(')`, "gi");
34387
+ var JSON_SECRET_KEYS = [
34388
+ "(?:access|refresh|id|auth|session|bearer|csrf|xsrf)[_-]?token",
34389
+ "client[_-]?secret",
34390
+ "api[_-]?secret",
34391
+ "(?:x[_-])?api[_-]?key",
34392
+ "private[_-]?key",
34393
+ "x[_-][a-z0-9_-]*?(?:api[_-]?key|token|secret|auth)[a-z0-9_-]*",
34394
+ "(?:proxy-)?authorization",
34395
+ "password",
34396
+ "passwd",
34397
+ "secret",
34398
+ "token"
34399
+ ].join("|");
34400
+ var JSON_SECRET_DQ_RE = new RegExp(`("(?:${JSON_SECRET_KEYS})"\\s*:\\s*")(?:[^"\\\\]|\\\\.)*(")`, "gi");
34401
+ var JSON_SECRET_SQ_RE = new RegExp(`('(?:${JSON_SECRET_KEYS})'\\s*:\\s*')(?:[^'\\\\]|\\\\.)*(')`, "gi");
34387
34402
  function redactSecrets(text) {
34388
- return text.replace(BEARER_RE, "$1[REDACTED]").replace(BASIC_AUTH_RE, "$1[REDACTED]").replace(SET_COOKIE_RE, "$1$2=[REDACTED]").replace(COOKIE_HEADER_RE, (_m, prefix, pairs) => `${prefix}${pairs.replace(/=[^;,\s]*/g, "=[REDACTED]")}`).replace(API_KEY_RE, "[REDACTED]").replace(QUERY_SECRET_RE, "$1[REDACTED]").replace(AWS_SIGV4_RE, "$1[REDACTED]").replace(JSON_SECRET_DQ_RE, "$1[REDACTED]$2").replace(JSON_SECRET_SQ_RE, "$1[REDACTED]$2").replace(JWT_RE, "[REDACTED]");
34403
+ return text.replace(BEARER_RE, "$1[REDACTED]").replace(BASIC_AUTH_RE, "$1[REDACTED]").replace(SET_COOKIE_RE, "$1$2=[REDACTED]").replace(COOKIE_HEADER_RE, (_m, prefix, pairs) => `${prefix}${pairs.replace(/=[^;,\s]*/g, "=[REDACTED]")}`).replace(API_KEY_RE, "[REDACTED]").replace(HEADER_SECRET_RE, "$1[REDACTED]").replace(QUERY_SECRET_RE, "$1[REDACTED]").replace(OAUTH_CODE_RE, "$1[REDACTED]").replace(FORM_PASSWORD_RE, "$1[REDACTED]").replace(AWS_SIGV4_RE, "$1[REDACTED]").replace(JSON_SECRET_DQ_RE, "$1[REDACTED]$2").replace(JSON_SECRET_SQ_RE, "$1[REDACTED]$2").replace(JWT_RE, "[REDACTED]");
34389
34404
  }
34390
34405
 
34391
34406
  // ../../node_modules/@chrischall/mcp-utils/dist/response/view.js
@@ -34568,13 +34583,47 @@ async function createMcpServer(opts) {
34568
34583
  }
34569
34584
  return server;
34570
34585
  }
34586
+ var DEFAULT_SHUTDOWN_TIMEOUT_MS = 5e3;
34587
+ var DEFAULT_REPEAT_SIGNAL_GRACE_MS = 500;
34571
34588
  function withGracefulShutdown(target, opts = {}) {
34572
34589
  const shouldExit = opts.exit ?? true;
34590
+ if (opts.timeoutMs !== void 0 && !(Number.isFinite(opts.timeoutMs) && opts.timeoutMs > 0)) {
34591
+ throw new RangeError("withGracefulShutdown: timeoutMs must be a finite number greater than 0.");
34592
+ }
34593
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS;
34594
+ if (opts.repeatSignalGraceMs !== void 0 && !(Number.isFinite(opts.repeatSignalGraceMs) && opts.repeatSignalGraceMs >= 0)) {
34595
+ throw new RangeError("withGracefulShutdown: repeatSignalGraceMs must be a finite number >= 0.");
34596
+ }
34597
+ const repeatGraceMs = opts.repeatSignalGraceMs ?? DEFAULT_REPEAT_SIGNAL_GRACE_MS;
34573
34598
  let shuttingDown = false;
34599
+ let firstSignalAt = 0;
34600
+ let exited = false;
34601
+ const exitOnce = () => {
34602
+ if (exited)
34603
+ return;
34604
+ exited = true;
34605
+ process.exit(0);
34606
+ };
34574
34607
  const handler = (signal) => {
34575
- if (shuttingDown)
34608
+ if (shuttingDown) {
34609
+ if (Date.now() - firstSignalAt < repeatGraceMs)
34610
+ return;
34611
+ if (shouldExit) {
34612
+ console.error(`[mcp-utils] second ${signal} during shutdown \u2014 exiting now`);
34613
+ exitOnce();
34614
+ }
34576
34615
  return;
34616
+ }
34577
34617
  shuttingDown = true;
34618
+ firstSignalAt = Date.now();
34619
+ let timer;
34620
+ if (shouldExit) {
34621
+ timer = setTimeout(() => {
34622
+ console.error(`[mcp-utils] graceful shutdown on ${signal} did not finish in ${timeoutMs}ms \u2014 exiting`);
34623
+ exitOnce();
34624
+ }, timeoutMs);
34625
+ timer.unref?.();
34626
+ }
34578
34627
  void (async () => {
34579
34628
  try {
34580
34629
  if (opts.onSignal)
@@ -34583,8 +34632,10 @@ function withGracefulShutdown(target, opts = {}) {
34583
34632
  } catch (err) {
34584
34633
  console.error(`[mcp-utils] error during graceful shutdown on ${signal}: ${err instanceof Error ? err.message : String(err)}`);
34585
34634
  } finally {
34635
+ if (timer !== void 0)
34636
+ clearTimeout(timer);
34586
34637
  if (shouldExit)
34587
- process.exit(0);
34638
+ exitOnce();
34588
34639
  }
34589
34640
  })();
34590
34641
  };
@@ -34614,6 +34665,8 @@ function runMcp(opts) {
34614
34665
  }
34615
34666
 
34616
34667
  // ../../node_modules/@chrischall/mcp-utils/dist/config/index.js
34668
+ import { homedir } from "node:os";
34669
+ import { isAbsolute, join, resolve } from "node:path";
34617
34670
  var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
34618
34671
  function readEnvVar(key, opts = {}) {
34619
34672
  const env = opts.env ?? process.env;
@@ -34640,6 +34693,50 @@ function parseBoolEnv(key, opts = {}) {
34640
34693
  return false;
34641
34694
  return fallback;
34642
34695
  }
34696
+ function expandPath(p) {
34697
+ let expanded = p;
34698
+ if (p === "~") {
34699
+ expanded = homedir();
34700
+ } else if (p.startsWith("~/")) {
34701
+ expanded = join(homedir(), p.slice(2));
34702
+ }
34703
+ return isAbsolute(expanded) ? expanded : resolve(expanded);
34704
+ }
34705
+
34706
+ // ../../node_modules/@chrischall/mcp-utils/dist/fs/confine.js
34707
+ import { existsSync, realpathSync } from "node:fs";
34708
+ import { dirname, isAbsolute as isAbsolute2, relative, resolve as resolve2, sep } from "node:path";
34709
+ function isInside(root, target) {
34710
+ const rel = relative(root, target);
34711
+ return rel === "" || !rel.startsWith(`..${sep}`) && rel !== ".." && !isAbsolute2(rel);
34712
+ }
34713
+ function realPathAllowingMissing(p) {
34714
+ const abs = resolve2(p);
34715
+ let existing = abs;
34716
+ const tail = [];
34717
+ while (!existsSync(existing)) {
34718
+ const parent = dirname(existing);
34719
+ if (parent === existing)
34720
+ break;
34721
+ tail.unshift(existing.slice(parent.length).replace(/^[/\\]+/, ""));
34722
+ existing = parent;
34723
+ }
34724
+ let real;
34725
+ try {
34726
+ real = realpathSync(existing);
34727
+ } catch {
34728
+ real = existing;
34729
+ }
34730
+ return tail.length > 0 ? resolve2(real, ...tail) : real;
34731
+ }
34732
+ function assertPathWithinRoots(path, roots) {
34733
+ const target = realPathAllowingMissing(expandPath(path));
34734
+ for (const root of roots) {
34735
+ if (isInside(realPathAllowingMissing(expandPath(root)), target))
34736
+ return target;
34737
+ }
34738
+ throw new Error(`Path is outside the allowed directories: ${path}`);
34739
+ }
34643
34740
 
34644
34741
  // ../../node_modules/@chrischall/mcp-utils/dist/zod/index.js
34645
34742
  var PositiveInt = external_exports.number().int().positive();
@@ -34661,7 +34758,7 @@ var pageSchema = {
34661
34758
  };
34662
34759
 
34663
34760
  // ../gogcli-mcp/src/runner.ts
34664
- import { delimiter, join } from "node:path";
34761
+ import { delimiter, join as join2 } from "node:path";
34665
34762
 
34666
34763
  // ../gogcli-mcp/src/timestamps.ts
34667
34764
  var DEFAULT_DISPLAY_TZ = "America/New_York";
@@ -34862,9 +34959,48 @@ function normalizeTimestamps(text, tz = displayTimeZone(), naiveTz = naiveSource
34862
34959
  return JSON.stringify(parsed, null, detectIndent(text));
34863
34960
  }
34864
34961
 
34962
+ // ../gogcli-mcp/src/arg-guard.ts
34963
+ var FORBIDDEN_LONG_FLAG = /^--(readonly|enable-commands|enable-commands-exact|disable-commands|access-token|home|account|acct|client|gmail-no-send|no-input|non-interactive|noninteractive)(=|$)/i;
34964
+ var SHORT_ACCOUNT_CLUSTER = /^-(?!-)[A-Za-z]*a/;
34965
+ function forbiddenArgReason(arg) {
34966
+ if (arg === "--") {
34967
+ return 'The argument "--" is not allowed: it ends flag parsing and would disable safety flags appended after it.';
34968
+ }
34969
+ const match = FORBIDDEN_LONG_FLAG.exec(arg);
34970
+ if (match) {
34971
+ return `The flag ${arg} is not allowed here: --${match[1].toLowerCase()} is a safety/credential control set by the server operator, not a per-call option.`;
34972
+ }
34973
+ if (SHORT_ACCOUNT_CLUSTER.test(arg)) {
34974
+ return `The flag ${arg} is not allowed here: -a selects the account. Use the tool's account parameter instead.`;
34975
+ }
34976
+ return void 0;
34977
+ }
34978
+ function assertSafeForwardedArgs(args) {
34979
+ for (const arg of args) {
34980
+ const reason = forbiddenArgReason(arg);
34981
+ if (reason) throw new Error(reason);
34982
+ }
34983
+ }
34984
+ var SUBCOMMAND_SHAPE = /^[a-z][a-z0-9-]*$/;
34985
+ function assertSafeSubcommand(subcommand) {
34986
+ if (!SUBCOMMAND_SHAPE.test(subcommand)) {
34987
+ throw new Error(
34988
+ `Invalid subcommand ${JSON.stringify(subcommand)}: pass a single gog subcommand name such as "list" or "mark-read", and put its arguments in args.`
34989
+ );
34990
+ }
34991
+ }
34992
+
34993
+ // ../gogcli-mcp/src/argv.ts
34994
+ function pos(value) {
34995
+ return { kind: "positional", value };
34996
+ }
34997
+ function isGogPositional(arg) {
34998
+ return typeof arg === "object" && arg !== null && arg.kind === "positional";
34999
+ }
35000
+
34865
35001
  // ../gogcli-mcp/src/runner.ts
34866
35002
  function isGogFileArg(arg) {
34867
- return typeof arg !== "string";
35003
+ return typeof arg !== "string" && arg.kind === "file";
34868
35004
  }
34869
35005
  var TIMEOUT_MS = 3e4;
34870
35006
  function readonlyEnvEnabled() {
@@ -34948,8 +35084,8 @@ function formatTimeout(ms) {
34948
35084
  }
34949
35085
  async function spawnWithTempFiles(args, opts) {
34950
35086
  const { mkdtemp, mkdir, writeFile, rm } = await import("node:fs/promises");
34951
- const { tmpdir } = await import("node:os");
34952
- const dir = await mkdtemp(join(tmpdir(), "gogcli-mcp-"));
35087
+ const { tmpdir: tmpdir2 } = await import("node:os");
35088
+ const dir = await mkdtemp(join2(tmpdir2(), "gogcli-mcp-"));
34953
35089
  try {
34954
35090
  const argv = [];
34955
35091
  let seq = 0;
@@ -34958,10 +35094,10 @@ async function spawnWithTempFiles(args, opts) {
34958
35094
  argv.push(arg);
34959
35095
  continue;
34960
35096
  }
34961
- const sub = join(dir, String(seq));
35097
+ const sub = join2(dir, String(seq));
34962
35098
  seq += 1;
34963
35099
  await mkdir(sub, { recursive: true, mode: 448 });
34964
- const path = join(sub, arg.filename ?? `${arg.flag}.${arg.ext ?? "txt"}`);
35100
+ const path = join2(sub, arg.filename ?? `${arg.flag}.${arg.ext ?? "txt"}`);
34965
35101
  const data = arg.encoding === "base64" ? Buffer.from(arg.contents, "base64") : Buffer.from(arg.contents, "utf8");
34966
35102
  await writeFile(path, data, { mode: 384 });
34967
35103
  argv.push(arg.positional ? path : `--${arg.flag}=${path}`);
@@ -34979,10 +35115,10 @@ function spawnExecutor(args, opts) {
34979
35115
  return spawnGog(args, opts);
34980
35116
  }
34981
35117
  async function spawnGog(fullArgs, opts) {
34982
- const { timeout, interactive = false, spawner, binary = false } = opts;
35118
+ const { timeout, interactive = false, spawner, binary = false, maxOutputBytes } = opts;
34983
35119
  const spawn = spawner ?? (await import("node:child_process")).spawn;
34984
35120
  const effectiveTimeout = timeout ?? TIMEOUT_MS;
34985
- return new Promise((resolve, reject) => {
35121
+ return new Promise((resolve4, reject) => {
34986
35122
  const childEnv = { ...sanitizedEnv(), GOG_TIMEZONE: naiveSourceTimeZone(), PATH: augmentedPath() };
34987
35123
  const child = spawn(readEnvVar("GOG_PATH") ?? "gog", fullArgs, { env: childEnv });
34988
35124
  const stdoutChunks = [];
@@ -35000,7 +35136,17 @@ async function spawnGog(fullArgs, opts) {
35000
35136
  child.kill();
35001
35137
  reject(new Error(`gog timed out after ${formatTimeout(effectiveTimeout)}`));
35002
35138
  }, effectiveTimeout);
35139
+ let stdoutBytes = 0;
35003
35140
  child.stdout.on("data", (chunk) => {
35141
+ if (settled) return;
35142
+ stdoutBytes += chunk.length;
35143
+ if (maxOutputBytes !== void 0 && stdoutBytes > maxOutputBytes) {
35144
+ settled = true;
35145
+ stopWatching();
35146
+ child.kill();
35147
+ reject(new Error(`gog output exceeded the limit: more than ${maxOutputBytes} bytes`));
35148
+ return;
35149
+ }
35004
35150
  stdoutChunks.push(chunk);
35005
35151
  });
35006
35152
  child.stderr.on("data", (chunk) => {
@@ -35017,14 +35163,14 @@ async function spawnGog(fullArgs, opts) {
35017
35163
  const stderr = Buffer.concat(stderrChunks).toString().trim();
35018
35164
  if (code === 0) {
35019
35165
  if (binary) {
35020
- resolve(Buffer.concat(stdoutChunks).toString("base64"));
35166
+ resolve4(Buffer.concat(stdoutChunks).toString("base64"));
35021
35167
  return;
35022
35168
  }
35023
35169
  const stdout = Buffer.concat(stdoutChunks).toString();
35024
35170
  if (interactive && stderr) {
35025
- resolve(stdout + "\n" + stderr);
35171
+ resolve4(stdout + "\n" + stderr);
35026
35172
  } else {
35027
- resolve(stdout);
35173
+ resolve4(stdout);
35028
35174
  }
35029
35175
  } else {
35030
35176
  reject(new Error(stderr || `gog exited with code ${code}`));
@@ -35044,7 +35190,33 @@ async function spawnGog(fullArgs, opts) {
35044
35190
  });
35045
35191
  });
35046
35192
  }
35193
+ function placePositionals(args) {
35194
+ const flags = [];
35195
+ const positionals = [];
35196
+ let afterSeparator = false;
35197
+ for (const arg of args) {
35198
+ if (arg === "--") {
35199
+ afterSeparator = true;
35200
+ } else if (isGogPositional(arg)) {
35201
+ positionals.push(arg.value);
35202
+ } else if (afterSeparator || isGogFileArg(arg) && arg.positional) {
35203
+ positionals.push(arg);
35204
+ } else {
35205
+ flags.push(arg);
35206
+ }
35207
+ }
35208
+ return { flags, positionals };
35209
+ }
35210
+ function assertNoSafetyOverrides(flags) {
35211
+ for (const arg of flags) {
35212
+ if (typeof arg !== "string") continue;
35213
+ const reason = forbiddenArgReason(arg);
35214
+ if (reason) throw new Error(reason);
35215
+ }
35216
+ }
35047
35217
  function assembleArgs(args, opts) {
35218
+ const { flags, positionals } = placePositionals(args);
35219
+ assertNoSafetyOverrides(flags);
35048
35220
  const effectiveAccount = opts.account ?? readEnvVar("GOG_ACCOUNT");
35049
35221
  const fullArgs = ["--json", "--color=never"];
35050
35222
  if (!opts.interactive) {
@@ -35053,17 +35225,21 @@ function assembleArgs(args, opts) {
35053
35225
  if (opts.readonly || readonlyEnvEnabled()) {
35054
35226
  fullArgs.push("--readonly");
35055
35227
  }
35228
+ if (opts.gmailNoSend) {
35229
+ fullArgs.push("--gmail-no-send");
35230
+ }
35056
35231
  if (effectiveAccount) {
35057
35232
  fullArgs.push("--account", effectiveAccount);
35058
35233
  }
35059
- fullArgs.push(...args);
35234
+ fullArgs.push(...flags);
35235
+ if (positionals.length > 0) fullArgs.push("--", ...positionals);
35060
35236
  return fullArgs;
35061
35237
  }
35062
35238
  async function run(args, options = {}) {
35063
- const { account, spawner, interactive = false, timeout, readonly: readonly2 = false, redactMode = "full", opaqueFields } = options;
35239
+ const { account, spawner, interactive = false, timeout, readonly: readonly2 = false, redactMode = "full", opaqueFields, gmailNoSend = false } = options;
35064
35240
  const base = redactMode === "tokens" ? redactGoogleTokens : redactSecrets2;
35065
35241
  const redact = opaqueFields?.length ? (text) => redactPreservingOpaqueFields(text, opaqueFields, base) : base;
35066
- const fullArgs = assembleArgs(args, { account, interactive, readonly: readonly2 });
35242
+ const fullArgs = assembleArgs(args, { account, interactive, readonly: readonly2, gmailNoSend });
35067
35243
  try {
35068
35244
  return redact(await spawnExecutor(fullArgs, { timeout, interactive, spawner }));
35069
35245
  } catch (err) {
@@ -35120,6 +35296,107 @@ function annotateTruncatedList(result, itemsKey) {
35120
35296
  return rawTextResult(JSON.stringify(out));
35121
35297
  }
35122
35298
 
35299
+ // ../gogcli-mcp/src/file-roots.ts
35300
+ import { homedir as homedir2 } from "node:os";
35301
+ import { delimiter as delimiter2, join as join4 } from "node:path";
35302
+
35303
+ // ../gogcli-mcp/src/attachment-root.ts
35304
+ import { tmpdir, userInfo } from "node:os";
35305
+ import { dirname as dirname2, join as join3, relative as relative2, resolve as resolve3, isAbsolute as isAbsolute3, sep as sep2 } from "node:path";
35306
+ var ATTACHMENT_DOWNLOAD_ROOT = join3(tmpdir(), `gogcli-mcp-attachments-${userInfo().uid}`);
35307
+ var ATTACHMENT_TTL_MS = 24 * 60 * 60 * 1e3;
35308
+
35309
+ // ../gogcli-mcp/src/file-roots.ts
35310
+ var FILE_ROOTS_ENV = "GOG_FILE_ROOTS";
35311
+ function defaultFileRoot() {
35312
+ return join4(homedir2(), "gogcli-mcp-files");
35313
+ }
35314
+ function fileRoots() {
35315
+ const raw = readEnvVar(FILE_ROOTS_ENV);
35316
+ const roots = (raw ?? "").split(delimiter2).map((r) => r.trim()).filter(Boolean);
35317
+ return roots.length > 0 ? roots : [defaultFileRoot()];
35318
+ }
35319
+ function confinePath(path, param, opts = {}) {
35320
+ if (opts.allowDash && path === "-") return path;
35321
+ const roots = [...fileRoots(), ATTACHMENT_DOWNLOAD_ROOT];
35322
+ try {
35323
+ assertPathWithinRoots(path, roots);
35324
+ } catch {
35325
+ throw new Error(
35326
+ `${param} ${JSON.stringify(path)} is outside the directories this server may read or write (${roots.join(", ")}). Put the file in one of them, or ask the server operator to widen ${FILE_ROOTS_ENV}.`
35327
+ );
35328
+ }
35329
+ return path;
35330
+ }
35331
+
35332
+ // ../gogcli-mcp/src/run-path-guard.ts
35333
+ var POSITIONAL_PATH_SUBCOMMANDS = {
35334
+ appscript: { pull: "gog_appscript_pull" },
35335
+ drive: { upload: "gog_drive_upload", sync: "gog_drive_sync_push" },
35336
+ gmail: { import: "gog_gmail_import" },
35337
+ slides: {
35338
+ "add-slide": "gog_slides_add_slide",
35339
+ "insert-image": "gog_slides_insert_image",
35340
+ "replace-slide": "gog_slides_replace_slide"
35341
+ }
35342
+ };
35343
+ var PATH_FLAGS = /* @__PURE__ */ new Set(["out", "output", "out-dir", "output-dir", "dir", "worker-dir", "attach", "file", "key", "cert", "replacements"]);
35344
+ var ID_FLAGS = {
35345
+ drive: /* @__PURE__ */ new Set(["file", "filter-file"])
35346
+ };
35347
+ var EXEC_FLAGS = /* @__PURE__ */ new Set(["on-change", "on-new", "mmdc"]);
35348
+ var SHORT_PATH_CLUSTER = /^-(?!-)[A-Za-z]*[of]/;
35349
+ var LONG_FLAG = /^--([A-Za-z0-9][A-Za-z0-9-]*)(?:=([\s\S]*))?$/;
35350
+ function isPathFlag(service, name) {
35351
+ if (ID_FLAGS[service]?.has(name)) return false;
35352
+ return PATH_FLAGS.has(name) || name.endsWith("-file");
35353
+ }
35354
+ function confineFlagValue(flag, value) {
35355
+ if (value === "-") return;
35356
+ confinePath(value, flag);
35357
+ for (const part of value.split(",")) {
35358
+ if (part !== "" && part !== "-") confinePath(part, flag);
35359
+ }
35360
+ }
35361
+ function positionalPathTool(service, subcommand) {
35362
+ return POSITIONAL_PATH_SUBCOMMANDS[service]?.[subcommand];
35363
+ }
35364
+ function assertRunPathsConfined(service, subcommand, args) {
35365
+ const dedicated = positionalPathTool(service, subcommand);
35366
+ if (dedicated) {
35367
+ throw new Error(
35368
+ `gog ${service} ${subcommand} reads or writes a local path given as a positional argument, so it is not available through gog_${service}_run. Use ${dedicated}, which confines the path to GOG_FILE_ROOTS.`
35369
+ );
35370
+ }
35371
+ for (let i = 0; i < args.length; i++) {
35372
+ const arg = args[i];
35373
+ if (SHORT_PATH_CLUSTER.test(arg)) {
35374
+ throw new Error(
35375
+ `The flag ${arg} is not allowed here: spell a path flag out as --out or --file (e.g. --out=<path>) so its path can be checked against GOG_FILE_ROOTS.`
35376
+ );
35377
+ }
35378
+ const match = LONG_FLAG.exec(arg);
35379
+ if (!match) continue;
35380
+ const name = match[1].toLowerCase();
35381
+ if (EXEC_FLAGS.has(name)) {
35382
+ throw new Error(`The flag --${name} is not allowed here: it runs a local program chosen by the caller.`);
35383
+ }
35384
+ const isJson = name.endsWith("-json");
35385
+ if (!isJson && !isPathFlag(service, name)) continue;
35386
+ let value = match[2];
35387
+ if (value === void 0) {
35388
+ value = args[i + 1];
35389
+ if (value === void 0) continue;
35390
+ i++;
35391
+ }
35392
+ if (isJson) {
35393
+ if (value.startsWith("@")) confineFlagValue(`--${name}`, value.slice(1));
35394
+ continue;
35395
+ }
35396
+ confineFlagValue(`--${name}`, value);
35397
+ }
35398
+ }
35399
+
35123
35400
  // ../gogcli-mcp/src/tools/utils.ts
35124
35401
  var accountParam = external_exports.string().optional().describe(
35125
35402
  "Google account email to use, e.g. you@gmail.com \u2014 must be the full address, not a bare username. Overrides the GOG_ACCOUNT env var. Omit to use the single configured account."
@@ -35164,9 +35441,17 @@ var paginationParams = {
35164
35441
  all: external_exports.boolean().optional().describe("Fetch all pages")
35165
35442
  };
35166
35443
  function registerRunTool(server, options) {
35167
- const { service, examples, omitAccount = false, note } = options;
35444
+ const { service, examples, omitAccount = false, note, allowedSubcommands, vet, gmailNoSend = false } = options;
35445
+ for (const [, example] of examples.matchAll(/"([^"]+)"/g)) {
35446
+ const refused = allowedSubcommands && !allowedSubcommands.includes(example) || vet?.(example, []) || positionalPathTool(service, example);
35447
+ if (refused) {
35448
+ throw new Error(`gog_${service}_run example "${example}" is refused by the tool itself; list a subcommand it runs.`);
35449
+ }
35450
+ }
35168
35451
  const baseDescription = `Run any gog ${service} subcommand not covered by the other tools. Run \`gog ${service} --help\` for the full list of subcommands, or \`gog ${service} <subcommand> --help\` for flags on a specific subcommand.`;
35169
- const description = note ? `${baseDescription} ${note}` : baseDescription;
35452
+ const restriction = allowedSubcommands ? ` Only these subcommands are available: ${allowedSubcommands.join(", ")}.` : "";
35453
+ const safety = ' Flags that override server safety controls (--readonly, --enable-commands, --disable-commands, --account, --access-token, --home, --client, --gmail-no-send, --no-input) and a bare "--" are refused. Local file paths (--out, --out-dir, --attach, --file, --*-file, @file JSON) must be inside GOG_FILE_ROOTS; subcommands that take a local path positionally (e.g. drive upload) are refused in favour of their dedicated tools.';
35454
+ const description = `${baseDescription}${restriction}${safety}${note ? ` ${note}` : ""}`;
35170
35455
  const inputSchema = {
35171
35456
  subcommand: external_exports.string().describe(`The gog ${service} subcommand to run, e.g. ${examples}`),
35172
35457
  args: external_exports.array(external_exports.string()).describe("Additional positional args and flags")
@@ -35180,7 +35465,21 @@ function registerRunTool(server, options) {
35180
35465
  inputSchema: external_exports.object(inputSchema)
35181
35466
  }, async (rawArgs) => {
35182
35467
  const { subcommand, args, account } = rawArgs;
35183
- return runOrDiagnose([service, subcommand, ...args], { account });
35468
+ try {
35469
+ assertSafeSubcommand(subcommand);
35470
+ assertSafeForwardedArgs(args);
35471
+ if (allowedSubcommands && !allowedSubcommands.includes(subcommand)) {
35472
+ throw new Error(
35473
+ `gog ${service} ${subcommand} is not available through gog_${service}_run. Allowed: ${allowedSubcommands.join(", ")}.`
35474
+ );
35475
+ }
35476
+ const refusal = vet?.(subcommand, args);
35477
+ if (refusal) throw new Error(refusal);
35478
+ assertRunPathsConfined(service, subcommand, args);
35479
+ } catch (err) {
35480
+ return errorResult(errorText(err));
35481
+ }
35482
+ return runOrDiagnose([service, subcommand, ...args], gmailNoSend ? { account, gmailNoSend } : { account });
35184
35483
  });
35185
35484
  }
35186
35485
  function errorText(err) {
@@ -35302,6 +35601,7 @@ function formatAuthHealth(raw, now) {
35302
35601
  }
35303
35602
 
35304
35603
  // ../gogcli-mcp/src/tools/auth.ts
35604
+ var AUTH_RUN_SUBCOMMANDS = ["list", "status", "services", "remove", "alias"];
35305
35605
  function registerAuthToolsWith(server, defaultServices) {
35306
35606
  const servicesDescribe = `Services to authorize: "all" or comma-separated list (e.g. "sheets,gmail,calendar"). Default: "${defaultServices}". Prefer the narrowest set you need \u2014 requesting a service whose Google API is not enabled on the OAuth client's project makes Google reject the WHOLE request with invalid_scope.`;
35307
35607
  const extraScopesDescribe = "Additional raw OAuth scope URIs to request, comma-separated, on top of the ones `services` implies. Use for scopes no service covers \u2014 e.g. https://www.googleapis.com/auth/bigquery.readonly, required before gog_sheets_datasource_* can read BigQuery-backed Connected Sheets. Leave unset otherwise: an extra scope whose API is not enabled on the OAuth client project makes Google reject the WHOLE authorization with invalid_scope.";
@@ -35359,7 +35659,7 @@ function registerAuthToolsWith(server, defaultServices) {
35359
35659
  })
35360
35660
  }, async ({ email: email3, services = defaultServices, extraScopes }) => {
35361
35661
  try {
35362
- const args = ["auth", "add", email3, "--services", services];
35662
+ const args = ["auth", "add", pos(email3), "--services", services];
35363
35663
  if (extraScopes) args.push(`--extra-scopes=${extraScopes}`, "--force-consent");
35364
35664
  return rawTextResult(await run(args, {
35365
35665
  interactive: true,
@@ -35379,7 +35679,7 @@ function registerAuthToolsWith(server, defaultServices) {
35379
35679
  })
35380
35680
  }, async ({ email: email3, services = defaultServices, extraScopes }) => {
35381
35681
  try {
35382
- const args = ["auth", "add", email3, "--remote", "--step", "1", "--services", services, "--force-consent"];
35682
+ const args = ["auth", "add", pos(email3), "--remote", "--step", "1", "--services", services, "--force-consent"];
35383
35683
  if (extraScopes) args.push(`--extra-scopes=${extraScopes}`);
35384
35684
  return rawTextResult(await run(args, { redactMode: "tokens" }));
35385
35685
  } catch (err) {
@@ -35406,7 +35706,7 @@ function registerAuthToolsWith(server, defaultServices) {
35406
35706
  const args = [
35407
35707
  "auth",
35408
35708
  "add",
35409
- email3,
35709
+ pos(email3),
35410
35710
  "--remote",
35411
35711
  "--step",
35412
35712
  "2",
@@ -35426,6 +35726,7 @@ function registerAuthToolsWith(server, defaultServices) {
35426
35726
  service: "auth",
35427
35727
  examples: '"remove", "alias", "list"',
35428
35728
  omitAccount: true,
35729
+ allowedSubcommands: AUTH_RUN_SUBCOMMANDS,
35429
35730
  note: "For browser-based authorization, use gog_auth_add instead."
35430
35731
  });
35431
35732
  }
@@ -35487,7 +35788,7 @@ function registerCalendarTools(server) {
35487
35788
  })
35488
35789
  }, async ({ calendarId, from, to, days, today, query, max, pageToken, page, all, eventTypes, timezone, view, account }) => {
35489
35790
  const args = ["calendar", "events"];
35490
- if (calendarId) args.push(calendarId);
35791
+ if (calendarId) args.push(pos(calendarId));
35491
35792
  if (from) args.push(`--from=${from}`);
35492
35793
  if (to) args.push(`--to=${to}`);
35493
35794
  if (days !== void 0) args.push(`--days=${days}`);
@@ -35516,7 +35817,7 @@ function registerCalendarTools(server) {
35516
35817
  account: accountParam
35517
35818
  })
35518
35819
  }, async ({ calendarId, eventId, timezone, account }) => {
35519
- const args = ["calendar", "event", calendarId, eventId];
35820
+ const args = ["calendar", "event", pos(calendarId), pos(eventId)];
35520
35821
  if (timezone) args.push(`--timezone=${timezone}`);
35521
35822
  return runOrDiagnose(args, { account });
35522
35823
  });
@@ -35538,7 +35839,7 @@ function registerCalendarTools(server) {
35538
35839
  account: accountParam
35539
35840
  })
35540
35841
  }, async ({ calendarId, summary, from, to, description, location, attendees, allDay, timezone, withZoom, reminders, noReminders, account }) => {
35541
- const args = ["calendar", "create", calendarId, `--summary=${summary}`, `--from=${from}`, `--to=${to}`];
35842
+ const args = ["calendar", "create", pos(calendarId), `--summary=${summary}`, `--from=${from}`, `--to=${to}`];
35542
35843
  if (description) args.push(`--description=${description}`);
35543
35844
  if (location) args.push(`--location=${location}`);
35544
35845
  if (attendees) args.push(`--attendees=${attendees}`);
@@ -35570,7 +35871,7 @@ function registerCalendarTools(server) {
35570
35871
  account: accountParam
35571
35872
  })
35572
35873
  }, async ({ calendarId, eventId, summary, from, to, description, location, attendees, addAttendees, attachments, withZoom, regenerateZoom, removeZoom, removeMeet, reminders, noReminders, account }) => {
35573
- const args = ["calendar", "update", calendarId, eventId];
35874
+ const args = ["calendar", "update", pos(calendarId), pos(eventId)];
35574
35875
  if (summary !== void 0) args.push(`--summary=${summary}`);
35575
35876
  if (from !== void 0) args.push(`--from=${from}`);
35576
35877
  if (to !== void 0) args.push(`--to=${to}`);
@@ -35595,7 +35896,7 @@ function registerCalendarTools(server) {
35595
35896
  account: accountParam
35596
35897
  })
35597
35898
  }, async ({ calendarId, eventId, account }) => {
35598
- return runOrDiagnose(["calendar", "delete", calendarId, eventId, "--force"], { account });
35899
+ return runOrDiagnose(["calendar", "delete", pos(calendarId), pos(eventId), "--force"], { account });
35599
35900
  });
35600
35901
  server.registerTool("gog_calendar_respond", {
35601
35902
  description: "Respond to a calendar event invitation.",
@@ -35608,7 +35909,7 @@ function registerCalendarTools(server) {
35608
35909
  account: accountParam
35609
35910
  })
35610
35911
  }, async ({ calendarId, eventId, status, comment, account }) => {
35611
- const args = ["calendar", "respond", calendarId, eventId, `--status=${status}`];
35912
+ const args = ["calendar", "respond", pos(calendarId), pos(eventId), `--status=${status}`];
35612
35913
  if (comment) args.push(`--comment=${comment}`);
35613
35914
  return runOrDiagnose(args, { account });
35614
35915
  });
@@ -35647,7 +35948,7 @@ var replySchema = {
35647
35948
  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."),
35648
35949
  subject: external_exports.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
35649
35950
  noQuote: external_exports.boolean().optional().describe("Do not include the original message quoted below the reply (default: the original is quoted)"),
35650
- 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.`),
35951
+ 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. Must be inside the server's GOG_FILE_ROOTS directories (default ~/gogcli-mcp-files).`),
35651
35952
  attachInline: attachInlineParam,
35652
35953
  from: external_exports.string().optional().describe("Send from this email address (must be a verified send-as alias)"),
35653
35954
  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."),
@@ -35668,10 +35969,10 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
35668
35969
  );
35669
35970
 
35670
35971
  // ../gogcli-mcp/src/server.ts
35671
- var VERSION = true ? "4.2.5" : "0.0.0";
35972
+ var VERSION = true ? "4.3.0" : "0.0.0";
35672
35973
 
35673
35974
  // ../gogcli-mcp/src/bootstrap-auth.ts
35674
- import { join as join2 } from "node:path";
35975
+ import { join as join5 } from "node:path";
35675
35976
  var AUTH_BOOTSTRAP_MARKER = "auth-bootstrap.sha256";
35676
35977
  var VARS = ["GOG_CLIENT_ID", "GOG_CLIENT_SECRET", "GOG_REFRESH_TOKEN", "GOG_ACCOUNT"];
35677
35978
  var log = (line) => {
@@ -35708,8 +36009,8 @@ async function bootstrapGogAuth(env = process.env, options = {}) {
35708
36009
  const { createHash } = await import("node:crypto");
35709
36010
  const { mkdir, readFile, writeFile, chmod } = await import("node:fs/promises");
35710
36011
  const home = options.home ?? (await import("node:os")).homedir();
35711
- const dir = join2(home, ".gogcli-mcp");
35712
- const marker = join2(dir, AUTH_BOOTSTRAP_MARKER);
36012
+ const dir = join5(home, ".gogcli-mcp");
36013
+ const marker = join5(dir, AUTH_BOOTSTRAP_MARKER);
35713
36014
  const fingerprint = createHash("sha256").update(values.join("\0")).digest("hex");
35714
36015
  const previous = await readFile(marker, "utf8").catch(() => void 0);
35715
36016
  if (previous === fingerprint && await accountListed(account, spawner)) return "present";
@@ -35767,7 +36068,7 @@ function registerExtraCalendarTools(server) {
35767
36068
  account: accountParam
35768
36069
  })
35769
36070
  }, async ({ meetingCode, account }) => {
35770
- return runOrDiagnose(["meet", "get", meetingCode], { account });
36071
+ return runOrDiagnose(["meet", "get", pos(meetingCode)], { account });
35771
36072
  });
35772
36073
  server.registerTool("gog_meet_update", {
35773
36074
  description: "Update a Google Meet space configuration.",
@@ -35778,7 +36079,7 @@ function registerExtraCalendarTools(server) {
35778
36079
  account: accountParam
35779
36080
  })
35780
36081
  }, async ({ meetingCode, access, account }) => {
35781
- const args = ["meet", "update", meetingCode];
36082
+ const args = ["meet", "update", pos(meetingCode)];
35782
36083
  if (access) args.push(`--access=${access}`);
35783
36084
  return runOrDiagnose(args, { account });
35784
36085
  });
@@ -35790,7 +36091,7 @@ function registerExtraCalendarTools(server) {
35790
36091
  account: accountParam
35791
36092
  })
35792
36093
  }, async ({ meetingCode, account }) => {
35793
- return runOrDiagnose(["meet", "end", meetingCode, "--force"], { account });
36094
+ return runOrDiagnose(["meet", "end", pos(meetingCode), "--force"], { account });
35794
36095
  });
35795
36096
  server.registerTool("gog_meet_history", {
35796
36097
  description: "List past calls (conferences) in a Google Meet space.",
@@ -35804,7 +36105,7 @@ function registerExtraCalendarTools(server) {
35804
36105
  account: accountParam
35805
36106
  })
35806
36107
  }, async ({ meetingCode, max, pageToken, page, all, account }) => {
35807
- const args = ["meet", "history", meetingCode];
36108
+ const args = ["meet", "history", pos(meetingCode)];
35808
36109
  if (max !== void 0) args.push(`--max=${max}`);
35809
36110
  const token = resolvePageToken({ pageToken, page });
35810
36111
  if (token) args.push(`--page=${token}`);
@@ -35879,7 +36180,7 @@ function registerExtraCalendarTools(server) {
35879
36180
  account: accountParam
35880
36181
  })
35881
36182
  }, async ({ query, from, to, today, tomorrow, week, days, weekStart, calendar, max, account }) => {
35882
- const args = ["calendar", "search", query];
36183
+ const args = ["calendar", "search", pos(query)];
35883
36184
  if (from) args.push(`--from=${from}`);
35884
36185
  if (to) args.push(`--to=${to}`);
35885
36186
  if (today) args.push("--today");
@@ -35904,7 +36205,7 @@ function registerExtraCalendarTools(server) {
35904
36205
  })
35905
36206
  }, async ({ calendarId, calendarIds, since, max, all, account }) => {
35906
36207
  const args = ["calendar", "changed"];
35907
- if (calendarId) args.push(calendarId);
36208
+ if (calendarId) args.push(pos(calendarId));
35908
36209
  if (calendarIds) args.push(`--calendars=${calendarIds}`);
35909
36210
  if (since) args.push(`--since=${since}`);
35910
36211
  if (max !== void 0) args.push(`--max=${max}`);
@@ -35923,7 +36224,7 @@ function registerExtraCalendarTools(server) {
35923
36224
  })
35924
36225
  }, async ({ from, to, calendarIds, all, account }) => {
35925
36226
  const args = ["calendar", "freebusy"];
35926
- if (calendarIds) args.push(calendarIds);
36227
+ if (calendarIds) args.push(pos(calendarIds));
35927
36228
  args.push(`--from=${from}`);
35928
36229
  args.push(`--to=${to}`);
35929
36230
  if (all) args.push("--all");
@@ -35950,7 +36251,7 @@ function registerExtraCalendarTools(server) {
35950
36251
  account: accountParam
35951
36252
  })
35952
36253
  }, async ({ calendarId, max, pageToken, page, all, account }) => {
35953
- const args = ["calendar", "acl", calendarId];
36254
+ const args = ["calendar", "acl", pos(calendarId)];
35954
36255
  if (max !== void 0) args.push(`--max=${max}`);
35955
36256
  const token = resolvePageToken({ pageToken, page });
35956
36257
  if (token) args.push(`--page=${token}`);
@@ -35968,7 +36269,7 @@ function registerExtraCalendarTools(server) {
35968
36269
  account: accountParam
35969
36270
  })
35970
36271
  }, async ({ calendarId, eventId, destinationCalendarId, sendUpdates, account }) => {
35971
- const args = ["calendar", "move", calendarId, eventId, destinationCalendarId];
36272
+ const args = ["calendar", "move", pos(calendarId), pos(eventId), pos(destinationCalendarId)];
35972
36273
  if (sendUpdates) args.push(`--send-updates=${sendUpdates}`);
35973
36274
  return runOrDiagnose(args, { account });
35974
36275
  });
@@ -35987,7 +36288,7 @@ function registerExtraCalendarTools(server) {
35987
36288
  })
35988
36289
  }, async ({ from, to, calendarId, summary, autoDecline, declineMessage, allDay, account }) => {
35989
36290
  const args = ["calendar", "out-of-office"];
35990
- if (calendarId) args.push(calendarId);
36291
+ if (calendarId) args.push(pos(calendarId));
35991
36292
  args.push(`--from=${from}`);
35992
36293
  args.push(`--to=${to}`);
35993
36294
  if (summary) args.push(`--summary=${summary}`);
@@ -36004,7 +36305,7 @@ function registerExtraCalendarTools(server) {
36004
36305
  account: accountParam
36005
36306
  })
36006
36307
  }, async ({ calendarId, account }) => {
36007
- return runOrDiagnose(["calendar", "unsubscribe", calendarId], { account });
36308
+ return runOrDiagnose(["calendar", "unsubscribe", pos(calendarId)], { account });
36008
36309
  });
36009
36310
  server.registerTool("gog_calendar_delete_calendar", {
36010
36311
  description: "Permanently delete an owned secondary calendar and all its events. Cannot delete your primary calendar. To merely remove a calendar you do not own from your list, use gog_calendar_unsubscribe.",
@@ -36014,7 +36315,7 @@ function registerExtraCalendarTools(server) {
36014
36315
  account: accountParam
36015
36316
  })
36016
36317
  }, async ({ calendarId, account }) => {
36017
- return runOrDiagnose(["calendar", "delete-calendar", calendarId, "--force"], { account });
36318
+ return runOrDiagnose(["calendar", "delete-calendar", pos(calendarId), "--force"], { account });
36018
36319
  });
36019
36320
  server.registerTool("gog_meet_participants", {
36020
36321
  description: "List participants from the latest (or a specific) Meet call.",
@@ -36029,7 +36330,7 @@ function registerExtraCalendarTools(server) {
36029
36330
  account: accountParam
36030
36331
  })
36031
36332
  }, async ({ meetingCode, conference, max, pageToken, page, all, account }) => {
36032
- const args = ["meet", "participants", meetingCode];
36333
+ const args = ["meet", "participants", pos(meetingCode)];
36033
36334
  if (conference) args.push(`--conference=${conference}`);
36034
36335
  if (max !== void 0) args.push(`--max=${max}`);
36035
36336
  const token = resolvePageToken({ pageToken, page });