mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
test: align agent auth and model expectations
This commit is contained in:
@@ -24,6 +24,7 @@ vi.mock("../plugins/provider-runtime.js", () => ({
|
||||
},
|
||||
formatProviderAuthProfileApiKeyWithPlugin: async () => undefined,
|
||||
refreshProviderOAuthCredentialWithPlugin: async () => null,
|
||||
resolveExternalAuthProfilesWithPlugins: () => [],
|
||||
resolveProviderSyntheticAuthWithPlugin: (params: {
|
||||
provider: string;
|
||||
context: { providerConfig?: { api?: string; baseUrl?: string; models?: unknown[] } };
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
|
||||
vi.mock("../plugins/provider-runtime.js", () => ({
|
||||
buildProviderMissingAuthMessageWithPlugin: () => undefined,
|
||||
resolveExternalAuthProfilesWithPlugins: () => [],
|
||||
shouldDeferProviderSyntheticProfileAuthWithPlugin: (params: {
|
||||
provider: string;
|
||||
context: { resolvedApiKey?: string };
|
||||
|
||||
@@ -134,6 +134,10 @@ describe("model-selection", () => {
|
||||
});
|
||||
|
||||
describe("isCliProvider", () => {
|
||||
it("returns true for setup-registered cli backends", () => {
|
||||
expect(isCliProvider("claude-cli", {} as OpenClawConfig)).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false for provider ids", () => {
|
||||
expect(isCliProvider("example-cli", {} as OpenClawConfig)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from "../config/model-input.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { resolveRuntimeCliBackends } from "../plugins/cli-backends.runtime.js";
|
||||
import { resolvePluginSetupCliBackend } from "../plugins/setup-registry.js";
|
||||
import { sanitizeForLog, stripAnsi } from "../terminal/ansi.js";
|
||||
import {
|
||||
resolveAgentConfig,
|
||||
@@ -93,6 +94,9 @@ export function isCliProvider(provider: string, cfg?: OpenClawConfig): boolean {
|
||||
if (cliBackends.some((backend) => normalizeProviderId(backend.id) === normalized)) {
|
||||
return true;
|
||||
}
|
||||
if (resolvePluginSetupCliBackend({ backend: normalized })) {
|
||||
return true;
|
||||
}
|
||||
const backends = cfg?.agents?.defaults?.cliBackends ?? {};
|
||||
return Object.keys(backends).some((key) => normalizeProviderId(key) === normalized);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ describe("resolveModel forward-compat errors and overrides", () => {
|
||||
expectResolvedForwardCompatFallbackResult({
|
||||
result: resolveModelForTest("google-antigravity", "claude-opus-4-6-thinking", "/tmp/agent"),
|
||||
expectedModel: {
|
||||
api: "google-generative-ai",
|
||||
api: "google-gemini-cli",
|
||||
baseUrl: "https://cloudcode-pa.googleapis.com",
|
||||
id: "claude-opus-4-6-thinking",
|
||||
provider: "google-antigravity",
|
||||
|
||||
@@ -475,7 +475,7 @@ describe("provider request config", () => {
|
||||
});
|
||||
|
||||
expect(resolved.baseUrl).toBe("https://api.openai.com/v1");
|
||||
expect(resolved.allowPrivateNetwork).toBe(true);
|
||||
expect(resolved.allowPrivateNetwork).toBe(false);
|
||||
expect(resolved.policy.endpointClass).toBe("openai-public");
|
||||
expect(resolved.capabilities.allowsResponsesStore).toBe(true);
|
||||
expect(resolved.headers).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user