Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2
3import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts";
4
5import { compileClaudeModelSelection } from "./claudeModelOptions.ts";
6
7const selection = (
8 model: string,
9 options: NonNullable<ModelSelection["options"]>,
10): ModelSelection => ({
11 instanceId: ProviderInstanceId.make("claude_test"),
12 model,
13 options,
14});
15
16describe("compileClaudeModelSelection", () => {
17 it("compiles context, effort, and settings together", () => {
18 expect(
19 compileClaudeModelSelection(
20 selection("claude-opus-4-6", [
21 { id: "contextWindow", value: "1m" },
22 { id: "effort", value: "max" },
23 { id: "fastMode", value: true },
24 ]),
25 ),
26 ).toMatchObject({
27 apiModelId: "claude-opus-4-6[1m]",
28 effort: "max",
29 settings: { fastMode: true },
30 });
31 });
32
33 it("uses the model default SDK effort alongside prompt-injected effort", () => {
34 expect(
35 compileClaudeModelSelection(
36 selection("claude-sonnet-4-6", [{ id: "effort", value: "ultrathink" }]),
37 ),
38 ).toMatchObject({ effort: "high", promptEffort: "ultrathink" });
39 });
40
41 it("keeps explicit effort for models missing from the local catalog", () => {
42 expect(
43 compileClaudeModelSelection(
44 selection("claude-pool-model-not-in-catalog", [{ id: "effort", value: "max" }]),
45 ).effort,
46 ).toBe("max");
47 expect(
48 compileClaudeModelSelection(selection("claude-pool-model-not-in-catalog", [])).effort,
49 ).toBeUndefined();
50 });
51});