openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
20 lines (19 loc) • 1.01 kB
JavaScript
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CCIiB4H7.mjs";
import { i as resolveProviderMatch } from "./provider-auth-choice-helpers-BHHQcecj.mjs";
import { t as resolvePluginProviders } from "./provider-auth-choice.runtime-DHnWdHPX.mjs";
//#region src/commands/auth-choice.apply.api-providers.ts
/** Translate generic api-key/token choices to provider-specific auth choices when possible. */
function normalizeApiKeyTokenProviderAuthChoice(e) {
const t = normalizeOptionalLowercaseString(e.tokenProvider);
if (!t) return e.authChoice;
const n = e.authChoice === "apiKey" ? "api_key" : e.authChoice === "token" || e.authChoice === "setup-token" ? "token" : void 0;
if (!n) return e.authChoice;
return resolveProviderMatch(resolvePluginProviders({
config: e.config,
workspaceDir: e.workspaceDir,
env: e.env,
mode: "setup"
}), t)?.auth.find((e) => e.kind === n)?.wizard?.choiceId ?? e.authChoice;
}
//#endregion
export { normalizeApiKeyTokenProviderAuthChoice as t };