@wix/evalforge-types 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,49 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Assertion types:
4
- * - skill_was_called: Checks if a specific skill was invoked (deterministic)
5
- * - build_passed: Runs a command and checks exit code (deterministic)
6
- * - llm_judge: LLM evaluates output with a prompt (LLM-based)
7
- * - custom: User-defined LLM-based assertion (uses LlmJudgeEvaluator)
4
+ * - skill_was_called: Checks if a specific skill was invoked (deterministic, system-level)
5
+ * - build_passed: Runs a command and checks exit code (deterministic, system-level)
6
+ * - llm_judge: LLM evaluates output with a prompt (LLM-based, user-created)
8
7
  */
9
8
  export declare const AssertionTypeSchema: z.ZodEnum<{
10
- custom: "custom";
11
9
  skill_was_called: "skill_was_called";
12
10
  build_passed: "build_passed";
13
11
  llm_judge: "llm_judge";
14
12
  }>;
13
+ /**
14
+ * Parameter types supported in assertion parameters.
15
+ */
16
+ export declare const AssertionParameterTypeSchema: z.ZodEnum<{
17
+ string: "string";
18
+ number: "number";
19
+ boolean: "boolean";
20
+ }>;
21
+ export type AssertionParameterType = z.infer<typeof AssertionParameterTypeSchema>;
22
+ /**
23
+ * Schema for defining assertion parameters.
24
+ * Parameters can be required or optional, with optional default values.
25
+ */
26
+ export declare const AssertionParameterSchema: z.ZodObject<{
27
+ name: z.ZodString;
28
+ label: z.ZodString;
29
+ type: z.ZodEnum<{
30
+ string: "string";
31
+ number: "number";
32
+ boolean: "boolean";
33
+ }>;
34
+ required: z.ZodBoolean;
35
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
36
+ }, z.core.$strip>;
37
+ export type AssertionParameter = z.infer<typeof AssertionParameterSchema>;
38
+ /**
39
+ * Schema for scenario-assertion link with parameter values.
40
+ * Used when linking assertions to scenarios with specific parameter values.
41
+ */
42
+ export declare const ScenarioAssertionLinkSchema: z.ZodObject<{
43
+ assertionId: z.ZodString;
44
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
45
+ }, z.core.$strip>;
46
+ export type ScenarioAssertionLink = z.infer<typeof ScenarioAssertionLinkSchema>;
15
47
  export type AssertionType = z.infer<typeof AssertionTypeSchema>;
16
48
  /**
17
49
  * Configuration for skill_was_called assertion type.
@@ -22,15 +54,18 @@ export declare const SkillWasCalledConfigSchema: z.ZodObject<{
22
54
  export type SkillWasCalledConfig = z.infer<typeof SkillWasCalledConfigSchema>;
23
55
  /**
24
56
  * Configuration for build_passed assertion type.
57
+ * Uses strictObject to reject objects with unknown keys (prevents matching LlmJudge configs).
25
58
  */
26
59
  export declare const BuildPassedConfigSchema: z.ZodObject<{
60
+ /** Command to run (default: "yarn build") */
27
61
  command: z.ZodOptional<z.ZodString>;
62
+ /** Expected exit code (default: 0) */
28
63
  expectedExitCode: z.ZodOptional<z.ZodNumber>;
29
- }, z.core.$strip>;
64
+ }, z.core.$strict>;
30
65
  export type BuildPassedConfig = z.infer<typeof BuildPassedConfigSchema>;
31
66
  /**
32
- * Configuration for llm_judge and custom assertion types.
33
- * Custom assertions use the same LLM-based evaluation as llm_judge.
67
+ * Configuration for llm_judge assertion type.
68
+ * User-created assertions with customizable parameters.
34
69
  */
35
70
  export declare const LlmJudgeConfigSchema: z.ZodObject<{
36
71
  prompt: z.ZodString;
@@ -39,25 +74,51 @@ export declare const LlmJudgeConfigSchema: z.ZodObject<{
39
74
  model: z.ZodOptional<z.ZodString>;
40
75
  maxTokens: z.ZodOptional<z.ZodNumber>;
41
76
  temperature: z.ZodOptional<z.ZodNumber>;
77
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
+ name: z.ZodString;
79
+ label: z.ZodString;
80
+ type: z.ZodEnum<{
81
+ string: "string";
82
+ number: "number";
83
+ boolean: "boolean";
84
+ }>;
85
+ required: z.ZodBoolean;
86
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
87
+ }, z.core.$strip>>>;
42
88
  }, z.core.$strip>;
43
89
  export type LlmJudgeConfig = z.infer<typeof LlmJudgeConfigSchema>;
44
90
  /**
45
91
  * Union of all assertion config types.
46
- * The actual config shape depends on the assertion type.
92
+ * Order matters: schemas with required fields first, then optional-only schemas.
93
+ * This ensures LlmJudge (requires prompt) and SkillWasCalled (requires skillName)
94
+ * are matched before BuildPassed (all optional) or empty object.
47
95
  */
48
96
  export declare const AssertionConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
49
- skillName: z.ZodString;
50
- }, z.core.$strip>, z.ZodObject<{
51
- command: z.ZodOptional<z.ZodString>;
52
- expectedExitCode: z.ZodOptional<z.ZodNumber>;
53
- }, z.core.$strip>, z.ZodObject<{
54
97
  prompt: z.ZodString;
55
98
  systemPrompt: z.ZodOptional<z.ZodString>;
56
99
  minScore: z.ZodOptional<z.ZodNumber>;
57
100
  model: z.ZodOptional<z.ZodString>;
58
101
  maxTokens: z.ZodOptional<z.ZodNumber>;
59
102
  temperature: z.ZodOptional<z.ZodNumber>;
60
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>;
103
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
+ name: z.ZodString;
105
+ label: z.ZodString;
106
+ type: z.ZodEnum<{
107
+ string: "string";
108
+ number: "number";
109
+ boolean: "boolean";
110
+ }>;
111
+ required: z.ZodBoolean;
112
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
113
+ }, z.core.$strip>>>;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ skillName: z.ZodString;
116
+ }, z.core.$strip>, z.ZodObject<{
117
+ /** Command to run (default: "yarn build") */
118
+ command: z.ZodOptional<z.ZodString>;
119
+ /** Expected exit code (default: 0) */
120
+ expectedExitCode: z.ZodOptional<z.ZodNumber>;
121
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strip>]>;
61
122
  export type AssertionConfig = z.infer<typeof AssertionConfigSchema>;
62
123
  /**
63
124
  * Custom Assertion entity - stored in the database.
@@ -72,24 +133,36 @@ export declare const CustomAssertionSchema: z.ZodObject<{
72
133
  deleted: z.ZodOptional<z.ZodBoolean>;
73
134
  projectId: z.ZodString;
74
135
  type: z.ZodEnum<{
75
- custom: "custom";
76
136
  skill_was_called: "skill_was_called";
77
137
  build_passed: "build_passed";
78
138
  llm_judge: "llm_judge";
79
139
  }>;
80
140
  config: z.ZodUnion<readonly [z.ZodObject<{
81
- skillName: z.ZodString;
82
- }, z.core.$strip>, z.ZodObject<{
83
- command: z.ZodOptional<z.ZodString>;
84
- expectedExitCode: z.ZodOptional<z.ZodNumber>;
85
- }, z.core.$strip>, z.ZodObject<{
86
141
  prompt: z.ZodString;
87
142
  systemPrompt: z.ZodOptional<z.ZodString>;
88
143
  minScore: z.ZodOptional<z.ZodNumber>;
89
144
  model: z.ZodOptional<z.ZodString>;
90
145
  maxTokens: z.ZodOptional<z.ZodNumber>;
91
146
  temperature: z.ZodOptional<z.ZodNumber>;
92
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>;
147
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
148
+ name: z.ZodString;
149
+ label: z.ZodString;
150
+ type: z.ZodEnum<{
151
+ string: "string";
152
+ number: "number";
153
+ boolean: "boolean";
154
+ }>;
155
+ required: z.ZodBoolean;
156
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
157
+ }, z.core.$strip>>>;
158
+ }, z.core.$strip>, z.ZodObject<{
159
+ skillName: z.ZodString;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ /** Command to run (default: "yarn build") */
162
+ command: z.ZodOptional<z.ZodString>;
163
+ /** Expected exit code (default: 0) */
164
+ expectedExitCode: z.ZodOptional<z.ZodNumber>;
165
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strip>]>;
93
166
  }, z.core.$strip>;
94
167
  export type CustomAssertion = z.infer<typeof CustomAssertionSchema>;
95
168
  /**
@@ -97,7 +170,6 @@ export type CustomAssertion = z.infer<typeof CustomAssertionSchema>;
97
170
  */
98
171
  export declare const CreateCustomAssertionInputSchema: z.ZodObject<{
99
172
  type: z.ZodEnum<{
100
- custom: "custom";
101
173
  skill_was_called: "skill_was_called";
102
174
  build_passed: "build_passed";
103
175
  llm_judge: "llm_judge";
@@ -106,18 +178,31 @@ export declare const CreateCustomAssertionInputSchema: z.ZodObject<{
106
178
  description: z.ZodString;
107
179
  projectId: z.ZodString;
108
180
  config: z.ZodUnion<readonly [z.ZodObject<{
109
- skillName: z.ZodString;
110
- }, z.core.$strip>, z.ZodObject<{
111
- command: z.ZodOptional<z.ZodString>;
112
- expectedExitCode: z.ZodOptional<z.ZodNumber>;
113
- }, z.core.$strip>, z.ZodObject<{
114
181
  prompt: z.ZodString;
115
182
  systemPrompt: z.ZodOptional<z.ZodString>;
116
183
  minScore: z.ZodOptional<z.ZodNumber>;
117
184
  model: z.ZodOptional<z.ZodString>;
118
185
  maxTokens: z.ZodOptional<z.ZodNumber>;
119
186
  temperature: z.ZodOptional<z.ZodNumber>;
120
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>;
187
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
+ name: z.ZodString;
189
+ label: z.ZodString;
190
+ type: z.ZodEnum<{
191
+ string: "string";
192
+ number: "number";
193
+ boolean: "boolean";
194
+ }>;
195
+ required: z.ZodBoolean;
196
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
197
+ }, z.core.$strip>>>;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ skillName: z.ZodString;
200
+ }, z.core.$strip>, z.ZodObject<{
201
+ /** Command to run (default: "yarn build") */
202
+ command: z.ZodOptional<z.ZodString>;
203
+ /** Expected exit code (default: 0) */
204
+ expectedExitCode: z.ZodOptional<z.ZodNumber>;
205
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strip>]>;
121
206
  }, z.core.$strip>;
122
207
  export type CreateCustomAssertionInput = z.infer<typeof CreateCustomAssertionInputSchema>;
123
208
  /**
@@ -125,7 +210,6 @@ export type CreateCustomAssertionInput = z.infer<typeof CreateCustomAssertionInp
125
210
  */
126
211
  export declare const UpdateCustomAssertionInputSchema: z.ZodObject<{
127
212
  type: z.ZodOptional<z.ZodEnum<{
128
- custom: "custom";
129
213
  skill_was_called: "skill_was_called";
130
214
  build_passed: "build_passed";
131
215
  llm_judge: "llm_judge";
@@ -134,18 +218,31 @@ export declare const UpdateCustomAssertionInputSchema: z.ZodObject<{
134
218
  description: z.ZodOptional<z.ZodString>;
135
219
  projectId: z.ZodOptional<z.ZodString>;
136
220
  config: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
137
- skillName: z.ZodString;
138
- }, z.core.$strip>, z.ZodObject<{
139
- command: z.ZodOptional<z.ZodString>;
140
- expectedExitCode: z.ZodOptional<z.ZodNumber>;
141
- }, z.core.$strip>, z.ZodObject<{
142
221
  prompt: z.ZodString;
143
222
  systemPrompt: z.ZodOptional<z.ZodString>;
144
223
  minScore: z.ZodOptional<z.ZodNumber>;
145
224
  model: z.ZodOptional<z.ZodString>;
146
225
  maxTokens: z.ZodOptional<z.ZodNumber>;
147
226
  temperature: z.ZodOptional<z.ZodNumber>;
148
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
227
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
228
+ name: z.ZodString;
229
+ label: z.ZodString;
230
+ type: z.ZodEnum<{
231
+ string: "string";
232
+ number: "number";
233
+ boolean: "boolean";
234
+ }>;
235
+ required: z.ZodBoolean;
236
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
237
+ }, z.core.$strip>>>;
238
+ }, z.core.$strip>, z.ZodObject<{
239
+ skillName: z.ZodString;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ /** Command to run (default: "yarn build") */
242
+ command: z.ZodOptional<z.ZodString>;
243
+ /** Expected exit code (default: 0) */
244
+ expectedExitCode: z.ZodOptional<z.ZodNumber>;
245
+ }, z.core.$strict>, z.ZodObject<{}, z.core.$strip>]>>;
149
246
  }, z.core.$strip>;
150
247
  export type UpdateCustomAssertionInput = z.infer<typeof UpdateCustomAssertionInputSchema>;
151
248
  /**
@@ -162,6 +259,6 @@ export declare function getSkillWasCalledConfig(assertion: CustomAssertion): Ski
162
259
  */
163
260
  export declare function getBuildPassedConfig(assertion: CustomAssertion): BuildPassedConfig | null;
164
261
  /**
165
- * Get typed config for llm_judge or custom assertion.
262
+ * Get typed config for llm_judge assertion.
166
263
  */
167
264
  export declare function getLlmJudgeConfig(assertion: CustomAssertion): LlmJudgeConfig | null;
@@ -1,4 +1,5 @@
1
1
  /**
2
- * Assertion types - custom assertions stored in database.
2
+ * Assertion types - custom assertions stored in database and system assertions.
3
3
  */
4
4
  export * from './assertion.js';
5
+ export * from './system-assertions.js';
@@ -0,0 +1,42 @@
1
+ import type { AssertionParameter, AssertionType } from './assertion.js';
2
+ /**
3
+ * System assertion definition - built-in assertions available to all projects.
4
+ * These are not stored in the database but defined in code.
5
+ */
6
+ export interface SystemAssertion {
7
+ /** Unique ID prefixed with 'system:' */
8
+ id: string;
9
+ /** Display name */
10
+ name: string;
11
+ /** Description of what the assertion checks */
12
+ description: string;
13
+ /** Assertion type */
14
+ type: AssertionType;
15
+ /** Parameters that can be configured per-scenario */
16
+ parameters: AssertionParameter[];
17
+ }
18
+ /**
19
+ * System assertion IDs - prefixed with 'system:' to distinguish from custom assertions.
20
+ */
21
+ export declare const SYSTEM_ASSERTION_IDS: {
22
+ readonly SKILL_WAS_CALLED: "system:skill_was_called";
23
+ readonly BUILD_PASSED: "system:build_passed";
24
+ };
25
+ export type SystemAssertionId = (typeof SYSTEM_ASSERTION_IDS)[keyof typeof SYSTEM_ASSERTION_IDS];
26
+ /**
27
+ * Check if an assertion ID is a system assertion.
28
+ */
29
+ export declare function isSystemAssertionId(id: string): id is SystemAssertionId;
30
+ /**
31
+ * Built-in system assertions.
32
+ * These are available to all projects without needing to create them.
33
+ */
34
+ export declare const SYSTEM_ASSERTIONS: Record<SystemAssertionId, SystemAssertion>;
35
+ /**
36
+ * Get all system assertions as an array.
37
+ */
38
+ export declare function getSystemAssertions(): SystemAssertion[];
39
+ /**
40
+ * Get a system assertion by ID.
41
+ */
42
+ export declare function getSystemAssertion(id: SystemAssertionId): SystemAssertion | undefined;
@@ -42,6 +42,10 @@ export declare const TestScenarioSchema: z.ZodObject<{
42
42
  temperature: z.ZodOptional<z.ZodNumber>;
43
43
  }, z.core.$strip>]>>>;
44
44
  assertionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ assertionLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ assertionId: z.ZodString;
47
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
48
+ }, z.core.$strip>>>;
45
49
  }, z.core.$strip>;
46
50
  export type TestScenario = z.infer<typeof TestScenarioSchema>;
47
51
  /**
@@ -70,6 +74,10 @@ export declare const CreateTestScenarioInputSchema: z.ZodObject<{
70
74
  temperature: z.ZodOptional<z.ZodNumber>;
71
75
  }, z.core.$strip>]>>>;
72
76
  assertionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
+ assertionLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
+ assertionId: z.ZodString;
79
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
80
+ }, z.core.$strip>>>;
73
81
  }, z.core.$strip>;
74
82
  export type CreateTestScenarioInput = z.infer<typeof CreateTestScenarioInputSchema>;
75
83
  /**
@@ -98,5 +106,9 @@ export declare const UpdateTestScenarioInputSchema: z.ZodObject<{
98
106
  temperature: z.ZodOptional<z.ZodNumber>;
99
107
  }, z.core.$strip>]>>>>;
100
108
  assertionIds: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
109
+ assertionLinks: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
110
+ assertionId: z.ZodString;
111
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
112
+ }, z.core.$strip>>>>;
101
113
  }, z.core.$strip>;
102
114
  export type UpdateTestScenarioInput = z.infer<typeof UpdateTestScenarioInputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/evalforge-types",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Unified types for EvalForge agent evaluation system",
5
5
  "files": [
6
6
  "build"
@@ -46,5 +46,5 @@
46
46
  "artifactId": "evalforge-types"
47
47
  }
48
48
  },
49
- "falconPackageHash": "998d2b657ab6cce997be349567ed0aeec0dce0593ef672dcfcd6805d"
49
+ "falconPackageHash": "99055e21a0b36ab3ea066f8ffe6d6f2e0c8b2458f81f89cec56968a6"
50
50
  }