gogcli-mcp-slides 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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/index.js +321 -54
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "Extended Google Slides for Claude via gogcli — auth + full Slides support (create, edit, export, templates, markdown)",
|
|
10
|
-
"version": "2.21.
|
|
10
|
+
"version": "2.21.1"
|
|
11
11
|
},
|
|
12
12
|
"plugins": [
|
|
13
13
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"displayName": "gogcli (Slides)",
|
|
16
16
|
"source": "./",
|
|
17
17
|
"description": "Extended Google Slides for Claude via gogcli — auth + full Slides support (create, edit, export, templates, markdown)",
|
|
18
|
-
"version": "2.21.
|
|
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-slides",
|
|
3
3
|
"displayName": "gogcli (Slides)",
|
|
4
|
-
"version": "2.21.
|
|
4
|
+
"version": "2.21.1",
|
|
5
5
|
"description": "Extended Google Slides for Claude via gogcli — auth + full Slides support (create, edit, export, templates, markdown)",
|
|
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
|
-
|
|
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
|
|
|
@@ -31579,7 +31598,7 @@ function registerRunTool(server, options) {
|
|
|
31579
31598
|
function errorText(err) {
|
|
31580
31599
|
return err instanceof Error ? `Error: ${err.message}` : String(err);
|
|
31581
31600
|
}
|
|
31582
|
-
var DEFINITE_AUTH_PATTERN = /\b(
|
|
31601
|
+
var DEFINITE_AUTH_PATTERN = /\b(?:unauthorized|invalid_grant)\b|\b(?:error|status|code|http|responded|response)["']?[\s:=(,]{0,4}401\b/i;
|
|
31583
31602
|
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;
|
|
31584
31603
|
var AUTH_ERROR_PATTERN = new RegExp(`${DEFINITE_AUTH_PATTERN.source}|${STALE_TOKEN_PATTERN.source}`, "i");
|
|
31585
31604
|
var INVALID_GRANT_PATTERN = /invalid_grant|token has been expired or revoked/i;
|
|
@@ -31589,6 +31608,14 @@ var AUTH_HINT = "\n\nAuthentication may have expired. Use gog_auth_add to re-aut
|
|
|
31589
31608
|
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.';
|
|
31590
31609
|
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).";
|
|
31591
31610
|
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.";
|
|
31611
|
+
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.";
|
|
31612
|
+
var RUNNER_TRANSPORT_HINTS = {
|
|
31613
|
+
"transport-auth": RUNNER_TRANSPORT_AUTH_HINT,
|
|
31614
|
+
// The request itself was malformed, so the runner will refuse it identically
|
|
31615
|
+
// every time. Nothing to advise beyond the message the runner already gave.
|
|
31616
|
+
"transport-request": "",
|
|
31617
|
+
"transport-retryable": TRANSIENT_HINT
|
|
31618
|
+
};
|
|
31592
31619
|
function formatAccountList(raw) {
|
|
31593
31620
|
try {
|
|
31594
31621
|
const parsed = JSON.parse(raw);
|
|
@@ -31601,11 +31628,12 @@ function formatAccountList(raw) {
|
|
|
31601
31628
|
}
|
|
31602
31629
|
async function diagnose(err) {
|
|
31603
31630
|
const errText = errorText(err);
|
|
31631
|
+
const transportHint = isRunnerTransportError(err) ? RUNNER_TRANSPORT_HINTS[err.kind] : void 0;
|
|
31604
31632
|
const isInvalidGrant = INVALID_GRANT_PATTERN.test(errText);
|
|
31605
31633
|
const isTransientError = !DEFINITE_AUTH_PATTERN.test(errText) && TRANSIENT_ERROR_PATTERN.test(errText);
|
|
31606
31634
|
const isAuthError = !isTransientError && AUTH_ERROR_PATTERN.test(errText);
|
|
31607
31635
|
const isGridLimitError = GRID_LIMIT_ERROR_PATTERN.test(errText);
|
|
31608
|
-
const hint = isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "";
|
|
31636
|
+
const hint = transportHint ?? (isInvalidGrant ? INVALID_GRANT_HINT : isAuthError ? AUTH_HINT : isTransientError ? TRANSIENT_HINT : isGridLimitError ? GRID_LIMIT_HINT : "");
|
|
31609
31637
|
try {
|
|
31610
31638
|
const accounts = formatAccountList(await run(["auth", "list"]));
|
|
31611
31639
|
return errorResult(`${errText}
|
|
@@ -31883,7 +31911,25 @@ function registerSlidesTools(server) {
|
|
|
31883
31911
|
}
|
|
31884
31912
|
|
|
31885
31913
|
// ../gogcli-mcp/src/server.ts
|
|
31886
|
-
var VERSION = true ? "2.21.
|
|
31914
|
+
var VERSION = true ? "2.21.1" : "0.0.0";
|
|
31915
|
+
|
|
31916
|
+
// ../gogcli-mcp/src/auth-log.ts
|
|
31917
|
+
var FAILURES = /* @__PURE__ */ new Set([
|
|
31918
|
+
"token.mint-failed",
|
|
31919
|
+
"grant.dead",
|
|
31920
|
+
"replay.failed",
|
|
31921
|
+
"runner.auth-failed"
|
|
31922
|
+
]);
|
|
31923
|
+
var PREFIX = "gog-auth ";
|
|
31924
|
+
var TAG_CHARS = 12;
|
|
31925
|
+
function credentialTag(cacheKeyHash) {
|
|
31926
|
+
return cacheKeyHash.slice(0, TAG_CHARS);
|
|
31927
|
+
}
|
|
31928
|
+
function logAuthTransition(event, context) {
|
|
31929
|
+
const record2 = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...context });
|
|
31930
|
+
const write = FAILURES.has(event) ? console.error : console.warn;
|
|
31931
|
+
write(PREFIX + redactSecrets2(record2));
|
|
31932
|
+
}
|
|
31887
31933
|
|
|
31888
31934
|
// ../gogcli-mcp/src/google-token.ts
|
|
31889
31935
|
var TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
|
|
@@ -31910,22 +31956,73 @@ function makeAccessTokenSource(env) {
|
|
|
31910
31956
|
);
|
|
31911
31957
|
};
|
|
31912
31958
|
}
|
|
31913
|
-
|
|
31914
|
-
|
|
31915
|
-
|
|
31916
|
-
|
|
31917
|
-
|
|
31959
|
+
let keyPromise;
|
|
31960
|
+
const key = () => keyPromise ??= cacheKey(refreshToken, clientId);
|
|
31961
|
+
const logCacheHits = parseBoolEnv("GOG_AUTH_LOG_CACHE_HITS", { env });
|
|
31962
|
+
const read = async () => {
|
|
31963
|
+
const k = await key();
|
|
31964
|
+
const hit = cache.get(k);
|
|
31965
|
+
if (hit && hit.expiresAt - EXPIRY_MARGIN_MS > Date.now()) {
|
|
31966
|
+
if (logCacheHits) logAuthTransition("token.cache-hit", { credential: credentialTag(k) });
|
|
31967
|
+
return hit.accessToken;
|
|
31968
|
+
}
|
|
31969
|
+
let pending = inFlight.get(k);
|
|
31918
31970
|
if (!pending) {
|
|
31919
31971
|
pending = exchange(refreshToken, clientId, clientSecret).then((minted2) => {
|
|
31920
|
-
cache.set(
|
|
31972
|
+
cache.set(k, minted2);
|
|
31973
|
+
logAuthTransition("token.minted", {
|
|
31974
|
+
credential: credentialTag(k),
|
|
31975
|
+
reason: `valid for ${Math.round((minted2.expiresAt - Date.now()) / 1e3)}s`
|
|
31976
|
+
});
|
|
31921
31977
|
return minted2;
|
|
31922
|
-
}).
|
|
31923
|
-
|
|
31978
|
+
}).catch((err) => {
|
|
31979
|
+
logAuthTransition(err.grantDead ? "grant.dead" : "token.mint-failed", {
|
|
31980
|
+
credential: credentialTag(k),
|
|
31981
|
+
reason: err.message
|
|
31982
|
+
});
|
|
31983
|
+
throw err;
|
|
31984
|
+
}).finally(() => inFlight.delete(k));
|
|
31985
|
+
inFlight.set(k, pending);
|
|
31924
31986
|
}
|
|
31925
31987
|
const minted = await pending;
|
|
31926
31988
|
return minted.accessToken;
|
|
31927
31989
|
};
|
|
31990
|
+
const invalidate = async (rejected) => {
|
|
31991
|
+
const k = await key();
|
|
31992
|
+
const hit = cache.get(k);
|
|
31993
|
+
if (!hit || hit.accessToken !== rejected) {
|
|
31994
|
+
logAuthTransition("token.evict-noop", {
|
|
31995
|
+
credential: credentialTag(k),
|
|
31996
|
+
reason: hit ? "a concurrent caller had already replaced this credential\u2019s token" : "no token was cached for this credential"
|
|
31997
|
+
});
|
|
31998
|
+
return false;
|
|
31999
|
+
}
|
|
32000
|
+
cache.delete(k);
|
|
32001
|
+
logAuthTransition("token.evicted", {
|
|
32002
|
+
credential: credentialTag(k),
|
|
32003
|
+
reason: "Google rejected this access token; the next read will mint a new one"
|
|
32004
|
+
});
|
|
32005
|
+
return true;
|
|
32006
|
+
};
|
|
32007
|
+
return Object.assign(read, {
|
|
32008
|
+
invalidate,
|
|
32009
|
+
credentialId: async () => credentialTag(await key())
|
|
32010
|
+
});
|
|
31928
32011
|
}
|
|
32012
|
+
var TokenExchangeError = class extends Error {
|
|
32013
|
+
/**
|
|
32014
|
+
* The REFRESH token is dead (Google's `invalid_grant`), not merely the access
|
|
32015
|
+
* token. Carried as a flag rather than re-read from the message, because
|
|
32016
|
+
* inferring the author of a failure from prose several authors can produce is
|
|
32017
|
+
* precisely the mistake this branch exists to undo. `instanceof` is safe: the
|
|
32018
|
+
* class is thrown and caught inside this one module.
|
|
32019
|
+
*/
|
|
32020
|
+
grantDead;
|
|
32021
|
+
constructor(message, grantDead) {
|
|
32022
|
+
super(message);
|
|
32023
|
+
this.grantDead = grantDead;
|
|
32024
|
+
}
|
|
32025
|
+
};
|
|
31929
32026
|
async function exchange(refreshToken, clientId, clientSecret) {
|
|
31930
32027
|
let res;
|
|
31931
32028
|
try {
|
|
@@ -31940,23 +32037,29 @@ async function exchange(refreshToken, clientId, clientSecret) {
|
|
|
31940
32037
|
}).toString()
|
|
31941
32038
|
});
|
|
31942
32039
|
} catch (err) {
|
|
31943
|
-
throw new
|
|
31944
|
-
`the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}
|
|
32040
|
+
throw new TokenExchangeError(
|
|
32041
|
+
`the Google token exchange could not be reached: ${err instanceof Error ? err.message : String(err)}`,
|
|
32042
|
+
false
|
|
31945
32043
|
);
|
|
31946
32044
|
}
|
|
31947
32045
|
const body = await res.json().catch(() => ({}));
|
|
31948
32046
|
if (!res.ok) {
|
|
31949
32047
|
if (body.error === "invalid_grant") {
|
|
31950
|
-
throw new
|
|
31951
|
-
'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.'
|
|
32048
|
+
throw new TokenExchangeError(
|
|
32049
|
+
'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.',
|
|
32050
|
+
true
|
|
31952
32051
|
);
|
|
31953
32052
|
}
|
|
31954
|
-
throw new
|
|
31955
|
-
`the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})
|
|
32053
|
+
throw new TokenExchangeError(
|
|
32054
|
+
`the access token could not be refreshed (HTTP ${res.status}${body.error ? `, ${body.error}` : ""})`,
|
|
32055
|
+
false
|
|
31956
32056
|
);
|
|
31957
32057
|
}
|
|
31958
32058
|
if (!body.access_token) {
|
|
31959
|
-
throw new
|
|
32059
|
+
throw new TokenExchangeError(
|
|
32060
|
+
"the access token could not be refreshed: Google returned no access_token",
|
|
32061
|
+
false
|
|
32062
|
+
);
|
|
31960
32063
|
}
|
|
31961
32064
|
const expiresInMs = (body.expires_in ?? 3600) * 1e3;
|
|
31962
32065
|
return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
|
|
@@ -31965,54 +32068,218 @@ async function exchange(refreshToken, clientId, clientSecret) {
|
|
|
31965
32068
|
// ../gogcli-mcp/src/connector-runtime.ts
|
|
31966
32069
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
31967
32070
|
var DEADLINE_GRACE_MS = 5e3;
|
|
32071
|
+
var MIN_REPLAY_BUDGET_MS = 1e3;
|
|
31968
32072
|
var RUNNER_GOG_FAILED = 422;
|
|
31969
32073
|
var RUNNER_DRAINING = 503;
|
|
32074
|
+
var RUNNER_BAD_REQUEST = 400;
|
|
32075
|
+
var RUNNER_BAD_KEY = 401;
|
|
32076
|
+
var GogFailedError = class extends Error {
|
|
32077
|
+
/** gog's stderr alone, with no echoed argv mixed in. */
|
|
32078
|
+
stderr;
|
|
32079
|
+
constructor(message, stderr) {
|
|
32080
|
+
super(message);
|
|
32081
|
+
this.stderr = stderr;
|
|
32082
|
+
}
|
|
32083
|
+
};
|
|
32084
|
+
var GOOGLE_TOKEN_REJECTED_PATTERN = /Google API error \(401\b|invalid[ _]authentication[ _]credentials|\bACCESS_TOKEN_EXPIRED\b|\binvalid_token\b/i;
|
|
32085
|
+
var REFRESH_TOKEN_DEAD_PATTERN = /\binvalid_grant\b/i;
|
|
32086
|
+
var READ_ONLY_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
32087
|
+
"cat",
|
|
32088
|
+
"describe",
|
|
32089
|
+
"get",
|
|
32090
|
+
"info",
|
|
32091
|
+
"list",
|
|
32092
|
+
"list-slides",
|
|
32093
|
+
"ls",
|
|
32094
|
+
"metadata",
|
|
32095
|
+
"read-slide",
|
|
32096
|
+
"search",
|
|
32097
|
+
"services",
|
|
32098
|
+
"status",
|
|
32099
|
+
"structure"
|
|
32100
|
+
]);
|
|
32101
|
+
function gogTarget(args) {
|
|
32102
|
+
const words = args.filter((arg) => typeof arg === "string");
|
|
32103
|
+
let service;
|
|
32104
|
+
for (let i = 0; i < words.length; i += 1) {
|
|
32105
|
+
const word = words[i];
|
|
32106
|
+
if (word.startsWith("-")) {
|
|
32107
|
+
if (word === "--account") i += 1;
|
|
32108
|
+
continue;
|
|
32109
|
+
}
|
|
32110
|
+
if (service === void 0) {
|
|
32111
|
+
service = word;
|
|
32112
|
+
continue;
|
|
32113
|
+
}
|
|
32114
|
+
return { service, subcommand: word };
|
|
32115
|
+
}
|
|
32116
|
+
return { service };
|
|
32117
|
+
}
|
|
32118
|
+
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt) {
|
|
32119
|
+
if (!(err instanceof GogFailedError)) return void 0;
|
|
32120
|
+
const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
|
|
32121
|
+
if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
|
|
32122
|
+
const { service, subcommand } = gogTarget(args);
|
|
32123
|
+
const credential = await readAccessToken?.credentialId?.();
|
|
32124
|
+
const where = { credential, service };
|
|
32125
|
+
if (grantDead) {
|
|
32126
|
+
logAuthTransition("grant.dead", {
|
|
32127
|
+
...where,
|
|
32128
|
+
reason: "gog reported invalid_grant: the stored refresh token is dead, so no token can be minted and this account must be re-authorized"
|
|
32129
|
+
});
|
|
32130
|
+
return void 0;
|
|
32131
|
+
}
|
|
32132
|
+
if (!used) {
|
|
32133
|
+
logAuthTransition("replay.declined", {
|
|
32134
|
+
...where,
|
|
32135
|
+
reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
|
|
32136
|
+
});
|
|
32137
|
+
return void 0;
|
|
32138
|
+
}
|
|
32139
|
+
if (!readAccessToken?.invalidate) {
|
|
32140
|
+
logAuthTransition("replay.declined", {
|
|
32141
|
+
...where,
|
|
32142
|
+
reason: "this token source cannot mint a replacement, so a replay would resend the rejected token"
|
|
32143
|
+
});
|
|
32144
|
+
return void 0;
|
|
32145
|
+
}
|
|
32146
|
+
const evicted = await readAccessToken.invalidate(used);
|
|
32147
|
+
if (subcommand === void 0 || !READ_ONLY_SUBCOMMANDS.has(subcommand)) {
|
|
32148
|
+
logAuthTransition("replay.declined", {
|
|
32149
|
+
...where,
|
|
32150
|
+
reason: `not replayable: '${subcommand ?? "(none)"}' is not a known read-only subcommand and a write could double-apply`
|
|
32151
|
+
});
|
|
32152
|
+
return void 0;
|
|
32153
|
+
}
|
|
32154
|
+
if (!evicted) {
|
|
32155
|
+
logAuthTransition("replay.declined", {
|
|
32156
|
+
...where,
|
|
32157
|
+
reason: "the rejected token was already superseded, so the cache holds the token a replay would send"
|
|
32158
|
+
});
|
|
32159
|
+
return void 0;
|
|
32160
|
+
}
|
|
32161
|
+
const fresh = await readAccessToken();
|
|
32162
|
+
if (!fresh) {
|
|
32163
|
+
logAuthTransition("replay.declined", {
|
|
32164
|
+
...where,
|
|
32165
|
+
reason: "the token source produced no token after eviction; replaying without one would act as the backend"
|
|
32166
|
+
});
|
|
32167
|
+
return void 0;
|
|
32168
|
+
}
|
|
32169
|
+
const budgetMs = deadlineAt - Date.now();
|
|
32170
|
+
if (budgetMs < MIN_REPLAY_BUDGET_MS) {
|
|
32171
|
+
logAuthTransition("replay.declined", {
|
|
32172
|
+
...where,
|
|
32173
|
+
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`
|
|
32174
|
+
});
|
|
32175
|
+
return void 0;
|
|
32176
|
+
}
|
|
32177
|
+
return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
|
|
32178
|
+
}
|
|
31970
32179
|
function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
31971
32180
|
return async (args, opts) => {
|
|
31972
32181
|
const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
|
|
31973
32182
|
const accessToken = await readAccessToken?.();
|
|
31974
|
-
|
|
32183
|
+
const deadlineAt = Date.now() + deadlineMs;
|
|
31975
32184
|
try {
|
|
31976
|
-
|
|
31977
|
-
method: "POST",
|
|
31978
|
-
headers: {
|
|
31979
|
-
Authorization: "Bearer " + key,
|
|
31980
|
-
"Content-Type": "application/json"
|
|
31981
|
-
},
|
|
31982
|
-
body: JSON.stringify(accessToken ? { args, accessToken } : { args }),
|
|
31983
|
-
signal: AbortSignal.timeout(deadlineMs)
|
|
31984
|
-
});
|
|
32185
|
+
return await attempt(endpoint, key, args, accessToken, deadlineMs);
|
|
31985
32186
|
} catch (err) {
|
|
31986
|
-
const
|
|
31987
|
-
|
|
31988
|
-
|
|
31989
|
-
|
|
31990
|
-
|
|
32187
|
+
const replay = await remintAfterGoogleRejection(
|
|
32188
|
+
err,
|
|
32189
|
+
accessToken,
|
|
32190
|
+
args,
|
|
32191
|
+
readAccessToken,
|
|
32192
|
+
deadlineAt
|
|
32193
|
+
);
|
|
32194
|
+
if (replay === void 0) throw err;
|
|
32195
|
+
const where = { credential: replay.credential, service: replay.service, endpoint };
|
|
32196
|
+
logAuthTransition("replay.attempted", {
|
|
32197
|
+
...where,
|
|
32198
|
+
reason: "Google rejected the access token; replaying this read once with a freshly minted one"
|
|
32199
|
+
});
|
|
32200
|
+
try {
|
|
32201
|
+
const stdout = await attempt(endpoint, key, args, replay.token, replay.budgetMs);
|
|
32202
|
+
logAuthTransition("replay.succeeded", where);
|
|
32203
|
+
return stdout;
|
|
32204
|
+
} catch (replayErr) {
|
|
32205
|
+
logAuthTransition("replay.failed", { ...where, reason: String(replayErr) });
|
|
32206
|
+
if (replayErr instanceof GogFailedError && GOOGLE_TOKEN_REJECTED_PATTERN.test(replayErr.stderr)) {
|
|
32207
|
+
await replay.invalidate(replay.token);
|
|
32208
|
+
}
|
|
32209
|
+
throw replayErr;
|
|
31991
32210
|
}
|
|
31992
|
-
throw err;
|
|
31993
32211
|
}
|
|
31994
|
-
|
|
31995
|
-
|
|
31996
|
-
|
|
32212
|
+
};
|
|
32213
|
+
}
|
|
32214
|
+
async function attempt(endpoint, key, args, accessToken, deadlineMs) {
|
|
32215
|
+
let res;
|
|
32216
|
+
try {
|
|
32217
|
+
res = await fetch(endpoint + "/run", {
|
|
32218
|
+
method: "POST",
|
|
32219
|
+
headers: {
|
|
32220
|
+
Authorization: "Bearer " + key,
|
|
32221
|
+
"Content-Type": "application/json"
|
|
32222
|
+
},
|
|
32223
|
+
body: JSON.stringify(accessToken ? { args, accessToken } : { args }),
|
|
32224
|
+
signal: AbortSignal.timeout(deadlineMs)
|
|
32225
|
+
});
|
|
32226
|
+
} catch (err) {
|
|
32227
|
+
const name = err instanceof Error ? err.name : "";
|
|
32228
|
+
if (name === "TimeoutError" || name === "AbortError") {
|
|
32229
|
+
throw new RunnerTransportError(
|
|
32230
|
+
`gog-runner did not respond within ${deadlineMs}ms (${endpoint}) \u2014 the Fly backend may be cold or wedged`,
|
|
32231
|
+
"transport-retryable"
|
|
32232
|
+
);
|
|
32233
|
+
}
|
|
32234
|
+
throw err;
|
|
32235
|
+
}
|
|
32236
|
+
if (!res.ok) {
|
|
32237
|
+
const body = await res.json().catch(() => null);
|
|
32238
|
+
const detail = body && typeof body.error === "string" ? body.stderr && body.stderr.trim() && body.stderr.trim() !== body.error.trim() ? `${body.error}
|
|
31997
32239
|
${body.stderr}` : body.error : "";
|
|
31998
|
-
|
|
31999
|
-
|
|
32000
|
-
|
|
32001
|
-
|
|
32002
|
-
throw new Error(
|
|
32003
|
-
`gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`
|
|
32004
|
-
);
|
|
32005
|
-
}
|
|
32006
|
-
if (detail) {
|
|
32007
|
-
throw new Error(detail);
|
|
32008
|
-
}
|
|
32009
|
-
throw new Error(
|
|
32010
|
-
`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.`
|
|
32240
|
+
if (res.status === RUNNER_GOG_FAILED) {
|
|
32241
|
+
throw new GogFailedError(
|
|
32242
|
+
detail || "gog failed on the runner (no detail supplied)",
|
|
32243
|
+
typeof body?.stderr === "string" ? body.stderr : ""
|
|
32011
32244
|
);
|
|
32012
32245
|
}
|
|
32013
|
-
|
|
32014
|
-
|
|
32015
|
-
|
|
32246
|
+
if (res.status === RUNNER_BAD_KEY) {
|
|
32247
|
+
logAuthTransition("runner.auth-failed", {
|
|
32248
|
+
service: gogTarget(args).service,
|
|
32249
|
+
endpoint,
|
|
32250
|
+
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"
|
|
32251
|
+
});
|
|
32252
|
+
throw new RunnerTransportError(
|
|
32253
|
+
"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.",
|
|
32254
|
+
"transport-auth",
|
|
32255
|
+
res.status
|
|
32256
|
+
);
|
|
32257
|
+
}
|
|
32258
|
+
if (res.status === RUNNER_BAD_REQUEST) {
|
|
32259
|
+
throw new RunnerTransportError(
|
|
32260
|
+
detail || "gog-runner rejected the request (no detail supplied)",
|
|
32261
|
+
"transport-request",
|
|
32262
|
+
res.status
|
|
32263
|
+
);
|
|
32264
|
+
}
|
|
32265
|
+
if (res.status === RUNNER_DRAINING || body?.retryable === true) {
|
|
32266
|
+
throw new RunnerTransportError(
|
|
32267
|
+
`gog-runner is restarting; retry this call.${detail ? ` ${detail}` : ""}`,
|
|
32268
|
+
"transport-retryable",
|
|
32269
|
+
res.status
|
|
32270
|
+
);
|
|
32271
|
+
}
|
|
32272
|
+
if (detail) {
|
|
32273
|
+
throw new Error(detail);
|
|
32274
|
+
}
|
|
32275
|
+
throw new RunnerTransportError(
|
|
32276
|
+
`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.`,
|
|
32277
|
+
"transport-retryable",
|
|
32278
|
+
res.status
|
|
32279
|
+
);
|
|
32280
|
+
}
|
|
32281
|
+
const { stdout } = await res.json();
|
|
32282
|
+
return stdout;
|
|
32016
32283
|
}
|
|
32017
32284
|
|
|
32018
32285
|
// ../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-slides",
|
|
5
5
|
"display_name": "gogcli (Slides)",
|
|
6
|
-
"version": "2.21.
|
|
6
|
+
"version": "2.21.1",
|
|
7
7
|
"description": "Extended Google Slides for Claude via gogcli — auth + full Slides support (create, edit, export, templates, markdown)",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gogcli-mcp-slides",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.1",
|
|
4
4
|
"mcpName": "io.github.chrischall/gogcli-mcp-slides",
|
|
5
5
|
"description": "Extended Google Slides MCP server via gogcli — auth + full Slides support",
|
|
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-slides"
|
|
9
9
|
},
|
|
10
|
-
"version": "2.21.
|
|
10
|
+
"version": "2.21.1",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "gogcli-mcp-slides",
|
|
15
|
-
"version": "2.21.
|
|
15
|
+
"version": "2.21.1",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|