@agentconnect.md/setup 1.56.0-rc.63 → 1.56.0-rc.64
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 +19 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63383,14 +63383,29 @@ var GithubApiError = class extends Error {
|
|
|
63383
63383
|
status;
|
|
63384
63384
|
code;
|
|
63385
63385
|
retryable;
|
|
63386
|
-
|
|
63386
|
+
retryAfterMs;
|
|
63387
|
+
rateLimitResetAt;
|
|
63388
|
+
constructor(message, status, code, retryable, hint = {}) {
|
|
63387
63389
|
super(message);
|
|
63388
63390
|
this.status = status;
|
|
63389
63391
|
this.code = code;
|
|
63390
63392
|
this.retryable = retryable;
|
|
63391
63393
|
this.name = "GithubApiError";
|
|
63394
|
+
if (hint.retryAfterMs !== void 0) this.retryAfterMs = hint.retryAfterMs;
|
|
63395
|
+
if (hint.rateLimitResetAt !== void 0) this.rateLimitResetAt = hint.rateLimitResetAt;
|
|
63392
63396
|
}
|
|
63393
63397
|
};
|
|
63398
|
+
/** `retry-after` is delta-seconds and `x-ratelimit-reset` epoch-seconds; anything unparseable is no hint. */
|
|
63399
|
+
function retryHintFrom(headers) {
|
|
63400
|
+
const retryAfter = headers.get("retry-after");
|
|
63401
|
+
const reset = headers.get("x-ratelimit-remaining") === "0" ? headers.get("x-ratelimit-reset") : null;
|
|
63402
|
+
const retryAfterSec = retryAfter === null ? NaN : Number(retryAfter);
|
|
63403
|
+
const resetSec = reset === null ? NaN : Number(reset);
|
|
63404
|
+
return {
|
|
63405
|
+
...Number.isFinite(retryAfterSec) && retryAfterSec >= 0 ? { retryAfterMs: retryAfterSec * 1e3 } : {},
|
|
63406
|
+
...Number.isFinite(resetSec) && resetSec > 0 ? { rateLimitResetAt: resetSec * 1e3 } : {}
|
|
63407
|
+
};
|
|
63408
|
+
}
|
|
63394
63409
|
const API_BASE = "https://api.github.com";
|
|
63395
63410
|
const TIMEOUT_MS = 1e4;
|
|
63396
63411
|
const appAuthByConfig = /* @__PURE__ */ new WeakMap();
|
|
@@ -63476,9 +63491,10 @@ async function githubRequestOnce(path, opts) {
|
|
|
63476
63491
|
try {
|
|
63477
63492
|
detail = (await res.json()).message ?? "";
|
|
63478
63493
|
} catch {}
|
|
63479
|
-
|
|
63494
|
+
const hint = retryHintFrom(res.headers);
|
|
63495
|
+
if (res.status === 429 || res.status === 403 && (hint.retryAfterMs !== void 0 || res.headers.get("x-ratelimit-remaining") === "0" || /rate limit/i.test(detail))) throw new GithubApiError(`github rate limited: ${detail}`, res.status, "RATE_LIMITED", true, hint);
|
|
63480
63496
|
if (res.status === 404 || res.status === 422 || res.status === 403) throw new GithubApiError(`github denied (${res.status}): ${detail}`, res.status, "LEASE_DENIED", false);
|
|
63481
|
-
throw new GithubApiError(`github error (${res.status}): ${detail}`, res.status, "INTERNAL", res.status >= 500);
|
|
63497
|
+
throw new GithubApiError(`github error (${res.status}): ${detail}`, res.status, "INTERNAL", res.status >= 500, hint);
|
|
63482
63498
|
}
|
|
63483
63499
|
//#endregion
|
|
63484
63500
|
//#region ../control-plane/dist/github/config.js
|