From c27b82d431662ef697769669fc9ac17947b95d54 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 27 Apr 2026 23:56:56 +0100 Subject: [PATCH] perf: avoid heavy imports in hot tests --- src/agents/auth-profiles.cooldown-auto-expiry.test.ts | 2 +- src/infra/google-api-base-url.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/agents/auth-profiles.cooldown-auto-expiry.test.ts b/src/agents/auth-profiles.cooldown-auto-expiry.test.ts index baed94f251f..90c0609f731 100644 --- a/src/agents/auth-profiles.cooldown-auto-expiry.test.ts +++ b/src/agents/auth-profiles.cooldown-auto-expiry.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "vitest"; import { resolveAuthProfileOrder } from "./auth-profiles/order.js"; import type { AuthProfileStore } from "./auth-profiles/types.js"; -import { isProfileInCooldown } from "./auth-profiles/usage.js"; +import { isProfileInCooldown } from "./auth-profiles/usage-state.js"; /** * Integration tests for cooldown auto-expiry through resolveAuthProfileOrder. diff --git a/src/infra/google-api-base-url.ts b/src/infra/google-api-base-url.ts index 1d0e286917e..26928a3d5d4 100644 --- a/src/infra/google-api-base-url.ts +++ b/src/infra/google-api-base-url.ts @@ -1,6 +1,5 @@ -import { resolveProviderEndpoint } from "../agents/provider-attribution.js"; - export const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta"; +const GOOGLE_GENERATIVE_LANGUAGE_HOST = "generativelanguage.googleapis.com"; function trimTrailingSlashes(value: string): string { return value.replace(/\/+$/, ""); @@ -17,7 +16,7 @@ export function normalizeGoogleApiBaseUrl(baseUrl?: string): string { url.hash = ""; url.search = ""; if ( - resolveProviderEndpoint(url.toString()).endpointClass === "google-generative-ai" && + url.hostname.toLowerCase() === GOOGLE_GENERATIVE_LANGUAGE_HOST && trimTrailingSlashes(url.pathname || "") === "" ) { url.pathname = "/v1beta";