fix: normalize provider aliases in auth order

This commit is contained in:
Peter Steinberger
2026-01-07 05:43:32 +01:00
parent 8187baab18
commit 12d57da53a
5 changed files with 493 additions and 39 deletions

View File

@@ -3,8 +3,16 @@ import { describe, expect, it, vi } from "vitest";
const loadConfig = vi.fn();
const ensureClawdbotModelsJson = vi.fn().mockResolvedValue(undefined);
const resolveClawdbotAgentDir = vi.fn().mockReturnValue("/tmp/clawdbot-agent");
const ensureAuthProfileStore = vi.fn().mockReturnValue({});
const ensureAuthProfileStore = vi
.fn()
.mockReturnValue({ version: 1, profiles: {} });
const listProfilesForProvider = vi.fn().mockReturnValue([]);
const resolveAuthProfileDisplayLabel = vi.fn(
({ profileId }: { profileId: string }) => profileId,
);
const resolveAuthStorePathForDisplay = vi
.fn()
.mockReturnValue("/tmp/clawdbot-agent/auth-profiles.json");
const resolveEnvApiKey = vi.fn().mockReturnValue(undefined);
const getCustomProviderApiKey = vi.fn().mockReturnValue(undefined);
const discoverAuthStorage = vi.fn().mockReturnValue({});
@@ -26,6 +34,8 @@ vi.mock("../agents/agent-paths.js", () => ({
vi.mock("../agents/auth-profiles.js", () => ({
ensureAuthProfileStore,
listProfilesForProvider,
resolveAuthProfileDisplayLabel,
resolveAuthStorePathForDisplay,
}));
vi.mock("../agents/model-auth.js", () => ({