fix(core): install AI SDK v6 providers by default (#53287)

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-10-05 17:42:31 -05:00
committed by GitHub
Unverified
parent 7d27d6a3da
commit fa992020c5
@@ -5,7 +5,7 @@ import { importModule, resolveModule } from "@opencode/util/runtime-import"
export const loadSDKFactory = Effect.fnUntraced(function* (npm: Npm.Interface, packageName: string) {
const installedPath = packageName.startsWith("file://")
? packageName
: yield* npm.add(packageName).pipe(
: yield* npm.add(installSpec(packageName)).pipe(
Effect.orDie,
Effect.map((installed) => resolveModule(installed.name, installed.directory)),
)
@@ -15,3 +15,10 @@ export const loadSDKFactory = Effect.fnUntraced(function* (npm: Npm.Interface, p
if (!match) return yield* Effect.die(new Error(`Package ${packageName} has no provider factory export`))
return mod[match]
})
// The AI SDK bridge only supports AI SDK v6 providers. Official `@ai-sdk/*` packages now publish AI SDK v7 under
// `latest` and keep the v6 line under the `ai-v6` dist-tag, so an unversioned official package installs that tag.
// An explicit version, range, or tag is installed as written.
function installSpec(packageName: string) {
return /^@ai-sdk\/[^/@]+$/.test(packageName) ? `${packageName}@ai-v6` : packageName
}