chore: merge dev into v2 (#36144)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com> Co-authored-by: James Long <longster@gmail.com> Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com> Co-authored-by: Jack <jack@anoma.ly> Co-authored-by: opencode <opencode@sst.dev> Co-authored-by: Frank <frank@anoma.ly> Co-authored-by: Jay <53023+jayair@users.noreply.github.com> Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com> Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com> Co-authored-by: Julian Coy <julian@ex-machina.co> Co-authored-by: Brendan Allan <git@brendonovich.dev> Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com> Co-authored-by: Dustin Deus <deusdustin@gmail.com> Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: Simon Klee <hello@simonklee.dk> Co-authored-by: Jay <air@live.ca> Co-authored-by: David Hill <1879069+iamdavidhill@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: James Long <jlongster@users.noreply.github.com> Co-authored-by: 冯基魁 <56265583+fengjikui@users.noreply.github.com> Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com>
This commit is contained in:
co-authored by
opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
usrnk1
James Long
opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Aiden Cline
Brendan Allan
Jack
opencode
Frank
Jay
Luke Parker
Aarav Sareen
Julian Coy
Brendan Allan
Vladimir Glafirov
Adam
Dustin Deus
Kit Langton
Simon Klee
Jay
David Hill
Aiden Cline
James Long
冯基魁
Aiden Cline
parent
a72992e00f
commit
a7746379d5
@@ -24,6 +24,8 @@ import { testEffect } from "../lib/effect"
|
||||
import { ProviderV2 } from "@opencode-ai/core/provider"
|
||||
import { ModelV2 } from "@opencode-ai/core/model"
|
||||
|
||||
type ModelsDevProvider = Parameters<typeof Provider.fromModelsDevProvider>[0]
|
||||
|
||||
const originalEnv = new Map<string, string | undefined>()
|
||||
|
||||
const rememberEnv = (k: string) => {
|
||||
@@ -1386,8 +1388,7 @@ test("mode cost preserves over-200k pricing from base model", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
// @ts-expect-error dead V1 fixture uses the removed pre-normalized ModelsDev provider type.
|
||||
} as unknown as ModelsDev.Provider
|
||||
} as unknown as ModelsDevProvider
|
||||
|
||||
const model = Provider.fromModelsDevProvider(provider).models["gpt-5.4-fast"]
|
||||
expect(model.cost.input).toEqual(5)
|
||||
@@ -1416,8 +1417,7 @@ test("models.dev normalization fills required response fields", () => {
|
||||
limit: { context: 1_050_000, input: 922_000, output: 128_000 },
|
||||
},
|
||||
},
|
||||
// @ts-expect-error dead V1 fixture uses the removed pre-normalized ModelsDev provider type.
|
||||
} as unknown as ModelsDev.Provider
|
||||
} as unknown as ModelsDevProvider
|
||||
|
||||
const model = Provider.fromModelsDevProvider(provider).models["gpt-5.4"]
|
||||
expect(model.api.url).toBe("")
|
||||
@@ -1428,6 +1428,32 @@ test("models.dev normalization fills required response fields", () => {
|
||||
expect(model.release_date).toBe("")
|
||||
})
|
||||
|
||||
test("public provider info omits invalid models", () => {
|
||||
const provider = Provider.fromModelsDevProvider({
|
||||
id: "test",
|
||||
name: "Test",
|
||||
env: [],
|
||||
models: {
|
||||
valid: {
|
||||
id: "valid",
|
||||
name: "Valid",
|
||||
cost: { input: 1, output: 1 },
|
||||
limit: { context: 128_000, output: 16_000 },
|
||||
},
|
||||
},
|
||||
} as unknown as ModelsDevProvider)
|
||||
provider.models.invalid = {
|
||||
...provider.models.valid,
|
||||
id: ModelV2.ID.make("invalid"),
|
||||
cost: { ...provider.models.valid.cost, input: Number.NaN },
|
||||
}
|
||||
|
||||
const result = Provider.toPublicInfo(provider)
|
||||
|
||||
expect(result.models.valid).toBeDefined()
|
||||
expect(result.models.invalid).toBeUndefined()
|
||||
})
|
||||
|
||||
it.instance("model variants are generated for reasoning models", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* set("ANTHROPIC_API_KEY", "test-api-key")
|
||||
|
||||
Reference in New Issue
Block a user