From c285c2a8bd6eff7d0f44fd5cbd88e7aed5d6b488 Mon Sep 17 00:00:00 2001 From: HashWarlock Date: Mon, 26 Jan 2026 18:14:47 -0600 Subject: [PATCH] feat(onboard): add Redpill non-interactive onboarding support - Add --redpill-api-key CLI flag for non-interactive onboarding - Add redpill-api-key auth choice handler - Auto-configure all 18 GPU TEE models in agent allowlist Co-Authored-By: Claude Opus 4.5 --- src/cli/program/register.onboard.ts | 4 +++- src/commands/onboard-auth.config-core.ts | 15 +++++++------ .../local/auth-choice.ts | 21 +++++++++++++++++++ src/commands/onboard-types.ts | 1 + 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/cli/program/register.onboard.ts b/src/cli/program/register.onboard.ts index 281464b6f..7b1d21613 100644 --- a/src/cli/program/register.onboard.ts +++ b/src/cli/program/register.onboard.ts @@ -52,7 +52,7 @@ export function registerOnboardCommand(program: Command) { .option("--mode ", "Wizard mode: local|remote") .option( "--auth-choice ", - "Auth: setup-token|claude-cli|token|chutes|openai-codex|openai-api-key|openrouter-api-key|ai-gateway-api-key|moonshot-api-key|kimi-code-api-key|synthetic-api-key|codex-cli|gemini-api-key|zai-api-key|apiKey|minimax-api|minimax-api-lightning|opencode-zen|skip", + "Auth: setup-token|claude-cli|token|chutes|openai-codex|openai-api-key|openrouter-api-key|ai-gateway-api-key|moonshot-api-key|kimi-code-api-key|synthetic-api-key|redpill-api-key|codex-cli|gemini-api-key|zai-api-key|apiKey|minimax-api|minimax-api-lightning|opencode-zen|skip", ) .option( "--token-provider ", @@ -74,6 +74,7 @@ export function registerOnboardCommand(program: Command) { .option("--zai-api-key ", "Z.AI API key") .option("--minimax-api-key ", "MiniMax API key") .option("--synthetic-api-key ", "Synthetic API key") + .option("--redpill-api-key ", "Redpill AI API key") .option("--opencode-zen-api-key ", "OpenCode Zen API key") .option("--gateway-port ", "Gateway port") .option("--gateway-bind ", "Gateway bind: loopback|tailnet|lan|auto|custom") @@ -123,6 +124,7 @@ export function registerOnboardCommand(program: Command) { zaiApiKey: opts.zaiApiKey as string | undefined, minimaxApiKey: opts.minimaxApiKey as string | undefined, syntheticApiKey: opts.syntheticApiKey as string | undefined, + redpillApiKey: opts.redpillApiKey as string | undefined, opencodeZenApiKey: opts.opencodeZenApiKey as string | undefined, gatewayPort: typeof gatewayPort === "number" && Number.isFinite(gatewayPort) diff --git a/src/commands/onboard-auth.config-core.ts b/src/commands/onboard-auth.config-core.ts index dce0e7690..1d5164794 100644 --- a/src/commands/onboard-auth.config-core.ts +++ b/src/commands/onboard-auth.config-core.ts @@ -421,16 +421,19 @@ export function applyVeniceConfig(cfg: ClawdbotConfig): ClawdbotConfig { * Registers Redpill models and sets up the provider, but preserves existing model selection. */ export function applyRedpillProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig { - const models = { ...cfg.agents?.defaults?.models }; - models[REDPILL_DEFAULT_MODEL_REF] = { - ...models[REDPILL_DEFAULT_MODEL_REF], - alias: models[REDPILL_DEFAULT_MODEL_REF]?.alias ?? "DeepSeek V3.2", - }; - const providers = { ...cfg.models?.providers }; const existingProvider = providers.redpill; const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : []; const redpillModels = discoverRedpillModels(); + + // Add all Redpill models to the agent's model allowlist + const models = { ...cfg.agents?.defaults?.models }; + for (const model of redpillModels) { + const modelRef = `redpill/${model.id}`; + if (!models[modelRef]) { + models[modelRef] = { alias: model.name.replace(" (GPU TEE)", "") }; + } + } const mergedModels = [ ...existingModels, ...redpillModels.filter( diff --git a/src/commands/onboard-non-interactive/local/auth-choice.ts b/src/commands/onboard-non-interactive/local/auth-choice.ts index 6762fb7d2..f957b5763 100644 --- a/src/commands/onboard-non-interactive/local/auth-choice.ts +++ b/src/commands/onboard-non-interactive/local/auth-choice.ts @@ -19,6 +19,7 @@ import { applyMoonshotConfig, applyOpencodeZenConfig, applyOpenrouterConfig, + applyRedpillConfig, applySyntheticConfig, applyVercelAiGatewayConfig, applyZaiConfig, @@ -29,6 +30,7 @@ import { setMoonshotApiKey, setOpencodeZenApiKey, setOpenrouterApiKey, + setRedpillApiKey, setSyntheticApiKey, setVercelAiGatewayApiKey, setZaiApiKey, @@ -272,6 +274,25 @@ export async function applyNonInteractiveAuthChoice(params: { return applySyntheticConfig(nextConfig); } + if (authChoice === "redpill-api-key") { + const resolved = await resolveNonInteractiveApiKey({ + provider: "redpill", + cfg: baseConfig, + flagValue: opts.redpillApiKey, + flagName: "--redpill-api-key", + envVar: "REDPILL_API_KEY", + runtime, + }); + if (!resolved) return null; + if (resolved.source !== "profile") await setRedpillApiKey(resolved.key); + nextConfig = applyAuthProfileConfig(nextConfig, { + profileId: "redpill:default", + provider: "redpill", + mode: "api_key", + }); + return applyRedpillConfig(nextConfig); + } + if ( authChoice === "minimax-cloud" || authChoice === "minimax-api" || diff --git a/src/commands/onboard-types.ts b/src/commands/onboard-types.ts index 1ad673ef7..1901e6afb 100644 --- a/src/commands/onboard-types.ts +++ b/src/commands/onboard-types.ts @@ -71,6 +71,7 @@ export type OnboardOptions = { minimaxApiKey?: string; syntheticApiKey?: string; veniceApiKey?: string; + redpillApiKey?: string; opencodeZenApiKey?: string; gatewayPort?: number; gatewayBind?: GatewayBind;