mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
* feat: add Claude Opus 4.6 to built-in model catalog - Update default model from claude-opus-4-5 to claude-opus-4-6 - Add opus-4.6 model ID normalization - Add claude-opus-4-6 to live model filter prefixes - Update image tool to prefer claude-opus-4-6 for vision - Add CLI backend alias for opus-4.6 - Update onboard auth default selections to include opus-4.6 - Update model picker placeholder Closes #9811 * test: update tests for claude-opus-4-6 default - Fix model-alias-defaults test to use claude-opus-4-6 - Fix image-tool test to expect claude-opus-4-6 in fallbacks * feat: support claude-opus-4-6 * docs: update changelog for opus 4.6 (#9853) (thanks @TinyTb) * chore: bump pi to 0.52.0 --------- Co-authored-by: Slurpy <slurpy@openclaw.ai> Co-authored-by: Peter Steinberger <steipete@gmail.com>
95 lines
2.8 KiB
TypeScript
95 lines
2.8 KiB
TypeScript
import type { OpenClawConfig, GatewayAuthConfig } from "../config/config.js";
|
|
import type { RuntimeEnv } from "../runtime.js";
|
|
import type { WizardPrompter } from "../wizard/prompts.js";
|
|
import { ensureAuthProfileStore } from "../agents/auth-profiles.js";
|
|
import { promptAuthChoiceGrouped } from "./auth-choice-prompt.js";
|
|
import { applyAuthChoice, resolvePreferredProviderForAuthChoice } from "./auth-choice.js";
|
|
import {
|
|
applyModelAllowlist,
|
|
applyModelFallbacksFromSelection,
|
|
applyPrimaryModel,
|
|
promptDefaultModel,
|
|
promptModelAllowlist,
|
|
} from "./model-picker.js";
|
|
|
|
type GatewayAuthChoice = "token" | "password";
|
|
|
|
const ANTHROPIC_OAUTH_MODEL_KEYS = [
|
|
"anthropic/claude-opus-4-6",
|
|
"anthropic/claude-opus-4-5",
|
|
"anthropic/claude-sonnet-4-5",
|
|
"anthropic/claude-haiku-4-5",
|
|
];
|
|
|
|
export function buildGatewayAuthConfig(params: {
|
|
existing?: GatewayAuthConfig;
|
|
mode: GatewayAuthChoice;
|
|
token?: string;
|
|
password?: string;
|
|
}): GatewayAuthConfig | undefined {
|
|
const allowTailscale = params.existing?.allowTailscale;
|
|
const base: GatewayAuthConfig = {};
|
|
if (typeof allowTailscale === "boolean") {
|
|
base.allowTailscale = allowTailscale;
|
|
}
|
|
|
|
if (params.mode === "token") {
|
|
return { ...base, mode: "token", token: params.token };
|
|
}
|
|
return { ...base, mode: "password", password: params.password };
|
|
}
|
|
|
|
export async function promptAuthConfig(
|
|
cfg: OpenClawConfig,
|
|
runtime: RuntimeEnv,
|
|
prompter: WizardPrompter,
|
|
): Promise<OpenClawConfig> {
|
|
const authChoice = await promptAuthChoiceGrouped({
|
|
prompter,
|
|
store: ensureAuthProfileStore(undefined, {
|
|
allowKeychainPrompt: false,
|
|
}),
|
|
includeSkip: true,
|
|
});
|
|
|
|
let next = cfg;
|
|
if (authChoice !== "skip") {
|
|
const applied = await applyAuthChoice({
|
|
authChoice,
|
|
config: next,
|
|
prompter,
|
|
runtime,
|
|
setDefaultModel: true,
|
|
});
|
|
next = applied.config;
|
|
} else {
|
|
const modelSelection = await promptDefaultModel({
|
|
config: next,
|
|
prompter,
|
|
allowKeep: true,
|
|
ignoreAllowlist: true,
|
|
preferredProvider: resolvePreferredProviderForAuthChoice(authChoice),
|
|
});
|
|
if (modelSelection.model) {
|
|
next = applyPrimaryModel(next, modelSelection.model);
|
|
}
|
|
}
|
|
|
|
const anthropicOAuth =
|
|
authChoice === "setup-token" || authChoice === "token" || authChoice === "oauth";
|
|
|
|
const allowlistSelection = await promptModelAllowlist({
|
|
config: next,
|
|
prompter,
|
|
allowedKeys: anthropicOAuth ? ANTHROPIC_OAUTH_MODEL_KEYS : undefined,
|
|
initialSelections: anthropicOAuth ? ["anthropic/claude-opus-4-6"] : undefined,
|
|
message: anthropicOAuth ? "Anthropic OAuth models" : undefined,
|
|
});
|
|
if (allowlistSelection.models) {
|
|
next = applyModelAllowlist(next, allowlistSelection.models);
|
|
next = applyModelFallbacksFromSelection(next, allowlistSelection.models);
|
|
}
|
|
|
|
return next;
|
|
}
|