def44338ff
Updates the canonical Anthropic Opus model in every fallback chain (sisyphus, oracle, prometheus, metis, momus, visual-engineering, ultrabrain, deep, artistry, unspecified-high), the unspecified-high category default, the think-mode HIGH_VARIANT_MAP, the Claude Code alias map, the claude-thinking legacy alias, the context-limit GA regex, and event.ts fallback strings. Widens supportsCachedAnthropicLimit to accept both claude-*-4-6 and claude-*-4-7 so the 1M context cache still applies across the bump. Regenerates the bundled model-capabilities snapshot from models.dev and the model-fallback snapshot to match the new source output.
119 lines
3.7 KiB
TypeScript
119 lines
3.7 KiB
TypeScript
import { describe, test, expect } from "bun:test"
|
|
import { buildPlanDemoteConfig } from "./plan-model-inheritance"
|
|
|
|
describe("buildPlanDemoteConfig", () => {
|
|
test("returns only mode when prometheus and plan override are both undefined", () => {
|
|
//#given
|
|
const prometheusConfig = undefined
|
|
const planOverride = undefined
|
|
|
|
//#when
|
|
const result = buildPlanDemoteConfig(prometheusConfig, planOverride)
|
|
|
|
//#then
|
|
expect(result).toEqual({ mode: "subagent", hidden: true })
|
|
})
|
|
|
|
test("extracts all model settings from prometheus config", () => {
|
|
//#given
|
|
const prometheusConfig = {
|
|
name: "prometheus",
|
|
model: "anthropic/claude-opus-4-7",
|
|
variant: "max",
|
|
mode: "primary",
|
|
prompt: "You are Prometheus...",
|
|
permission: { edit: "allow" },
|
|
description: "Plan agent (Prometheus)",
|
|
color: "#FF5722",
|
|
temperature: 0.1,
|
|
top_p: 0.95,
|
|
maxTokens: 32000,
|
|
thinking: { type: "enabled", budgetTokens: 10000 },
|
|
reasoningEffort: "high",
|
|
textVerbosity: "medium",
|
|
providerOptions: { key: "value" },
|
|
}
|
|
|
|
//#when
|
|
const result = buildPlanDemoteConfig(prometheusConfig, undefined)
|
|
|
|
//#then - picks model settings, NOT prompt/permission/description/color/name/mode
|
|
expect(result.mode).toBe("subagent")
|
|
expect(result.model).toBe("anthropic/claude-opus-4-7")
|
|
expect(result.variant).toBe("max")
|
|
expect(result.temperature).toBe(0.1)
|
|
expect(result.top_p).toBe(0.95)
|
|
expect(result.maxTokens).toBe(32000)
|
|
expect(result.thinking).toEqual({ type: "enabled", budgetTokens: 10000 })
|
|
expect(result.reasoningEffort).toBe("high")
|
|
expect(result.textVerbosity).toBe("medium")
|
|
expect(result.providerOptions).toEqual({ key: "value" })
|
|
expect(result.prompt).toBeUndefined()
|
|
expect(result.permission).toBeUndefined()
|
|
expect(result.description).toBeUndefined()
|
|
expect(result.color).toBeUndefined()
|
|
expect(result.name).toBeUndefined()
|
|
})
|
|
|
|
test("plan override takes priority over prometheus for all model settings", () => {
|
|
//#given
|
|
const prometheusConfig = {
|
|
model: "anthropic/claude-opus-4-7",
|
|
variant: "max",
|
|
temperature: 0.1,
|
|
reasoningEffort: "high",
|
|
}
|
|
const planOverride = {
|
|
model: "openai/gpt-5.4",
|
|
variant: "high",
|
|
temperature: 0.5,
|
|
reasoningEffort: "low",
|
|
}
|
|
|
|
//#when
|
|
const result = buildPlanDemoteConfig(prometheusConfig, planOverride)
|
|
|
|
//#then
|
|
expect(result.model).toBe("openai/gpt-5.4")
|
|
expect(result.variant).toBe("high")
|
|
expect(result.temperature).toBe(0.5)
|
|
expect(result.reasoningEffort).toBe("low")
|
|
})
|
|
|
|
test("falls back to prometheus when plan override has partial settings", () => {
|
|
//#given
|
|
const prometheusConfig = {
|
|
model: "anthropic/claude-opus-4-7",
|
|
variant: "max",
|
|
temperature: 0.1,
|
|
reasoningEffort: "high",
|
|
}
|
|
const planOverride = {
|
|
model: "openai/gpt-5.4",
|
|
}
|
|
|
|
//#when
|
|
const result = buildPlanDemoteConfig(prometheusConfig, planOverride)
|
|
|
|
//#then - plan model wins, rest inherits from prometheus
|
|
expect(result.model).toBe("openai/gpt-5.4")
|
|
expect(result.variant).toBe("max")
|
|
expect(result.temperature).toBe(0.1)
|
|
expect(result.reasoningEffort).toBe("high")
|
|
})
|
|
|
|
test("skips undefined values from both sources", () => {
|
|
//#given
|
|
const prometheusConfig = {
|
|
model: "anthropic/claude-opus-4-7",
|
|
}
|
|
|
|
//#when
|
|
const result = buildPlanDemoteConfig(prometheusConfig, undefined)
|
|
|
|
//#then
|
|
expect(result).toEqual({ mode: "subagent", hidden: true, model: "anthropic/claude-opus-4-7" })
|
|
expect(Object.keys(result)).toEqual(["mode", "hidden", "model"])
|
|
})
|
|
})
|