/** * Provider-policy API for Anthropic and Claude CLI. Core calls this lightweight * path for config defaults and thinking profiles. */ import { resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeThinkingProfile, } from "openclaw/plugin-sdk/provider-model-shared"; import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-types"; import { CLAUDE_CLI_OFF_THINKING_PROFILE } from "./cli-shared.js"; import { applyAnthropicConfigDefaults, normalizeAnthropicProviderConfigForProvider, } from "./config-defaults.js"; /** Normalize Anthropic provider config without importing runtime registration. */ export function normalizeConfig(params: { provider: string; providerConfig: ModelProviderConfig }) { return normalizeAnthropicProviderConfigForProvider(params); } /** Apply Anthropic config defaults through the provider-policy seam. */ export function applyConfigDefaults(params: Parameters[0]) { return applyAnthropicConfigDefaults(params); } /** Resolve Claude thinking profile for Anthropic or Claude CLI providers. */ export function resolveThinkingProfile(params: { provider: string; modelId: string; params?: Record; }) { const contractModelId = resolveClaudeModelIdentity({ id: params.modelId, params: params.params, }); switch (params.provider.trim().toLowerCase()) { case "anthropic": return resolveClaudeThinkingProfile(contractModelId, undefined, { includeNativeMax: true, }); case "claude-cli": if (resolveClaudeFable5ModelIdentity({ id: contractModelId })) { return CLAUDE_CLI_OFF_THINKING_PROFILE; } return resolveClaudeThinkingProfile(contractModelId, undefined, { includeNativeMax: true, }); default: return null; } }