fix(core): type models.dev reasoning options

This commit is contained in:
Aiden Cline 2026-06-09 19:39:42 -05:00
commit e8c63dbf83
8 changed files with 122 additions and 29 deletions

View file

@ -12,7 +12,9 @@ import { location } from "../fixture/location"
import { testEffect } from "../lib/effect"
const reasoningOptions: ModelsDev.ReasoningOption[] = [
{ type: "toggle" },
{ type: "effort", values: [null, "low", "ultrathink"], default: "low" },
{ type: "budget_tokens", min: 1024, future: true },
{ type: "future_dynamic_budget", curve: { min: 1, max: 10 }, enabled: true },
]
@ -47,22 +49,20 @@ const locationLayer = Layer.succeed(
Location.Service,
Location.Service.of(location({ directory: AbsolutePath.make("test") })),
)
const catalog = Catalog.locationLayer.pipe(
Layer.provideMerge(EventV2.defaultLayer),
Layer.provideMerge(locationLayer),
)
const catalog = Catalog.locationLayer.pipe(Layer.provideMerge(EventV2.defaultLayer), Layer.provideMerge(locationLayer))
const it = testEffect(Layer.merge(catalog, modelsDev))
describe("ModelsDevPlugin", () => {
it.effect("preserves reasoning options in V2 model capabilities", () =>
it.effect("maps known reasoning options into typed V2 capabilities", () =>
Effect.gen(function* () {
yield* ModelsDevPlugin.effect
const model = yield* (yield* Catalog.Service).model.get(
ProviderV2.ID.make("acme"),
ModelV2.ID.make("acme-1"),
)
const model = yield* (yield* Catalog.Service).model.get(ProviderV2.ID.make("acme"), ModelV2.ID.make("acme-1"))
expect(model.capabilities.reasoningOptions).toEqual(reasoningOptions)
expect(model.capabilities.reasoningOptions).toEqual([
{ type: "toggle" },
{ type: "effort", values: ["low", "ultrathink"] },
{ type: "budget_tokens", min: 1024 },
])
}),
)
})