From 8512e7008828603d7137c288927f5e008951935e Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Thu, 2 Apr 2026 10:31:14 -0500 Subject: [PATCH 1/2] Revert "chore: generate" This reverts commit 57a5236e71f983fbeb06834fd4ec7990aa260975. --- packages/sdk/js/src/v2/gen/types.gen.ts | 12 +++++++++ packages/sdk/openapi.json | 35 ++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 6ac6af1439a1..2f8e99cfed8f 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -4168,11 +4168,23 @@ export type ProviderListResponses = { input: Array<"text" | "audio" | "image" | "video" | "pdf"> output: Array<"text" | "audio" | "image" | "video" | "pdf"> } + experimental?: boolean status?: "alpha" | "beta" | "deprecated" + options: { + [key: string]: unknown + } + headers?: { + [key: string]: string + } provider?: { npm?: string api?: string } + variants?: { + [key: string]: { + [key: string]: unknown + } + } } } }> diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 549fcc4fe14e..8e41f9deb0b9 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -4744,10 +4744,29 @@ }, "required": ["input", "output"] }, + "experimental": { + "type": "boolean" + }, "status": { "type": "string", "enum": ["alpha", "beta", "deprecated"] }, + "options": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "headers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, "provider": { "type": "object", "properties": { @@ -4758,6 +4777,19 @@ "type": "string" } } + }, + "variants": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } } }, "required": [ @@ -4768,7 +4800,8 @@ "reasoning", "temperature", "tool_call", - "limit" + "limit", + "options" ] } } From 8d80efd5be093e23c646c267bce55bf413ff208d Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Thu, 2 Apr 2026 10:31:15 -0500 Subject: [PATCH 2/2] Revert "refactor: split up models.dev and config model definitions to prevent coupling (#20605)" This reverts commit 23c865608018a882a99149b7e979f4f6fbcc0600. --- packages/opencode/src/config/config.ts | 85 +++++----------------- packages/opencode/src/provider/models.ts | 4 + packages/opencode/src/provider/provider.ts | 4 +- packages/opencode/src/session/llm.ts | 3 +- 4 files changed, 26 insertions(+), 70 deletions(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index b41e5d71c25e..3cae1af4bdb2 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -730,77 +730,28 @@ export namespace Config { }) export type Layout = z.infer - export const Model = z - .object({ - id: z.string(), - name: z.string(), - family: z.string().optional(), - release_date: z.string(), - attachment: z.boolean(), - reasoning: z.boolean(), - temperature: z.boolean(), - tool_call: z.boolean(), - interleaved: z - .union([ - z.literal(true), - z - .object({ - field: z.enum(["reasoning_content", "reasoning_details"]), - }) - .strict(), - ]) - .optional(), - cost: z - .object({ - input: z.number(), - output: z.number(), - cache_read: z.number().optional(), - cache_write: z.number().optional(), - context_over_200k: z - .object({ - input: z.number(), - output: z.number(), - cache_read: z.number().optional(), - cache_write: z.number().optional(), - }) - .optional(), - }) - .optional(), - limit: z.object({ - context: z.number(), - input: z.number().optional(), - output: z.number(), - }), - modalities: z - .object({ - input: z.array(z.enum(["text", "audio", "image", "video", "pdf"])), - output: z.array(z.enum(["text", "audio", "image", "video", "pdf"])), - }) - .optional(), - experimental: z.boolean().optional(), - status: z.enum(["alpha", "beta", "deprecated"]).optional(), - options: z.record(z.string(), z.any()), - headers: z.record(z.string(), z.string()).optional(), - provider: z.object({ npm: z.string().optional(), api: z.string().optional() }).optional(), - variants: z - .record( - z.string(), - z - .object({ - disabled: z.boolean().optional().describe("Disable this variant for the model"), - }) - .catchall(z.any()), - ) - .optional() - .describe("Variant-specific configuration"), - }) - .partial() - export const Provider = ModelsDev.Provider.partial() .extend({ whitelist: z.array(z.string()).optional(), blacklist: z.array(z.string()).optional(), - models: z.record(z.string(), Model).optional(), + models: z + .record( + z.string(), + ModelsDev.Model.partial().extend({ + variants: z + .record( + z.string(), + z + .object({ + disabled: z.boolean().optional().describe("Disable this variant for the model"), + }) + .catchall(z.any()), + ) + .optional() + .describe("Variant-specific configuration"), + }), + ) + .optional(), options: z .object({ apiKey: z.string().optional(), diff --git a/packages/opencode/src/provider/models.ts b/packages/opencode/src/provider/models.ts index 0e2a26b4d986..30901ea74f0e 100644 --- a/packages/opencode/src/provider/models.ts +++ b/packages/opencode/src/provider/models.ts @@ -61,8 +61,12 @@ export namespace ModelsDev { output: z.array(z.enum(["text", "audio", "image", "video", "pdf"])), }) .optional(), + experimental: z.boolean().optional(), status: z.enum(["alpha", "beta", "deprecated"]).optional(), + options: z.record(z.string(), z.any()), + headers: z.record(z.string(), z.string()).optional(), provider: z.object({ npm: z.string().optional(), api: z.string().optional() }).optional(), + variants: z.record(z.string(), z.record(z.string(), z.any())).optional(), }) export type Model = z.infer diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index c1b5e61d19d3..441f84b907cc 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -903,8 +903,8 @@ export namespace Provider { npm: model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible", }, status: model.status ?? "active", - headers: {}, - options: {}, + headers: model.headers ?? {}, + options: model.options ?? {}, cost: { input: model.cost?.input ?? 0, output: model.cost?.output ?? 0, diff --git a/packages/opencode/src/session/llm.ts b/packages/opencode/src/session/llm.ts index 41f72df06a66..dc89db409e87 100644 --- a/packages/opencode/src/session/llm.ts +++ b/packages/opencode/src/session/llm.ts @@ -1,6 +1,7 @@ import { Provider } from "@/provider/provider" import { Log } from "@/util/log" -import { Effect, Layer, Record, ServiceMap } from "effect" +import { Cause, Effect, Layer, Record, ServiceMap } from "effect" +import * as Queue from "effect/Queue" import * as Stream from "effect/Stream" import { streamText, wrapLanguageModel, type ModelMessage, type Tool, tool, jsonSchema } from "ai" import { mergeDeep, pipe } from "remeda"