|
|
@@ -1,5 +1,5 @@
|
|
|
import { describe, expect, beforeAll, beforeEach, afterAll } from "bun:test"
|
|
|
-import { Effect, Layer, Ref } from "effect"
|
|
|
+import { Effect, Layer, Ref, Schema } from "effect"
|
|
|
import { HttpClient, HttpClientResponse } from "effect/unstable/http"
|
|
|
import { FSUtil } from "@opencode-ai/core/fs-util"
|
|
|
import { Flag } from "@opencode-ai/core/flag/flag"
|
|
|
@@ -126,6 +126,28 @@ const initialState: MockState = {
|
|
|
}
|
|
|
|
|
|
describe("ModelsDev Service", () => {
|
|
|
+ it.effect("decodes known reasoning options", () =>
|
|
|
+ Effect.sync(() => {
|
|
|
+ const result = Schema.decodeUnknownSync(ModelsDev.Model)({
|
|
|
+ id: "reasoning-model",
|
|
|
+ name: "Reasoning Model",
|
|
|
+ release_date: "2026-01-01",
|
|
|
+ attachment: false,
|
|
|
+ reasoning: true,
|
|
|
+ reasoning_options: [
|
|
|
+ { type: "effort", values: ["low", "high"] },
|
|
|
+ { type: "budget_tokens", min: 1024, max: 8192 },
|
|
|
+ { type: "toggle" },
|
|
|
+ ],
|
|
|
+ temperature: true,
|
|
|
+ tool_call: true,
|
|
|
+ limit: { context: 128000, output: 8192 },
|
|
|
+ })
|
|
|
+
|
|
|
+ expect(result.reasoning_options?.map((item) => item.type)).toEqual(["effort", "budget_tokens", "toggle"])
|
|
|
+ }),
|
|
|
+ )
|
|
|
+
|
|
|
it.live("get() returns providers from disk when cache file exists", () =>
|
|
|
Effect.gen(function* () {
|
|
|
yield* writeCache(fixture)
|