feat(config): add model variant support
Allow optional model variant config for agents and categories. Propagate category variants into task model payloads so category-driven runs inherit provider-specific variants. Closes: #647
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { AgentOverrideConfigSchema, BuiltinCategoryNameSchema, OhMyOpenCodeConfigSchema } from "./schema"
|
||||
import { AgentOverrideConfigSchema, BuiltinCategoryNameSchema, CategoryConfigSchema, OhMyOpenCodeConfigSchema } from "./schema"
|
||||
|
||||
describe("disabled_mcps schema", () => {
|
||||
test("should accept built-in MCP names", () => {
|
||||
@@ -174,6 +174,33 @@ describe("AgentOverrideConfigSchema", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("variant field", () => {
|
||||
test("accepts variant as optional string", () => {
|
||||
// #given
|
||||
const config = { variant: "high" }
|
||||
|
||||
// #when
|
||||
const result = AgentOverrideConfigSchema.safeParse(config)
|
||||
|
||||
// #then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.variant).toBe("high")
|
||||
}
|
||||
})
|
||||
|
||||
test("rejects non-string variant", () => {
|
||||
// #given
|
||||
const config = { variant: 123 }
|
||||
|
||||
// #when
|
||||
const result = AgentOverrideConfigSchema.safeParse(config)
|
||||
|
||||
// #then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("skills field", () => {
|
||||
test("accepts skills as optional string array", () => {
|
||||
// #given
|
||||
@@ -303,6 +330,33 @@ describe("AgentOverrideConfigSchema", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("CategoryConfigSchema", () => {
|
||||
test("accepts variant as optional string", () => {
|
||||
// #given
|
||||
const config = { model: "openai/gpt-5.2", variant: "xhigh" }
|
||||
|
||||
// #when
|
||||
const result = CategoryConfigSchema.safeParse(config)
|
||||
|
||||
// #then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.variant).toBe("xhigh")
|
||||
}
|
||||
})
|
||||
|
||||
test("rejects non-string variant", () => {
|
||||
// #given
|
||||
const config = { model: "openai/gpt-5.2", variant: 123 }
|
||||
|
||||
// #when
|
||||
const result = CategoryConfigSchema.safeParse(config)
|
||||
|
||||
// #then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("BuiltinCategoryNameSchema", () => {
|
||||
test("accepts all builtin category names", () => {
|
||||
// #given
|
||||
|
||||
@@ -97,6 +97,7 @@ export const BuiltinCommandNameSchema = z.enum([
|
||||
export const AgentOverrideConfigSchema = z.object({
|
||||
/** @deprecated Use `category` instead. Model is inherited from category defaults. */
|
||||
model: z.string().optional(),
|
||||
variant: z.string().optional(),
|
||||
/** Category name to inherit model and other settings from CategoryConfig */
|
||||
category: z.string().optional(),
|
||||
/** Skill names to inject into agent prompt */
|
||||
@@ -153,6 +154,7 @@ export const SisyphusAgentConfigSchema = z.object({
|
||||
|
||||
export const CategoryConfigSchema = z.object({
|
||||
model: z.string(),
|
||||
variant: z.string().optional(),
|
||||
temperature: z.number().min(0).max(2).optional(),
|
||||
top_p: z.number().min(0).max(1).optional(),
|
||||
maxTokens: z.number().optional(),
|
||||
|
||||
Reference in New Issue
Block a user