mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
refactor: keep auth profile helpers internal
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user