mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
chore(ai): drop five unused legacy provider entrypoint aliases (#59506)
This commit is contained in:
committed by
GitHub
Unverified
parent
24bf4d488a
commit
96ae220b01
@@ -28,7 +28,6 @@
|
||||
"./providers/alibaba/messages": "./src/providers/alibaba/messages.ts",
|
||||
"./providers/alibaba/responses": "./src/providers/alibaba/responses.ts",
|
||||
"./providers/amazon-bedrock": "./src/providers/amazon-bedrock.ts",
|
||||
"./providers/amazon-bedrock-mantle": "./src/providers/amazon-bedrock-mantle.ts",
|
||||
"./providers/amazon-bedrock/mantle": "./src/providers/amazon-bedrock/mantle.ts",
|
||||
"./providers/amazon-bedrock/mantle/chat": "./src/providers/amazon-bedrock/mantle/chat.ts",
|
||||
"./providers/amazon-bedrock/mantle/messages": "./src/providers/amazon-bedrock/mantle/messages.ts",
|
||||
@@ -63,11 +62,7 @@
|
||||
"./providers/fireworks": "./src/providers/fireworks.ts",
|
||||
"./providers/google": "./src/providers/google.ts",
|
||||
"./providers/google-vertex": "./src/providers/google-vertex.ts",
|
||||
"./providers/google-vertex-chat": "./src/providers/google-vertex-chat.ts",
|
||||
"./providers/google-vertex-interactions": "./src/providers/google-vertex-interactions.ts",
|
||||
"./providers/google-vertex-messages": "./src/providers/google-vertex-messages.ts",
|
||||
"./providers/google-vertex-mistral": "./src/providers/google-vertex-mistral.ts",
|
||||
"./providers/google-vertex-responses": "./src/providers/google-vertex-responses.ts",
|
||||
"./providers/google-vertex/chat": "./src/providers/google-vertex/chat.ts",
|
||||
"./providers/google-vertex/gemini": "./src/providers/google-vertex/gemini.ts",
|
||||
"./providers/google-vertex/images": "./src/providers/google-vertex/images.ts",
|
||||
|
||||
@@ -137,12 +137,21 @@ const mantle = (modelID: string | undefined) => {
|
||||
return `@opencode/ai/providers/amazon-bedrock/mantle/${modelID.includes("gpt-oss") ? "chat" : "responses"}`
|
||||
}
|
||||
|
||||
// Old hyphenated Vertex entrypoints that stale configs may still name.
|
||||
const LEGACY_VERTEX: Readonly<Record<string, string>> = {
|
||||
"@opencode/ai/providers/google-vertex-chat": "@opencode/ai/providers/google-vertex/chat",
|
||||
"@opencode/ai/providers/google-vertex-responses": "@opencode/ai/providers/google-vertex/responses",
|
||||
"@opencode/ai/providers/google-vertex-interactions": "@opencode/ai/providers/google-vertex/interactions",
|
||||
"@opencode/ai/providers/google-vertex-mistral": "@opencode/ai/providers/google-vertex/mistral",
|
||||
}
|
||||
|
||||
function resolve(specifier: string, context: Context & { readonly settings?: Provider.Settings }): string | undefined {
|
||||
const npm = Provider.packageName(specifier)
|
||||
if (Provider.isAISDK(specifier) || npm in PACKAGES || npm in (HOSTS[context.providerID] ?? {}))
|
||||
return native(npm, context)
|
||||
if (npm === "@opencode/ai/providers/amazon-bedrock/mantle" || npm === "@opencode/ai/providers/amazon-bedrock-mantle")
|
||||
return mantle(context.modelID)
|
||||
if (npm in LEGACY_VERTEX) return LEGACY_VERTEX[npm]
|
||||
if (
|
||||
(npm === "@opencode/ai/providers/azure" || npm === "@opencode/ai/providers/azure/responses") &&
|
||||
azureChat(context)
|
||||
|
||||
@@ -65,7 +65,6 @@ const builtins = new Map<string, () => Promise<unknown>>([
|
||||
"@opencode/ai/providers/amazon-bedrock/mantle/responses",
|
||||
() => import("@opencode/ai/providers/amazon-bedrock/mantle/responses"),
|
||||
],
|
||||
["@opencode/ai/providers/amazon-bedrock-mantle", () => import("@opencode/ai/providers/amazon-bedrock-mantle")],
|
||||
["@opencode/ai/providers/anthropic", () => import("@opencode/ai/providers/anthropic")],
|
||||
["@opencode/ai/providers/anthropic-compatible", () => import("@opencode/ai/providers/anthropic-compatible")],
|
||||
["@opencode/ai/providers/azure", () => import("@opencode/ai/providers/azure")],
|
||||
@@ -111,14 +110,7 @@ const builtins = new Map<string, () => Promise<unknown>>([
|
||||
["@opencode/ai/providers/google-vertex/mistral", () => import("@opencode/ai/providers/google-vertex/mistral")],
|
||||
["@opencode/ai/providers/google-vertex/responses", () => import("@opencode/ai/providers/google-vertex/responses")],
|
||||
["@opencode/ai/providers/google-vertex/images", () => import("@opencode/ai/providers/google-vertex/images")],
|
||||
["@opencode/ai/providers/google-vertex-chat", () => import("@opencode/ai/providers/google-vertex-chat")],
|
||||
[
|
||||
"@opencode/ai/providers/google-vertex-interactions",
|
||||
() => import("@opencode/ai/providers/google-vertex-interactions"),
|
||||
],
|
||||
["@opencode/ai/providers/google-vertex-messages", () => import("@opencode/ai/providers/google-vertex-messages")],
|
||||
["@opencode/ai/providers/google-vertex-mistral", () => import("@opencode/ai/providers/google-vertex-mistral")],
|
||||
["@opencode/ai/providers/google-vertex-responses", () => import("@opencode/ai/providers/google-vertex-responses")],
|
||||
["@opencode/ai/providers/groq", () => import("@opencode/ai/providers/groq")],
|
||||
["@opencode/ai/providers/meta", () => import("@opencode/ai/providers/meta")],
|
||||
["@opencode/ai/providers/meta/chat", () => import("@opencode/ai/providers/meta/chat")],
|
||||
|
||||
@@ -610,7 +610,6 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
"@opencode/ai/providers/azure/responses": openaiResponses,
|
||||
"@opencode/ai/providers/amazon-bedrock/mantle": openaiResponses,
|
||||
"@opencode/ai/providers/amazon-bedrock/mantle/responses": openaiResponses,
|
||||
"@opencode/ai/providers/amazon-bedrock-mantle": openaiResponses,
|
||||
"@opencode/ai/providers/alibaba/responses": openaiResponses,
|
||||
"@opencode/ai/providers/meta": openaiResponses,
|
||||
"@opencode/ai/providers/meta/responses": openaiResponses,
|
||||
@@ -621,7 +620,6 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
"@opencode/ai/providers/openai-compatible/responses": openResponses,
|
||||
"@opencode/ai/providers/openai-compatible-responses": openResponses,
|
||||
"@opencode/ai/providers/google-vertex/responses": openResponses,
|
||||
"@opencode/ai/providers/google-vertex-responses": openResponses,
|
||||
"@opencode/ai/providers/xai": openResponses,
|
||||
|
||||
"@opencode/ai/providers/openai-compatible": openaiCompatible,
|
||||
@@ -629,7 +627,6 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
"@opencode/ai/providers/azure/chat": openaiChat,
|
||||
"@opencode/ai/providers/amazon-bedrock/mantle/chat": openaiChat,
|
||||
"@opencode/ai/providers/google-vertex/chat": vertexChat,
|
||||
"@opencode/ai/providers/google-vertex-chat": vertexChat,
|
||||
"@opencode/ai/providers/alibaba": alibabaChat,
|
||||
"@opencode/ai/providers/alibaba/chat": alibabaChat,
|
||||
"@opencode/ai/providers/baseten": basetenChat,
|
||||
@@ -645,7 +642,6 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
"@opencode/ai/providers/minimax/chat": openaiChat,
|
||||
"@opencode/ai/providers/mistral": openaiChat,
|
||||
"@opencode/ai/providers/google-vertex/mistral": openaiChat,
|
||||
"@opencode/ai/providers/google-vertex-mistral": openaiChat,
|
||||
"@opencode/ai/providers/moonshot": moonshotChat,
|
||||
"@opencode/ai/providers/moonshot/chat": moonshotChat,
|
||||
"@opencode/ai/providers/togetherai": openaiChat,
|
||||
@@ -674,7 +670,6 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
"@opencode/ai/providers/google-vertex/images": gemini,
|
||||
"@opencode/ai/providers/google/interactions": googleInteractions,
|
||||
"@opencode/ai/providers/google-vertex/interactions": googleInteractions,
|
||||
"@opencode/ai/providers/google-vertex-interactions": googleInteractions,
|
||||
|
||||
"@opencode/ai/providers/amazon-bedrock": bedrockConverse,
|
||||
"@opencode/ai/providers/cohere": cohere,
|
||||
|
||||
@@ -252,6 +252,13 @@ describe("AISDKNative", () => {
|
||||
package: "@opencode/ai/providers/amazon-bedrock/mantle/messages",
|
||||
settings: { apiKey: "token" },
|
||||
})
|
||||
expect(rewrite("@opencode/ai/providers/amazon-bedrock-mantle", {}, "openai.gpt-oss-120b").package).toBe(
|
||||
"@opencode/ai/providers/amazon-bedrock/mantle/chat",
|
||||
)
|
||||
for (const name of ["chat", "responses", "interactions", "mistral"])
|
||||
expect(rewrite(`@opencode/ai/providers/google-vertex-${name}`, {}).package).toBe(
|
||||
`@opencode/ai/providers/google-vertex/${name}`,
|
||||
)
|
||||
expect(rewrite("@opencode/ai/providers/azure", { useCompletionUrls: true }).package).toBe(
|
||||
"@opencode/ai/providers/azure/chat",
|
||||
)
|
||||
|
||||
@@ -26,15 +26,7 @@ describe("Provider", () => {
|
||||
})
|
||||
|
||||
test("keeps loading the hyphenated provider paths existing configs reference", async () => {
|
||||
for (const name of [
|
||||
"amazon-bedrock-mantle",
|
||||
"google-vertex-chat",
|
||||
"google-vertex-interactions",
|
||||
"google-vertex-messages",
|
||||
"google-vertex-mistral",
|
||||
"google-vertex-responses",
|
||||
"openai-compatible-responses",
|
||||
]) {
|
||||
for (const name of ["google-vertex-messages", "openai-compatible-responses"]) {
|
||||
const specifier = `@opencode/ai/providers/${name}`
|
||||
expect(Provider.builtinPackages.has(specifier)).toBe(true)
|
||||
const loaded = await Effect.runPromise(Provider.loadPackage(specifier))
|
||||
|
||||
Reference in New Issue
Block a user