Open History to see the last commit
1import { describe, expect, it } from "vitest";
2import { ProviderDriverKind, type ModelCapabilities } from "@t3tools/contracts";
3import { createModelCapabilities } from "@t3tools/shared/model";
4
5import { providerModelsFromSettings } from "./providerSnapshot.ts";
6
7const OPENCODE_CUSTOM_MODEL_CAPABILITIES: ModelCapabilities = createModelCapabilities({
8 optionDescriptors: [
9 {
10 id: "variant",
11 label: "Reasoning",
12 type: "select",
13 options: [{ id: "medium", label: "Medium", isDefault: true }],
14 currentValue: "medium",
15 },
16 {
17 id: "agent",
18 label: "Agent",
19 type: "select",
20 options: [{ id: "build", label: "Build", isDefault: true }],
21 currentValue: "build",
22 },
23 ],
24});
25
26describe("providerModelsFromSettings", () => {
27 it("applies the provided capabilities to custom models", () => {
28 const models = providerModelsFromSettings(
29 [],
30 ProviderDriverKind.make("opencode"),
31 ["openai/gpt-5"],
32 OPENCODE_CUSTOM_MODEL_CAPABILITIES,
33 );
34
35 expect(models).toEqual([
36 {
37 slug: "openai/gpt-5",
38 name: "openai/gpt-5",
39 isCustom: true,
40 capabilities: OPENCODE_CUSTOM_MODEL_CAPABILITIES,
41 },
42 ]);
43 });
44});