|
| 1 | +import z from 'zod'; |
| 2 | +import { ratingSchema } from '../ratings/rating-types.js'; |
| 3 | +import { MultiStepPrompt } from './multi-step-prompt.js'; |
| 4 | +import { mcpServerOptionsSchema } from '../codegen/llm-runner.js'; |
| 5 | +import { getPossiblePackageManagers } from './environment-config.js'; |
| 6 | + |
| 7 | +export const baseEnvironmentConfigSchema = z.strictObject({ |
| 8 | + /** Display name for the environment. */ |
| 9 | + displayName: z.string(), |
| 10 | + /** |
| 11 | + * Optional unique ID for the environment. |
| 12 | + * If one isn't provided, it will be computed from the `displayName`. |
| 13 | + */ |
| 14 | + id: z.string().optional(), |
| 15 | + /** ID of the client-side framework used within the environment. */ |
| 16 | + clientSideFramework: z.string(), |
| 17 | + /** Ratings to run when evaluating the environment. */ |
| 18 | + ratings: z.array(ratingSchema), |
| 19 | + /** Path to the prompt used by the LLM for generating files. */ |
| 20 | + generationSystemPrompt: z.string(), |
| 21 | + /** |
| 22 | + * Path to the prompt used by the LLM for repairing builds or failures. |
| 23 | + * |
| 24 | + * If unset or `null`, the eval tool will use its default repair instructions. |
| 25 | + */ |
| 26 | + repairSystemPrompt: z.union([z.string(), z.null()]).optional(), |
| 27 | + /** |
| 28 | + * Path to the prompt used by the LLM for editing. |
| 29 | + * |
| 30 | + * Prompts running after the initial generation are considered as editing (e.g. multi step prompts). |
| 31 | + * If `null`, the eval tool will use the generation prompt for edits. |
| 32 | + */ |
| 33 | + editingSystemPrompt: z.union([z.string(), z.null()]).optional(), |
| 34 | + /** Prompts that should be sent to the LLM and written into the output. */ |
| 35 | + executablePrompts: z.array( |
| 36 | + z.union([ |
| 37 | + z.string(), |
| 38 | + z.strictObject({ |
| 39 | + path: z.string(), |
| 40 | + name: z.string().optional(), |
| 41 | + ratings: z.array(ratingSchema).optional(), |
| 42 | + }), |
| 43 | + z.custom<MultiStepPrompt>((data) => data instanceof MultiStepPrompt), |
| 44 | + ]) |
| 45 | + ), |
| 46 | + /** |
| 47 | + * ID of the fullstack framework used within the environment. |
| 48 | + * If omitted, it will default to the `clientSideFramework`. |
| 49 | + */ |
| 50 | + fullStackFramework: z.string().optional(), |
| 51 | + /** Path to the prompt to use when rating code. */ |
| 52 | + codeRatingPrompt: z.string().optional(), |
| 53 | + /** When enabled, the system prompts for this environment won't be included in the report. */ |
| 54 | + classifyPrompts: z.boolean().optional(), |
| 55 | +}); |
0 commit comments