refactor: keep auth profile helpers internal

This commit is contained in:
Peter Steinberger
2026-05-02 06:48:30 +01:00
parent 469bf6547d
commit e2a339027f
2 changed files with 3 additions and 5 deletions

View File

@@ -12,14 +12,12 @@ export type OAuthRefreshFailureReason =
const OAUTH_REFRESH_FAILURE_PROVIDER_RE = /OAuth token refresh failed for ([^:]+):/i;
const SAFE_PROVIDER_ID_RE = /^[a-z0-9][a-z0-9._-]*$/;
export function extractOAuthRefreshFailureProvider(message: string): string | null {
function extractOAuthRefreshFailureProvider(message: string): string | null {
const provider = message.match(OAUTH_REFRESH_FAILURE_PROVIDER_RE)?.[1]?.trim();
return provider && provider.length > 0 ? provider : null;
}
export function sanitizeOAuthRefreshFailureProvider(
provider: string | null | undefined,
): string | null {
function sanitizeOAuthRefreshFailureProvider(provider: string | null | undefined): string | null {
const sanitized = provider ? sanitizeForLog(provider).replaceAll("`", "").trim() : "";
const normalized = normalizeProviderId(sanitized);
return normalized && SAFE_PROVIDER_ID_RE.test(normalized) ? normalized : null;

View File

@@ -22,7 +22,7 @@ export function isActiveUnusableWindow(until: number | undefined, now: number):
return typeof until === "number" && Number.isFinite(until) && until > 0 && now < until;
}
export function shouldBypassModelScopedCooldown(
function shouldBypassModelScopedCooldown(
stats: Pick<ProfileUsageStats, "cooldownReason" | "cooldownModel" | "disabledUntil">,
now: number,
forModel?: string,