Onboard: require explicit mode for env secret refs

This commit is contained in:
joshavant
2026-02-24 15:04:04 -06:00
committed by Peter Steinberger
parent 103d02f98c
commit 04aa856fc0
15 changed files with 477 additions and 109 deletions

View File

@@ -3,6 +3,7 @@ import {
createAuthChoiceDefaultModelApplier,
createAuthChoiceModelStateBridge,
ensureApiKeyFromOptionEnvOrPrompt,
normalizeSecretInputModeInput,
} from "./auth-choice.apply-helpers.js";
import type { ApplyAuthChoiceParams, ApplyAuthChoiceResult } from "./auth-choice.apply.js";
import { applyAuthChoicePluginProvider } from "./auth-choice.apply.plugin-provider.js";
@@ -31,6 +32,7 @@ export async function applyAuthChoiceMiniMax(
setAgentModelOverride: (model) => (agentModelOverride = model),
}),
);
const requestedSecretInputMode = normalizeSecretInputModeInput(params.opts?.secretInputMode);
const ensureMinimaxApiKey = async (opts: {
profileId: string;
promptMessage: string;
@@ -38,6 +40,7 @@ export async function applyAuthChoiceMiniMax(
await ensureApiKeyFromOptionEnvOrPrompt({
token: params.opts?.token,
tokenProvider: params.opts?.tokenProvider,
secretInputMode: requestedSecretInputMode,
expectedProviders: ["minimax", "minimax-cn"],
provider: "minimax",
envLabel: "MINIMAX_API_KEY",
@@ -45,7 +48,8 @@ export async function applyAuthChoiceMiniMax(
normalize: normalizeApiKeyInput,
validate: validateApiKeyInput,
prompter: params.prompter,
setCredential: async (apiKey) => setMinimaxApiKey(apiKey, params.agentDir, opts.profileId),
setCredential: async (apiKey, mode) =>
setMinimaxApiKey(apiKey, params.agentDir, opts.profileId, { secretInputMode: mode }),
});
};
const applyMinimaxApiVariant = async (opts: {