gogcli-mcp-drive 2.21.0 → 2.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "metadata": {
9
9
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
10
- "version": "2.21.0"
10
+ "version": "2.21.1"
11
11
  },
12
12
  "plugins": [
13
13
  {
@@ -15,7 +15,7 @@
15
15
  "displayName": "gogcli (Drive)",
16
16
  "source": "./",
17
17
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
18
- "version": "2.21.0",
18
+ "version": "2.21.1",
19
19
  "author": {
20
20
  "name": "Chris Hall"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gogcli-mcp-drive",
3
3
  "displayName": "gogcli (Drive)",
4
- "version": "2.21.0",
4
+ "version": "2.21.1",
5
5
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
6
6
  "author": {
7
7
  "name": "Chris Hall",
package/dist/index.js CHANGED
@@ -31140,6 +31140,21 @@ import { delimiter, join } from "node:path";
31140
31140
  function isGogFileArg(arg) {
31141
31141
  return typeof arg !== "string";
31142
31142
  }
31143
+ var RUNNER_TRANSPORT_BRAND = /* @__PURE__ */ Symbol.for("gogcli.RunnerTransportError");
31144
+ var RunnerTransportError = class extends Error {
31145
+ kind;
31146
+ status;
31147
+ constructor(message, kind, status) {
31148
+ super(message);
31149
+ this.name = "RunnerTransportError";
31150
+ this.kind = kind;
31151
+ this.status = status;
31152
+ Object.defineProperty(this, RUNNER_TRANSPORT_BRAND, { value: true });
31153
+ }
31154
+ };
31155
+ function isRunnerTransportError(err) {
31156
+ return err instanceof Error && err[RUNNER_TRANSPORT_BRAND] === true;
31157
+ }
31143
31158
  var runExecutor = new AsyncLocalStorage();
31144
31159
  var defaultExecutor;
31145
31160
  function setDefaultGogExecutor(executor) {
@@ -31320,7 +31335,11 @@ async function run(args, options = {}) {
31320
31335
  }
31321
31336
  return redact(output);
31322
31337
  } catch (err) {
31323
- throw new Error(redact(err instanceof Error ? err.message : String(err)));
31338
+ const message = redact(err instanceof Error ? err.message : String(err));
31339
+ if (isRunnerTransportError(err)) {
31340
+ throw new RunnerTransportError(message, err.kind, err.status);
31341
+ }
31342
+ throw new Error(message);
31324
31343
  }
31325
31344
  }
31326
31345
  async function runBinary(args, options = {}) {
@@ -31587,7 +31606,7 @@ function registerRunTool(server, options) {
31587
31606
  function errorText(err) {
31588
31607
  return err instanceof Error ? `Error: ${err.message}` : String(err);
31589
31608
  }
31590
- var DEFINITE_AUTH_PATTERN = /\b(401|unauthorized|invalid_grant)\b/i;
31609
+ var DEFINITE_AUTH_PATTERN = /\b(?:unauthorized|invalid_grant)\b|\b(?:error|status|code|http|responded|response)["']?[\s:=(,]{0,4}401\b/i;
31591
31610
  var STALE_TOKEN_PATTERN = /\b(?:access[ _-]?)?token\b[^.;\n]{0,40}\b(?:has\s+)?(?:been\s+)?(?:expired|revoked)\b|\b(?:expired|revoked)\s+(?:access[ _-]?)?token\b/i;
31592
31611
  var AUTH_ERROR_PATTERN = new RegExp(`${DEFINITE_AUTH_PATTERN.source}|${STALE_TOKEN_PATTERN.source}`, "i");
31593
31612
  var INVALID_GRANT_PATTERN = /invalid_grant|token has been expired or revoked/i;
@@ -31597,6 +31616,14 @@ var AUTH_HINT = "\n\nAuthentication may have expired. Use gog_auth_add to re-aut
31597
31616
  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.';
31598
31617
  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).";
31599
31618
  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.";
31619
+ 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.";
31620
+ var RUNNER_TRANSPORT_HINTS = {
31621
+ "transport-auth": RUNNER_TRANSPORT_AUTH_HINT,
31622
+ // The request itself was malformed, so the runner will refuse it identically
31623
+ // every time. Nothing to advise beyond the message the runner already gave.
31624
+ "transport-request": "",
31625
+ "transport-retryable": TRANSIENT_HINT
31626
+ };
31600
31627
  function formatAccountList(raw) {
31601
31628
  try {
31602
31629
  const parsed = JSON.parse(raw);
@@ -31609,11 +31636,12 @@ function formatAccountList(raw) {
31609
31636
  }
31610
31637
  async function diagnose(err) {
31611
31638
  const errText = errorText(err);
31639
+ const transportHint = isRunnerTransportError(err) ? RUNNER_TRANSPORT_HINTS[err.kind] : void 0;
31612
31640
  const isInvalidGrant = INVALID_GRANT_PATTERN.test(errText);
31613
31641
  const isTransientError = !DEFINITE_AUTH_PATTERN.test(errText) && TRANSIENT_ERROR_PATTERN.test(errText);
31614
31642
  const isAuthError = !isTransientError && AUTH_ERROR_PATTERN.test(errText);
31615
31643
  const isGridLimitError = GRID_LIMIT_ERROR_PATTERN.test(errText);
31616
- const hint = isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "";
31644
+ const hint = transportHint ?? (isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "");
31617
31645
  try {
31618
31646
  const accounts = formatAccountList(await run(["auth", "list"]));
31619
31647
  return errorResult(`${errText}
@@ -32021,7 +32049,25 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
32021
32049
  );
32022
32050
 
32023
32051
  // ../gogcli-mcp/src/server.ts
32024
- var VERSION = true ? "2.21.0" : "0.0.0";
32052
+ var VERSION = true ? "2.21.1" : "0.0.0";
32053
+
32054
+ // ../gogcli-mcp/src/auth-log.ts
32055
+ var FAILURES = /* @__PURE__ */ new Set([
32056
+ "token.mint-failed",
32057
+ "grant.dead",
32058
+ "replay.failed",
32059
+ "runner.auth-failed"
32060
+ ]);
32061
+ var PREFIX = "gog-auth ";
32062
+ var TAG_CHARS = 12;
32063
+ function credentialTag(cacheKeyHash) {
32064
+ return cacheKeyHash.slice(0, TAG_CHARS);
32065
+ }
32066
+ function logAuthTransition(event, context) {
32067
+ const record2 = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...context });
32068
+ const write = FAILURES.has(event) ? console.error : console.warn;
32069
+ write(PREFIX + redactSecrets2(record2));
32070
+ }
32025
32071
 
32026
32072
  // ../gogcli-mcp/src/google-token.ts
32027
32073
  var TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
@@ -32048,22 +32094,73 @@ function makeAccessTokenSource(env) {
32048
32094
  );
32049
32095
  };
32050
32096
  }
32051
- return async () => {
32052
- const key = await cacheKey(refreshToken, clientId);
32053
- const hit = cache.get(key);
32054
- if (hit && hit.expiresAt - EXPIRY_MARGIN_MS > Date.now()) return hit.accessToken;
32055
- let pending = inFlight.get(key);
32097
+ let keyPromise;
32098
+ const key = () => keyPromise ??= cacheKey(refreshToken, clientId);
32099
+ const logCacheHits = parseBoolEnv("GOG_AUTH_LOG_CACHE_HITS", { env });
32100
+ const read = async () => {
32101
+ const k = await key();
32102
+ const hit = cache.get(k);
32103
+ if (hit && hit.expiresAt - EXPIRY_MARGIN_MS > Date.now()) {
32104
+ if (logCacheHits) logAuthTransition("token.cache-hit", { credential: credentialTag(k) });
32105
+ return hit.accessToken;
32106
+ }
32107
+ let pending = inFlight.get(k);
32056
32108
  if (!pending) {
32057
32109
  pending = exchange(refreshToken, clientId, clientSecret).then((minted2) => {
32058
- cache.set(key, minted2);
32110
+ cache.set(k, minted2);
32111
+ logAuthTransition("token.minted", {
32112
+ credential: credentialTag(k),
32113
+ reason: `valid for ${Math.round((minted2.expiresAt - Date.now()) / 1e3)}s`
32114
+ });
32059
32115
  return minted2;
32060
- }).finally(() => inFlight.delete(key));
32061
- inFlight.set(key, pending);
32116
+ }).catch((err) => {
32117
+ logAuthTransition(err.grantDead ? "grant.dead" : "token.mint-failed", {
32118
+ credential: credentialTag(k),
32119
+ reason: err.message
32120
+ });
32121
+ throw err;
32122
+ }).finally(() => inFlight.delete(k));
32123
+ inFlight.set(k, pending);
32062
32124
  }
32063
32125
  const minted = await pending;
32064
32126
  return minted.accessToken;
32065
32127
  };
32128
+ const invalidate = async (rejected) => {
32129
+ const k = await key();
32130
+ const hit = cache.get(k);
32131
+ if (!hit || hit.accessToken !== rejected) {
32132
+ logAuthTransition("token.evict-noop", {
32133
+ credential: credentialTag(k),
32134
+ reason: hit ? "a concurrent caller had already replaced this credential\u2019s token" : "no token was cached for this credential"
32135
+ });
32136
+ return false;
32137
+ }
32138
+ cache.delete(k);
32139
+ logAuthTransition("token.evicted", {
32140
+ credential: credentialTag(k),
32141
+ reason: "Google rejected this access token; the next read will mint a new one"
32142
+ });
32143
+ return true;
32144
+ };
32145
+ return Object.assign(read, {
32146
+ invalidate,
32147
+ credentialId: async () => credentialTag(await key())
32148
+ });
32066
32149
  }
32150
+ var TokenExchangeError = class extends Error {
32151
+ /**
32152
+ * The REFRESH token is dead (Google's `invalid_grant`), not merely the access
32153
+ * token. Carried as a flag rather than re-read from the message, because
32154
+ * inferring the author of a failure from prose several authors can produce is
32155
+ * precisely the mistake this branch exists to undo. `instanceof` is safe: the
32156
+ * class is thrown and caught inside this one module.
32157
+ */
32158
+ grantDead;
32159
+ constructor(message, grantDead) {
32160
+ super(message);
32161
+ this.grantDead = grantDead;
32162
+ }
32163
+ };
32067
32164
  async function exchange(refreshToken, clientId, clientSecret) {
32068
32165
  let res;
32069
32166
  try {
@@ -32078,23 +32175,29 @@ async function exchange(refreshToken, clientId, clientSecret) {
32078
32175
  }).toString()
32079
32176
  });
32080
32177
  } catch (err) {
32081
- throw new Error(
32082
- `the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}`
32178
+ throw new TokenExchangeError(
32179
+ `the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}`,
32180
+ false
32083
32181
  );
32084
32182
  }
32085
32183
  const body = await res.json().catch(() => ({}));
32086
32184
  if (!res.ok) {
32087
32185
  if (body.error === "invalid_grant") {
32088
- throw new Error(
32089
- 'the stored refresh token 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.'
32186
+ throw new TokenExchangeError(
32187
+ '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.',
32188
+ true
32090
32189
  );
32091
32190
  }
32092
- throw new Error(
32093
- `the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})`
32191
+ throw new TokenExchangeError(
32192
+ `the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})`,
32193
+ false
32094
32194
  );
32095
32195
  }
32096
32196
  if (!body.access_token) {
32097
- throw new Error("the access token could not be refreshed: Google returned no access_token");
32197
+ throw new TokenExchangeError(
32198
+ "the access token could not be refreshed: Google returned no access_token",
32199
+ false
32200
+ );
32098
32201
  }
32099
32202
  const expiresInMs = (body.expires_in ?? 3600) * 1e3;
32100
32203
  return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
@@ -32103,54 +32206,218 @@ async function exchange(refreshToken, clientId, clientSecret) {
32103
32206
  // ../gogcli-mcp/src/connector-runtime.ts
32104
32207
  var DEFAULT_TIMEOUT_MS = 3e4;
32105
32208
  var DEADLINE_GRACE_MS = 5e3;
32209
+ var MIN_REPLAY_BUDGET_MS = 1e3;
32106
32210
  var RUNNER_GOG_FAILED = 422;
32107
32211
  var RUNNER_DRAINING = 503;
32212
+ var RUNNER_BAD_REQUEST = 400;
32213
+ var RUNNER_BAD_KEY = 401;
32214
+ var GogFailedError = class extends Error {
32215
+ /** gog's stderr alone, with no echoed argv mixed in. */
32216
+ stderr;
32217
+ constructor(message, stderr) {
32218
+ super(message);
32219
+ this.stderr = stderr;
32220
+ }
32221
+ };
32222
+ var GOOGLE_TOKEN_REJECTED_PATTERN = /Google API error \(401\b|invalid[ _]authentication[ _]credentials|\bACCESS_TOKEN_EXPIRED\b|\binvalid_token\b/i;
32223
+ var REFRESH_TOKEN_DEAD_PATTERN = /\binvalid_grant\b/i;
32224
+ var READ_ONLY_SUBCOMMANDS = /* @__PURE__ */ new Set([
32225
+ "cat",
32226
+ "describe",
32227
+ "get",
32228
+ "info",
32229
+ "list",
32230
+ "list-slides",
32231
+ "ls",
32232
+ "metadata",
32233
+ "read-slide",
32234
+ "search",
32235
+ "services",
32236
+ "status",
32237
+ "structure"
32238
+ ]);
32239
+ function gogTarget(args) {
32240
+ const words = args.filter((arg) => typeof arg === "string");
32241
+ let service;
32242
+ for (let i = 0; i < words.length; i += 1) {
32243
+ const word = words[i];
32244
+ if (word.startsWith("-")) {
32245
+ if (word === "--account") i += 1;
32246
+ continue;
32247
+ }
32248
+ if (service === void 0) {
32249
+ service = word;
32250
+ continue;
32251
+ }
32252
+ return { service, subcommand: word };
32253
+ }
32254
+ return { service };
32255
+ }
32256
+ async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt) {
32257
+ if (!(err instanceof GogFailedError)) return void 0;
32258
+ const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
32259
+ if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
32260
+ const { service, subcommand } = gogTarget(args);
32261
+ const credential = await readAccessToken?.credentialId?.();
32262
+ const where = { credential, service };
32263
+ if (grantDead) {
32264
+ logAuthTransition("grant.dead", {
32265
+ ...where,
32266
+ reason: "gog reported invalid_grant: the stored refresh token is dead, so no token can be minted and this account must be re-authorized"
32267
+ });
32268
+ return void 0;
32269
+ }
32270
+ if (!used) {
32271
+ logAuthTransition("replay.declined", {
32272
+ ...where,
32273
+ reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
32274
+ });
32275
+ return void 0;
32276
+ }
32277
+ if (!readAccessToken?.invalidate) {
32278
+ logAuthTransition("replay.declined", {
32279
+ ...where,
32280
+ reason: "this token source cannot mint a replacement, so a replay would resend the rejected token"
32281
+ });
32282
+ return void 0;
32283
+ }
32284
+ const evicted = await readAccessToken.invalidate(used);
32285
+ if (subcommand === void 0 || !READ_ONLY_SUBCOMMANDS.has(subcommand)) {
32286
+ logAuthTransition("replay.declined", {
32287
+ ...where,
32288
+ reason: `not replayable: '${subcommand ?? "(none)"}' is not a known read-only subcommand and a write could double-apply`
32289
+ });
32290
+ return void 0;
32291
+ }
32292
+ if (!evicted) {
32293
+ logAuthTransition("replay.declined", {
32294
+ ...where,
32295
+ reason: "the rejected token was already superseded, so the cache holds the token a replay would send"
32296
+ });
32297
+ return void 0;
32298
+ }
32299
+ const fresh = await readAccessToken();
32300
+ if (!fresh) {
32301
+ logAuthTransition("replay.declined", {
32302
+ ...where,
32303
+ reason: "the token source produced no token after eviction; replaying without one would act as the backend"
32304
+ });
32305
+ return void 0;
32306
+ }
32307
+ const budgetMs = deadlineAt - Date.now();
32308
+ if (budgetMs < MIN_REPLAY_BUDGET_MS) {
32309
+ logAuthTransition("replay.declined", {
32310
+ ...where,
32311
+ 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`
32312
+ });
32313
+ return void 0;
32314
+ }
32315
+ return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
32316
+ }
32108
32317
  function makeFlyExecutor(endpoint, key, readAccessToken) {
32109
32318
  return async (args, opts) => {
32110
32319
  const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
32111
32320
  const accessToken = await readAccessToken?.();
32112
- let res;
32321
+ const deadlineAt = Date.now() + deadlineMs;
32113
32322
  try {
32114
- res = await fetch(endpoint + "/run", {
32115
- method: "POST",
32116
- headers: {
32117
- Authorization: "Bearer " + key,
32118
- "Content-Type": "application/json"
32119
- },
32120
- body: JSON.stringify(accessToken ? { args, accessToken } : { args }),
32121
- signal: AbortSignal.timeout(deadlineMs)
32122
- });
32323
+ return await attempt(endpoint, key, args, accessToken, deadlineMs);
32123
32324
  } catch (err) {
32124
- const name = err instanceof Error ? err.name : "";
32125
- if (name === "TimeoutError" || name === "AbortError") {
32126
- throw new Error(
32127
- `gog-runner did not respond within ${deadlineMs}ms (${endpoint}) \u2014 the Fly backend may be cold or wedged`
32128
- );
32325
+ const replay = await remintAfterGoogleRejection(
32326
+ err,
32327
+ accessToken,
32328
+ args,
32329
+ readAccessToken,
32330
+ deadlineAt
32331
+ );
32332
+ if (replay === void 0) throw err;
32333
+ const where = { credential: replay.credential, service: replay.service, endpoint };
32334
+ logAuthTransition("replay.attempted", {
32335
+ ...where,
32336
+ reason: "Google rejected the access token; replaying this read once with a freshly minted one"
32337
+ });
32338
+ try {
32339
+ const stdout = await attempt(endpoint, key, args, replay.token, replay.budgetMs);
32340
+ logAuthTransition("replay.succeeded", where);
32341
+ return stdout;
32342
+ } catch (replayErr) {
32343
+ logAuthTransition("replay.failed", { ...where, reason: String(replayErr) });
32344
+ if (replayErr instanceof GogFailedError && GOOGLE_TOKEN_REJECTED_PATTERN.test(replayErr.stderr)) {
32345
+ await replay.invalidate(replay.token);
32346
+ }
32347
+ throw replayErr;
32129
32348
  }
32130
- throw err;
32131
32349
  }
32132
- if (!res.ok) {
32133
- const body = await res.json().catch(() => null);
32134
- const detail = body && typeof body.error === "string" ? body.stderr && body.stderr.trim() && body.stderr.trim() !== body.error.trim() ? `${body.error}
32350
+ };
32351
+ }
32352
+ async function attempt(endpoint, key, args, accessToken, deadlineMs) {
32353
+ let res;
32354
+ try {
32355
+ res = await fetch(endpoint + "/run", {
32356
+ method: "POST",
32357
+ headers: {
32358
+ Authorization: "Bearer " + key,
32359
+ "Content-Type": "application/json"
32360
+ },
32361
+ body: JSON.stringify(accessToken ? { args, accessToken } : { args }),
32362
+ signal: AbortSignal.timeout(deadlineMs)
32363
+ });
32364
+ } catch (err) {
32365
+ const name = err instanceof Error ? err.name : "";
32366
+ if (name === "TimeoutError" || name === "AbortError") {
32367
+ throw new RunnerTransportError(
32368
+ `gog-runner did not respond within ${deadlineMs}ms (${endpoint}) \u2014 the Fly backend may be cold or wedged`,
32369
+ "transport-retryable"
32370
+ );
32371
+ }
32372
+ throw err;
32373
+ }
32374
+ if (!res.ok) {
32375
+ const body = await res.json().catch(() => null);
32376
+ const detail = body && typeof body.error === "string" ? body.stderr && body.stderr.trim() && body.stderr.trim() !== body.error.trim() ? `${body.error}
32135
32377
  ${body.stderr}` : body.error : "";
32136
- if (res.status === RUNNER_GOG_FAILED) {
32137
- throw new Error(detail || "gog failed on the runner (no detail supplied)");
32138
- }
32139
- if (res.status === RUNNER_DRAINING || body?.retryable === true) {
32140
- throw new Error(
32141
- `gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`
32142
- );
32143
- }
32144
- if (detail) {
32145
- throw new Error(detail);
32146
- }
32147
- throw new Error(
32148
- `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.`
32378
+ if (res.status === RUNNER_GOG_FAILED) {
32379
+ throw new GogFailedError(
32380
+ detail || "gog failed on the runner (no detail supplied)",
32381
+ typeof body?.stderr === "string" ? body.stderr : ""
32149
32382
  );
32150
32383
  }
32151
- const { stdout } = await res.json();
32152
- return stdout;
32153
- };
32384
+ if (res.status === RUNNER_BAD_KEY) {
32385
+ logAuthTransition("runner.auth-failed", {
32386
+ service: gogTarget(args).service,
32387
+ endpoint,
32388
+ 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"
32389
+ });
32390
+ throw new RunnerTransportError(
32391
+ "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.",
32392
+ "transport-auth",
32393
+ res.status
32394
+ );
32395
+ }
32396
+ if (res.status === RUNNER_BAD_REQUEST) {
32397
+ throw new RunnerTransportError(
32398
+ detail || "gog-runner rejected the request (no detail supplied)",
32399
+ "transport-request",
32400
+ res.status
32401
+ );
32402
+ }
32403
+ if (res.status === RUNNER_DRAINING || body?.retryable === true) {
32404
+ throw new RunnerTransportError(
32405
+ `gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`,
32406
+ "transport-retryable",
32407
+ res.status
32408
+ );
32409
+ }
32410
+ if (detail) {
32411
+ throw new Error(detail);
32412
+ }
32413
+ throw new RunnerTransportError(
32414
+ `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.`,
32415
+ "transport-retryable",
32416
+ res.status
32417
+ );
32418
+ }
32419
+ const { stdout } = await res.json();
32420
+ return stdout;
32154
32421
  }
32155
32422
 
32156
32423
  // ../gogcli-mcp/src/remote-runner.ts
package/manifest.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifest_version": "0.3",
4
4
  "name": "gogcli-mcp-drive",
5
5
  "display_name": "gogcli (Drive)",
6
- "version": "2.21.0",
6
+ "version": "2.21.1",
7
7
  "description": "Extended Google Drive for Claude via gogcli — auth + full Drive support (upload, download, permissions, comments, shared drives)",
8
8
  "author": {
9
9
  "name": "Chris Hall",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gogcli-mcp-drive",
3
- "version": "2.21.0",
3
+ "version": "2.21.1",
4
4
  "mcpName": "io.github.chrischall/gogcli-mcp-drive",
5
5
  "description": "Extended Google Drive MCP server via gogcli — auth + full Drive support (upload/download/permissions/comments/shared drives)",
6
6
  "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "source": "github",
8
8
  "subfolder": "packages/gogcli-mcp-drive"
9
9
  },
10
- "version": "2.21.0",
10
+ "version": "2.21.1",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "gogcli-mcp-drive",
15
- "version": "2.21.0",
15
+ "version": "2.21.1",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },