diff --git a/src/agents/models-config.providers.google-antigravity.test.ts b/src/agents/models-config.providers.google-antigravity.test.ts index 717e27ba748..6831970ed0f 100644 --- a/src/agents/models-config.providers.google-antigravity.test.ts +++ b/src/agents/models-config.providers.google-antigravity.test.ts @@ -1,7 +1,42 @@ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import { normalizeProviderSpecificConfig } from "./models-config.providers.policy.js"; import type { ProviderConfig } from "./models-config.providers.secrets.js"; +vi.mock("../plugins/provider-runtime.js", () => { + function normalizeGoogleModelIdForProvider(provider: string, modelId: string): string { + if (provider === "google-antigravity") { + return /^(gemini-3(?:[.-]1)?-pro)$/.test(modelId) ? `${modelId}-low` : modelId; + } + if (provider === "google-vertex" && modelId === "gemini-3.1-flash-lite") { + return "gemini-3.1-flash-lite-preview"; + } + return modelId; + } + + return { + applyProviderNativeStreamingUsageCompatWithPlugin: () => undefined, + normalizeProviderConfigWithPlugin: (params: { + context: { provider: string; providerConfig?: ProviderConfig }; + }) => { + const providerConfig = params.context.providerConfig; + if (!providerConfig?.models) { + return undefined; + } + let changed = false; + const models = providerConfig.models.map((model) => { + const normalizedId = normalizeGoogleModelIdForProvider(params.context.provider, model.id); + if (normalizedId === model.id) { + return model; + } + changed = true; + return { ...model, id: normalizedId, name: normalizedId }; + }); + return changed ? { ...providerConfig, models } : undefined; + }, + resolveProviderConfigApiKeyWithPlugin: () => undefined, + }; +}); + function buildModel(id: string): NonNullable[number] { return { id, diff --git a/src/media-understanding/runner.video.test.ts b/src/media-understanding/runner.video.test.ts index 3bf0a655819..2b5a1ba166d 100644 --- a/src/media-understanding/runner.video.test.ts +++ b/src/media-understanding/runner.video.test.ts @@ -1,10 +1,15 @@ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, vi } from "vitest"; import type { OpenClawConfig } from "../config/types.js"; import { withTempDir } from "../test-helpers/temp-dir.js"; import { withEnvAsync } from "../test-utils/env.js"; import { runCapability } from "./runner.js"; import { withVideoFixture } from "./runner.test-utils.js"; +vi.mock("../plugins/capability-provider-runtime.js", async () => { + const { createEmptyCapabilityProviderMockModule } = await import("./runner.test-mocks.js"); + return createEmptyCapabilityProviderMockModule(); +}); + describe("runCapability video provider wiring", () => { it("merges video baseUrl and headers with entry precedence", async () => { let seenBaseUrl: string | undefined;