The open source coding agent.
TypeScript
fix(provider): support local file paths for custom providers (#4323)
sredfern736f8882f5bf
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.tsindex d2957e3be97..9aa960f1cb8 100644--- a/packages/opencode/src/provider/provider.ts+++ b/packages/opencode/src/provider/provider.ts@@ -470,7 +470,15 @@ export namespace Provider {const key = Bun.hash.xxHash32(JSON.stringify({ pkg, options }))const existing = s.sdk.get(key)if (existing) return existing- const installedPath = await BunProc.install(pkg, "latest")++ let installedPath: string+ if (!pkg.startsWith("file://")) {+ installedPath = await BunProc.install(pkg, "latest")+ } else {+ log.info("loading local provider", { pkg })+ installedPath = pkg+ }+// The `google-vertex-anthropic` provider points to the `@ai-sdk/google-vertex` package.// Ref: https://github.com/sst/models.dev/blob/0a87de42ab177bebad0620a889e2eb2b4a5dd4ab/providers/google-vertex-anthropic/provider.toml// However, the actual export is at the subpath `@ai-sdk/google-vertex/anthropic`.