Files
openclaw/extensions/opencode/provider-policy-api.test.ts
Peter Steinberger c7cf69a110 fix(opencode): refresh hosted model catalogs (#121030)
* fix(opencode): refresh hosted model catalogs

Align Zen and Go availability, pricing, limits, transports, lifecycle metadata, and model-specific reasoning controls with current provider contracts.

Co-authored-by: samson1357924 <samson1357924@gmail.com>

Co-authored-by: xialonglee <li.xialong@xydigit.com>

* fix(opencode): align catalog metadata with runtime contracts

---------

Co-authored-by: xialonglee <li.xialong@xydigit.com>
2026-08-09 04:05:47 -07:00

96 lines
2.6 KiB
TypeScript

// Opencode tests cover provider policy api plugin behavior.
import { describe, expect, it } from "vitest";
import { resolveThinkingProfile } from "./provider-policy-api.js";
describe("opencode provider policy public artifact", () => {
it("exposes Claude Opus 4.7 thinking levels without loading the full provider plugin", () => {
expect(
resolveThinkingProfile({
provider: "opencode",
modelId: "claude-opus-4-7",
}),
).toEqual({
levels: [
{ id: "off" },
{ id: "minimal" },
{ id: "low" },
{ id: "medium" },
{ id: "high" },
{ id: "xhigh" },
{ id: "adaptive" },
{ id: "max" },
],
defaultLevel: "off",
});
});
it("keeps adaptive-only Claude profiles aligned with Anthropic", () => {
const profile = resolveThinkingProfile({
provider: "opencode",
modelId: "claude-opus-4-6",
});
expect(profile).toEqual({
levels: [
{ id: "off" },
{ id: "minimal" },
{ id: "low" },
{ id: "medium" },
{ id: "high" },
{ id: "adaptive" },
],
defaultLevel: "adaptive",
});
});
it("exposes the full GPT-5.6 reasoning profile", () => {
expect(
resolveThinkingProfile({
provider: "opencode",
modelId: "gpt-5.6-luna",
compat: {
supportedReasoningEfforts: ["none", "low", "medium", "high", "xhigh", "max"],
},
}),
).toEqual({
levels: [
{ id: "off" },
{ id: "low" },
{ id: "medium" },
{ id: "high" },
{ id: "xhigh" },
{ id: "max" },
],
defaultLevel: "medium",
});
});
it("derives non-Claude profiles only from exact provider effort metadata", () => {
expect(
resolveThinkingProfile({
provider: "opencode",
modelId: "grok-4.5",
compat: { supportedReasoningEfforts: ["low", "medium", "high"] },
}),
).toEqual({
levels: [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }],
defaultLevel: "medium",
});
expect(
resolveThinkingProfile({
provider: "opencode",
modelId: "kimi-k3",
compat: { supportedReasoningEfforts: ["max"] },
}),
).toEqual({ levels: [{ id: "off" }, { id: "max" }], defaultLevel: "off" });
expect(
resolveThinkingProfile({
provider: "opencode",
modelId: "big-pickle",
api: "openai-completions",
reasoning: true,
}),
).toEqual({ levels: [{ id: "off", label: "always on" }], defaultLevel: "off" });
});
});