This commit is contained in:
Jackal Xin 2026-03-15 18:44:21 -04:00 committed by GitHub
commit ca83854290
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import { describe, expect, it } from "vitest";
import { AgentEntrySchema } from "./zod-schema.agent-runtime.js";
describe("AgentEntrySchema params field", () => {
it("accepts agents.list[].params with cacheRetention", () => {
const result = AgentEntrySchema.safeParse({
id: "main",
params: { cacheRetention: "none" },
});
expect(result.success).toBe(true);
if (result.success) {
expect(result.data.params).toEqual({ cacheRetention: "none" });
}
});
it("accepts agents.list[].params with arbitrary model overrides", () => {
const result = AgentEntrySchema.safeParse({
id: "main",
params: { temperature: 0.7, maxTokens: 4096 },
});
expect(result.success).toBe(true);
if (result.success) {
expect(result.data.params).toEqual({ temperature: 0.7, maxTokens: 4096 });
}
});
it("accepts agents.list[] without params (optional)", () => {
const result = AgentEntrySchema.safeParse({
id: "main",
});
expect(result.success).toBe(true);
if (result.success) {
expect(result.data.params).toBeUndefined();
}
});
});

View File

@ -751,6 +751,8 @@ export const AgentEntrySchema = z
heartbeat: HeartbeatSchema,
identity: IdentitySchema,
groupChat: GroupChatSchema,
/** Per-agent model params (e.g. cacheRetention, temperature). Merged on top of agents.defaults.models[...].params. */
params: z.record(z.string(), z.unknown()).optional(),
subagents: z
.object({
allowAgents: z.array(z.string()).optional(),