refactor(config): share agent model schema
This commit is contained in:
parent
9143f33a80
commit
6e36d956d6
@ -1,6 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import {
|
||||
HeartbeatSchema,
|
||||
AgentModelSchema,
|
||||
MemorySearchSchema,
|
||||
SandboxBrowserSchema,
|
||||
SandboxDockerSchema,
|
||||
@ -160,17 +161,7 @@ export const AgentDefaultsSchema = z
|
||||
"Maximum number of active children a single agent session can spawn (default: 5).",
|
||||
),
|
||||
archiveAfterMinutes: z.number().int().positive().optional(),
|
||||
model: z
|
||||
.union([
|
||||
z.string(),
|
||||
z
|
||||
.object({
|
||||
primary: z.string().optional(),
|
||||
fallbacks: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict(),
|
||||
])
|
||||
.optional(),
|
||||
model: AgentModelSchema.optional(),
|
||||
thinking: z.string().optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
11
src/config/zod-schema.agent-model.ts
Normal file
11
src/config/zod-schema.agent-model.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const AgentModelSchema = z.union([
|
||||
z.string(),
|
||||
z
|
||||
.object({
|
||||
primary: z.string().optional(),
|
||||
fallbacks: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict(),
|
||||
]);
|
||||
@ -1,5 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import { parseDurationMs } from "../cli/parse-duration.js";
|
||||
import { AgentModelSchema } from "./zod-schema.agent-model.js";
|
||||
import {
|
||||
GroupChatSchema,
|
||||
HumanDelaySchema,
|
||||
@ -450,15 +451,7 @@ export const MemorySearchSchema = z
|
||||
})
|
||||
.strict()
|
||||
.optional();
|
||||
export const AgentModelSchema = z.union([
|
||||
z.string(),
|
||||
z
|
||||
.object({
|
||||
primary: z.string().optional(),
|
||||
fallbacks: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict(),
|
||||
]);
|
||||
export { AgentModelSchema };
|
||||
export const AgentEntrySchema = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user