feat(core): flatten provider config and load native packages (#35563)
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
parent
d603eed5a1
commit
e57d9ca390
107 changed files with 2593 additions and 1984 deletions
28
packages/core/test/config/model.test.ts
Normal file
28
packages/core/test/config/model.test.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { describe, expect, test } from "bun:test"
|
||||
import { ConfigModel } from "@opencode-ai/core/config/model"
|
||||
import { Model } from "@opencode-ai/schema/model"
|
||||
import { Provider } from "@opencode-ai/schema/provider"
|
||||
import { Schema } from "effect"
|
||||
|
||||
const decode = Schema.decodeUnknownSync(ConfigModel.Selection)
|
||||
|
||||
describe("ConfigModel.Selection", () => {
|
||||
test("normalizes short and explicit model selections", () => {
|
||||
expect(decode("openrouter/openai/gpt-5#high")).toEqual({
|
||||
providerID: Provider.ID.make("openrouter"),
|
||||
model: Model.ID.make("openai/gpt-5"),
|
||||
variant: Model.VariantID.make("high"),
|
||||
})
|
||||
expect(decode({ providerID: "anthropic", model: "claude-sonnet", variant: "high" })).toEqual({
|
||||
providerID: Provider.ID.make("anthropic"),
|
||||
model: Model.ID.make("claude-sonnet"),
|
||||
variant: Model.VariantID.make("high"),
|
||||
})
|
||||
})
|
||||
|
||||
test("rejects malformed selections and reserved fragments", () => {
|
||||
expect(() => decode("gpt-5")).toThrow()
|
||||
expect(() => decode("openai/gpt-5#")).toThrow()
|
||||
expect(() => decode({ providerID: "openai", model: "gpt-5#high" })).toThrow()
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue