refactor(model-core): remove src back-imports via core utilities and adapter

- move fuzzyMatchModel and transformModelForProvider into model-core

- replace connected-providers re-export with adapter contract

- route shared wrappers through model-core exports

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-21 11:36:01 +09:00
parent 819bf0d11f
commit 2462d7af29
9 changed files with 222 additions and 51 deletions
@@ -23,18 +23,13 @@ function applyGatewayTransforms(model: string): string {
}
export function transformModelForProvider(provider: string, model: string): string {
// Vercel AI Gateway expects <sub-provider>/<model> (e.g. anthropic/claude-opus-4.7).
// Canonical names in model-requirements.ts may be bare (claude-opus-4-7) or
// already prefixed (anthropic/claude-opus-4-7). Both need gateway-specific transforms.
if (provider === "vercel") {
// Already prefixed — transform only the model part
const slashIndex = model.indexOf("/")
if (slashIndex !== -1) {
const subProvider = model.substring(0, slashIndex)
const subModel = model.substring(slashIndex + 1)
return `${subProvider}/${applyGatewayTransforms(subModel)}`
}
// Bare name — infer sub-provider from model prefix (claude- → anthropic, etc.)
const subProvider = inferSubProvider(model)
if (subProvider) {
return `${subProvider}/${applyGatewayTransforms(model)}`