mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 05:01:03 +03:00
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:
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user