diff --git a/src/commands/configure.shared.ts b/src/commands/configure.shared.ts index 9377c06f4bb..558c538c4d8 100644 --- a/src/commands/configure.shared.ts +++ b/src/commands/configure.shared.ts @@ -10,6 +10,7 @@ import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../termin export const CONFIGURE_WIZARD_SECTIONS = [ "workspace", "model", + "engine", "web", "gateway", "daemon", @@ -34,6 +35,7 @@ export const CONFIGURE_SECTION_OPTIONS: Array<{ }> = [ { value: "workspace", label: "Workspace", hint: "Set workspace + sessions" }, { value: "model", label: "Model", hint: "Pick provider + credentials" }, + { value: "engine", label: "LLM Engine", hint: "Choose AI SDK or pi-agent" }, { value: "web", label: "Web tools", hint: "Configure Brave search + fetch" }, { value: "gateway", label: "Gateway", hint: "Port, bind, auth, tailscale" }, { diff --git a/src/commands/configure.wizard.ts b/src/commands/configure.wizard.ts index 8f9ff2fc9fb..aa7a9d577e3 100644 --- a/src/commands/configure.wizard.ts +++ b/src/commands/configure.wizard.ts @@ -169,6 +169,53 @@ async function promptWebToolsConfig( }; } +async function promptEngineConfig( + nextConfig: OpenClawConfig, + runtime: RuntimeEnv, +): Promise { + const currentEngine = nextConfig.agents?.engine ?? "aisdk"; + + note( + [ + "OpenClaw supports two LLM engines for agent orchestration:", + "", + "• AI SDK (default): Vercel's AI SDK v6 - modern, flexible, supports AI Gateway", + "• pi-agent: Original implementation - battle-tested, full feature set", + "", + "Both engines emit compatible events, so UI and channels work with either.", + ].join("\n"), + "LLM Engine", + ); + + const engineChoice = guardCancel( + await select<"aisdk" | "pi-agent">({ + message: "Which LLM engine should OpenClaw use?", + options: [ + { + value: "aisdk", + label: "AI SDK (recommended)", + hint: "Vercel AI SDK v6 - supports AI Gateway, multiple providers", + }, + { + value: "pi-agent", + label: "pi-agent (legacy)", + hint: "Original implementation - stable, proven", + }, + ], + initialValue: currentEngine, + }), + runtime, + ); + + return { + ...nextConfig, + agents: { + ...nextConfig.agents, + engine: engineChoice, + }, + }; +} + export async function runConfigureWizard( opts: ConfigureWizardParams, runtime: RuntimeEnv = defaultRuntime, @@ -318,6 +365,10 @@ export async function runConfigureWizard( nextConfig = await promptAuthConfig(nextConfig, runtime, prompter); } + if (selected.includes("engine")) { + nextConfig = await promptEngineConfig(nextConfig, runtime); + } + if (selected.includes("web")) { nextConfig = await promptWebToolsConfig(nextConfig, runtime); }