@agentconnect.md/setup 1.56.0-rc.59 → 1.56.0-rc.63
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 +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63372,8 +63372,9 @@ function createAppAuth(options) {
|
|
|
63372
63372
|
/**
|
|
63373
63373
|
* Thin GitHub REST wrapper — the only spot the CP talks to github.com (the
|
|
63374
63374
|
* pattern set by `http/slack-identity.ts` for Slack). `fetch` is injectable so
|
|
63375
|
-
* integration tests stub the API without network; timeouts are short
|
|
63376
|
-
* error is typed for the WS
|
|
63375
|
+
* integration tests stub the API without network; timeouts are short, a read
|
|
63376
|
+
* repeats a transient failure twice, and every error is typed for the WS
|
|
63377
|
+
* handler's ErrorCode mapping.
|
|
63377
63378
|
*
|
|
63378
63379
|
* NEVER log request headers or token-bearing response bodies.
|
|
63379
63380
|
*/
|
|
@@ -63409,6 +63410,14 @@ async function mintAppJwt(cfg) {
|
|
|
63409
63410
|
}
|
|
63410
63411
|
return (await auth({ type: "app" })).token;
|
|
63411
63412
|
}
|
|
63413
|
+
const READ_RETRY_DELAYS_MS = [0, 300];
|
|
63414
|
+
const realSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
63415
|
+
/** Unreachable or 5xx on a read; a timeout already spent its 10s and would only spend it again. */
|
|
63416
|
+
function isTransientRead(err) {
|
|
63417
|
+
if (!(err instanceof GithubApiError)) return false;
|
|
63418
|
+
if (err.status >= 500) return true;
|
|
63419
|
+
return err.status === 0 && err.cause?.name !== "TimeoutError";
|
|
63420
|
+
}
|
|
63412
63421
|
/** `rel="next"` from a Link header, relative to `baseUrl`. */
|
|
63413
63422
|
function nextPathFrom(link, baseUrl) {
|
|
63414
63423
|
if (!link) return void 0;
|
|
@@ -63424,6 +63433,16 @@ async function githubRequest(path, opts) {
|
|
|
63424
63433
|
/** {@link githubRequest} keeping the pagination cursor — for the list endpoints
|
|
63425
63434
|
* whose first page is not the whole answer. */
|
|
63426
63435
|
async function githubRequestPage(path, opts) {
|
|
63436
|
+
const retries = (opts.method ?? "GET") === "GET" ? READ_RETRY_DELAYS_MS : [];
|
|
63437
|
+
for (let attempt = 0;; attempt += 1) try {
|
|
63438
|
+
return await githubRequestOnce(path, opts);
|
|
63439
|
+
} catch (err) {
|
|
63440
|
+
const delay = retries[attempt];
|
|
63441
|
+
if (delay === void 0 || !isTransientRead(err)) throw err;
|
|
63442
|
+
await (opts.sleep ?? realSleep)(delay + Math.floor(Math.random() * delay));
|
|
63443
|
+
}
|
|
63444
|
+
}
|
|
63445
|
+
async function githubRequestOnce(path, opts) {
|
|
63427
63446
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
63428
63447
|
let res;
|
|
63429
63448
|
try {
|
|
@@ -63439,7 +63458,9 @@ async function githubRequestPage(path, opts) {
|
|
|
63439
63458
|
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
63440
63459
|
});
|
|
63441
63460
|
} catch (e) {
|
|
63442
|
-
|
|
63461
|
+
const unreachable = new GithubApiError(`github unreachable: ${e.message}`, 0, "INTERNAL", true);
|
|
63462
|
+
unreachable.cause = e;
|
|
63463
|
+
throw unreachable;
|
|
63443
63464
|
}
|
|
63444
63465
|
if (res.ok) {
|
|
63445
63466
|
const text = await res.text();
|