@vitest-evals/core 0.12.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.
- package/LICENSE +201 -0
- package/README.md +36 -0
- package/dist/index.d.mts +895 -0
- package/dist/index.d.ts +895 -0
- package/dist/index.js +557 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +489 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node.d.mts +33 -0
- package/dist/node.d.ts +33 -0
- package/dist/node.js +628 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +598 -0
- package/dist/node.mjs.map +1 -0
- package/dist/workspace-BNgjyW7W.d.mts +489 -0
- package/dist/workspace-BNgjyW7W.d.ts +489 -0
- package/package.json +46 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
import { J as JsonValue } from './workspace-BNgjyW7W.mjs';
|
|
2
|
+
export { C as CollectReportWorkspaceOptions, a as JsonObjectSchema, d as JsonPrimitive, b as JsonPrimitiveSchema, c as JsonValueSchema, R as REPORT_WORKSPACE_SCHEMA_VERSION, t as ReportCase, q as ReportCaseSchema, u as ReportRun, r as ReportRunSchema, v as ReportWorkspace, w as ReportWorkspaceInput, s as ReportWorkspaceSchema, i as VitestJsonAssertion, V as VitestJsonAssertionSchema, j as VitestJsonFile, e as VitestJsonFileSchema, k as VitestJsonLocation, f as VitestJsonLocationSchema, l as VitestJsonReport, g as VitestJsonReportSchema, m as VitestJsonStatus, h as VitestJsonStatusSchema, n as collectReportWorkspace, o as parseReportWorkspace, p as parseVitestJsonReport } from './workspace-BNgjyW7W.mjs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/** Well-known OpenTelemetry GenAI operation names. */
|
|
6
|
+
type GenAiOperationName = "chat" | "create_agent" | "embeddings" | "execute_tool" | "generate_content" | "invoke_agent" | "invoke_workflow" | "retrieval" | "text_completion" | (string & {});
|
|
7
|
+
/** Well-known OpenTelemetry GenAI output content types. */
|
|
8
|
+
type GenAiOutputType = "image" | "json" | "speech" | "text" | (string & {});
|
|
9
|
+
/** Well-known OpenTelemetry GenAI provider names. */
|
|
10
|
+
type GenAiProviderName = "anthropic" | "aws.bedrock" | "azure.ai.inference" | "azure.ai.openai" | "cohere" | "deepseek" | "gcp.gemini" | "gcp.gen_ai" | "gcp.vertex_ai" | "groq" | "ibm.watsonx.ai" | "mistral_ai" | "openai" | "perplexity" | "x_ai" | (string & {});
|
|
11
|
+
/** Well-known OpenTelemetry GenAI token types. */
|
|
12
|
+
type GenAiTokenType = "input" | "output" | (string & {});
|
|
13
|
+
/** Well-known OpenTelemetry GenAI tool execution types. */
|
|
14
|
+
type GenAiToolType = "datastore" | "extension" | "function" | (string & {});
|
|
15
|
+
/** Typed subset of OpenTelemetry GenAI semantic attributes. */
|
|
16
|
+
type GenAiSemanticAttributes = {
|
|
17
|
+
"gen_ai.agent.description"?: string;
|
|
18
|
+
"gen_ai.agent.id"?: string;
|
|
19
|
+
"gen_ai.agent.name"?: string;
|
|
20
|
+
"gen_ai.agent.version"?: string;
|
|
21
|
+
"gen_ai.conversation.id"?: string;
|
|
22
|
+
"gen_ai.data_source.id"?: string;
|
|
23
|
+
"gen_ai.embeddings.dimension.count"?: number;
|
|
24
|
+
"gen_ai.evaluation.explanation"?: string;
|
|
25
|
+
"gen_ai.evaluation.name"?: string;
|
|
26
|
+
"gen_ai.evaluation.score.label"?: string;
|
|
27
|
+
"gen_ai.evaluation.score.value"?: number;
|
|
28
|
+
"gen_ai.input.messages"?: JsonValue;
|
|
29
|
+
"gen_ai.operation.name"?: GenAiOperationName;
|
|
30
|
+
"gen_ai.output.messages"?: JsonValue;
|
|
31
|
+
"gen_ai.output.type"?: GenAiOutputType;
|
|
32
|
+
"gen_ai.prompt.name"?: string;
|
|
33
|
+
"gen_ai.provider.name"?: GenAiProviderName;
|
|
34
|
+
"gen_ai.request.choice.count"?: number;
|
|
35
|
+
"gen_ai.request.encoding_formats"?: string[];
|
|
36
|
+
"gen_ai.request.frequency_penalty"?: number;
|
|
37
|
+
"gen_ai.request.max_tokens"?: number;
|
|
38
|
+
"gen_ai.request.model"?: string;
|
|
39
|
+
"gen_ai.request.presence_penalty"?: number;
|
|
40
|
+
"gen_ai.request.seed"?: number;
|
|
41
|
+
"gen_ai.request.stop_sequences"?: string[];
|
|
42
|
+
"gen_ai.request.stream"?: boolean;
|
|
43
|
+
"gen_ai.request.temperature"?: number;
|
|
44
|
+
"gen_ai.request.top_k"?: number;
|
|
45
|
+
"gen_ai.request.top_p"?: number;
|
|
46
|
+
"gen_ai.response.finish_reasons"?: string[];
|
|
47
|
+
"gen_ai.response.id"?: string;
|
|
48
|
+
"gen_ai.response.model"?: string;
|
|
49
|
+
"gen_ai.response.time_to_first_chunk"?: number;
|
|
50
|
+
"gen_ai.retrieval.documents"?: JsonValue;
|
|
51
|
+
"gen_ai.retrieval.query.text"?: string;
|
|
52
|
+
"gen_ai.system_instructions"?: JsonValue;
|
|
53
|
+
"gen_ai.token.type"?: GenAiTokenType;
|
|
54
|
+
"gen_ai.tool.call.arguments"?: JsonValue;
|
|
55
|
+
"gen_ai.tool.call.id"?: string;
|
|
56
|
+
"gen_ai.tool.call.result"?: JsonValue;
|
|
57
|
+
"gen_ai.tool.definitions"?: JsonValue;
|
|
58
|
+
"gen_ai.tool.description"?: string;
|
|
59
|
+
"gen_ai.tool.name"?: string;
|
|
60
|
+
"gen_ai.tool.type"?: GenAiToolType;
|
|
61
|
+
"gen_ai.usage.cache_creation.input_tokens"?: number;
|
|
62
|
+
"gen_ai.usage.cache_read.input_tokens"?: number;
|
|
63
|
+
"gen_ai.usage.input_tokens"?: number;
|
|
64
|
+
"gen_ai.usage.output_tokens"?: number;
|
|
65
|
+
"gen_ai.usage.reasoning.output_tokens"?: number;
|
|
66
|
+
"gen_ai.workflow.name"?: string;
|
|
67
|
+
};
|
|
68
|
+
/** Attribute keys defined by the OpenTelemetry GenAI semantic conventions. */
|
|
69
|
+
type GenAiSemanticAttributeKey = keyof GenAiSemanticAttributes;
|
|
70
|
+
/** Typed OpenTelemetry semantic attributes accepted on normalized spans. */
|
|
71
|
+
type OpenTelemetrySemanticAttributes = GenAiSemanticAttributes & {
|
|
72
|
+
"error.type"?: string;
|
|
73
|
+
"server.address"?: string;
|
|
74
|
+
"server.port"?: number;
|
|
75
|
+
};
|
|
76
|
+
/** Known OpenTelemetry semantic attribute keys accepted on normalized spans. */
|
|
77
|
+
type OpenTelemetrySemanticAttributeKey = keyof OpenTelemetrySemanticAttributes;
|
|
78
|
+
/** Attribute keys accepted on normalized spans. */
|
|
79
|
+
type NormalizedSpanAttributeKey = OpenTelemetrySemanticAttributeKey | (string & {});
|
|
80
|
+
/**
|
|
81
|
+
* JSON-safe span attributes. Known OpenTelemetry GenAI keys are typed while
|
|
82
|
+
* custom provider and application keys remain allowed.
|
|
83
|
+
*/
|
|
84
|
+
type NormalizedSpanAttributes = OpenTelemetrySemanticAttributes & {
|
|
85
|
+
[key: string]: JsonValue | undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Normalized error attached to tool calls and spans. */
|
|
89
|
+
type NormalizedError = {
|
|
90
|
+
/** Human-readable failure message. */
|
|
91
|
+
message: string;
|
|
92
|
+
/** Optional provider or runtime error type. */
|
|
93
|
+
type?: string;
|
|
94
|
+
/** Extra JSON-safe error metadata. */
|
|
95
|
+
[key: string]: JsonValue | undefined;
|
|
96
|
+
};
|
|
97
|
+
/** Usage values normalized by vitest-evals harnesses. */
|
|
98
|
+
declare const UsageSummarySchema: z.ZodObject<{
|
|
99
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
100
|
+
model: z.ZodOptional<z.ZodString>;
|
|
101
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
/** Usage values normalized by vitest-evals harnesses. */
|
|
110
|
+
type UsageSummary = {
|
|
111
|
+
/** Provider that served the application run. */
|
|
112
|
+
provider?: string;
|
|
113
|
+
/** Model used for the application run. */
|
|
114
|
+
model?: string;
|
|
115
|
+
/** Input, prompt, or request tokens consumed by the run. */
|
|
116
|
+
inputTokens?: number;
|
|
117
|
+
/** Output or completion tokens produced by the run. */
|
|
118
|
+
outputTokens?: number;
|
|
119
|
+
/** Reasoning tokens reported by providers that expose them. */
|
|
120
|
+
reasoningTokens?: number;
|
|
121
|
+
/** Total token count reported by the provider or adapter. */
|
|
122
|
+
totalTokens?: number;
|
|
123
|
+
/** Count of tool calls observed during the run. */
|
|
124
|
+
toolCalls?: number;
|
|
125
|
+
/** Retry count observed during the run. */
|
|
126
|
+
retries?: number;
|
|
127
|
+
/** Provider-specific JSON-safe usage details. Cost estimates belong here. */
|
|
128
|
+
metadata?: Record<string, JsonValue>;
|
|
129
|
+
};
|
|
130
|
+
/** Timing values normalized by vitest-evals harnesses. */
|
|
131
|
+
declare const TimingSummarySchema: z.ZodObject<{
|
|
132
|
+
totalMs: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
134
|
+
}, z.core.$strict>;
|
|
135
|
+
/** Timing values normalized by vitest-evals harnesses. */
|
|
136
|
+
type TimingSummary = {
|
|
137
|
+
/** End-to-end run duration in milliseconds. */
|
|
138
|
+
totalMs?: number;
|
|
139
|
+
/** Extra JSON-safe timing metadata. */
|
|
140
|
+
metadata?: Record<string, JsonValue>;
|
|
141
|
+
};
|
|
142
|
+
/** Normalized error object captured in a tool call or trace span. */
|
|
143
|
+
declare const NormalizedErrorSchema: z.ZodObject<{
|
|
144
|
+
message: z.ZodString;
|
|
145
|
+
type: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
147
|
+
/** Normalized tool call captured in a harness session. */
|
|
148
|
+
declare const ToolCallRecordSchema: z.ZodObject<{
|
|
149
|
+
id: z.ZodOptional<z.ZodString>;
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
152
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
153
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
message: z.ZodString;
|
|
155
|
+
type: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
157
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
158
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
159
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
/** Normalized tool call captured in a harness session. */
|
|
163
|
+
type ToolCallRecord = {
|
|
164
|
+
/** Provider or runtime tool-call id when one is available. */
|
|
165
|
+
id?: string;
|
|
166
|
+
/** Tool name as exposed to the agent or application runtime. */
|
|
167
|
+
name: string;
|
|
168
|
+
/** JSON-safe tool arguments after provider/runtime normalization. */
|
|
169
|
+
arguments?: Record<string, JsonValue>;
|
|
170
|
+
/** JSON-safe tool result returned by the application tool. */
|
|
171
|
+
result?: JsonValue;
|
|
172
|
+
/** Normalized tool error when execution failed. */
|
|
173
|
+
error?: NormalizedError;
|
|
174
|
+
/** ISO timestamp for the start of tool execution. */
|
|
175
|
+
startedAt?: string;
|
|
176
|
+
/** ISO timestamp for the end of tool execution. */
|
|
177
|
+
finishedAt?: string;
|
|
178
|
+
/** Tool execution duration in milliseconds. */
|
|
179
|
+
durationMs?: number;
|
|
180
|
+
/** Extra JSON-safe tool metadata for reporters and custom judges. */
|
|
181
|
+
metadata?: Record<string, JsonValue>;
|
|
182
|
+
};
|
|
183
|
+
/** Normalized transcript message captured in a harness session. */
|
|
184
|
+
declare const NormalizedMessageSchema: z.ZodObject<{
|
|
185
|
+
role: z.ZodEnum<{
|
|
186
|
+
system: "system";
|
|
187
|
+
user: "user";
|
|
188
|
+
assistant: "assistant";
|
|
189
|
+
tool: "tool";
|
|
190
|
+
}>;
|
|
191
|
+
content: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
192
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
193
|
+
id: z.ZodOptional<z.ZodString>;
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
196
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
197
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
message: z.ZodString;
|
|
199
|
+
type: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
201
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
202
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
203
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
205
|
+
}, z.core.$strict>>>;
|
|
206
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
207
|
+
}, z.core.$strict>;
|
|
208
|
+
/** Normalized transcript message captured in a harness session. */
|
|
209
|
+
type NormalizedMessage = {
|
|
210
|
+
/** Transcript role for the normalized message. */
|
|
211
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
212
|
+
/** JSON-safe message content. */
|
|
213
|
+
content?: JsonValue;
|
|
214
|
+
/** Tool calls associated with this message. */
|
|
215
|
+
toolCalls?: ToolCallRecord[];
|
|
216
|
+
/** Extra JSON-safe message metadata. */
|
|
217
|
+
metadata?: Record<string, JsonValue>;
|
|
218
|
+
};
|
|
219
|
+
/** Normalized transcript produced by an application harness. */
|
|
220
|
+
declare const NormalizedSessionSchema: z.ZodObject<{
|
|
221
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
222
|
+
role: z.ZodEnum<{
|
|
223
|
+
system: "system";
|
|
224
|
+
user: "user";
|
|
225
|
+
assistant: "assistant";
|
|
226
|
+
tool: "tool";
|
|
227
|
+
}>;
|
|
228
|
+
content: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
229
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
id: z.ZodOptional<z.ZodString>;
|
|
231
|
+
name: z.ZodString;
|
|
232
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
233
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
234
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
message: z.ZodString;
|
|
236
|
+
type: z.ZodOptional<z.ZodString>;
|
|
237
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
238
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
239
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
240
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
242
|
+
}, z.core.$strict>>>;
|
|
243
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
244
|
+
}, z.core.$strict>>>;
|
|
245
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
246
|
+
model: z.ZodOptional<z.ZodString>;
|
|
247
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
/** Normalized transcript produced by an application harness. */
|
|
250
|
+
type NormalizedSession = {
|
|
251
|
+
/** Ordered normalized transcript messages. */
|
|
252
|
+
messages: NormalizedMessage[];
|
|
253
|
+
/** Provider that produced the session when known. */
|
|
254
|
+
provider?: string;
|
|
255
|
+
/** Model that produced the session when known. */
|
|
256
|
+
model?: string;
|
|
257
|
+
/** Extra JSON-safe session metadata. */
|
|
258
|
+
metadata?: Record<string, JsonValue>;
|
|
259
|
+
};
|
|
260
|
+
/** Attribute schema attached to normalized traces, spans, and events. */
|
|
261
|
+
declare const NormalizedSpanAttributesSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
262
|
+
/** Event attached to a normalized span. */
|
|
263
|
+
declare const NormalizedSpanEventSchema: z.ZodObject<{
|
|
264
|
+
name: z.ZodString;
|
|
265
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
266
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
/** Event attached to a normalized span. */
|
|
269
|
+
type NormalizedSpanEvent = {
|
|
270
|
+
/** Event name emitted by the runtime or harness. */
|
|
271
|
+
name: string;
|
|
272
|
+
/** ISO timestamp for the event when available. */
|
|
273
|
+
timestamp?: string;
|
|
274
|
+
/** JSON-safe event attributes. */
|
|
275
|
+
attributes?: NormalizedSpanAttributes;
|
|
276
|
+
};
|
|
277
|
+
/** Normalized operation span captured during a harness run. */
|
|
278
|
+
declare const NormalizedSpanSchema: z.ZodObject<{
|
|
279
|
+
id: z.ZodOptional<z.ZodString>;
|
|
280
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
281
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
282
|
+
name: z.ZodString;
|
|
283
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
284
|
+
custom: "custom";
|
|
285
|
+
model: "model";
|
|
286
|
+
tool: "tool";
|
|
287
|
+
run: "run";
|
|
288
|
+
agent: "agent";
|
|
289
|
+
guardrail: "guardrail";
|
|
290
|
+
handoff: "handoff";
|
|
291
|
+
}>>;
|
|
292
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
293
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
294
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
295
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
296
|
+
error: "error";
|
|
297
|
+
ok: "ok";
|
|
298
|
+
}>>;
|
|
299
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
message: z.ZodString;
|
|
301
|
+
type: z.ZodOptional<z.ZodString>;
|
|
302
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
303
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
304
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
305
|
+
name: z.ZodString;
|
|
306
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
307
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
308
|
+
}, z.core.$strict>>>;
|
|
309
|
+
}, z.core.$strict>;
|
|
310
|
+
/** Normalized operation span captured during a harness run. */
|
|
311
|
+
type NormalizedSpan = {
|
|
312
|
+
/** Runtime or provider span id when one is available. */
|
|
313
|
+
id?: string;
|
|
314
|
+
/** Trace id this span belongs to. */
|
|
315
|
+
traceId?: string;
|
|
316
|
+
/** Parent span id when the runtime exposes hierarchy. */
|
|
317
|
+
parentId?: string;
|
|
318
|
+
/** Human-readable operation name. */
|
|
319
|
+
name: string;
|
|
320
|
+
/** Coarse operation kind used by reporters and judges. */
|
|
321
|
+
kind?: "run" | "agent" | "model" | "tool" | "guardrail" | "handoff" | "custom";
|
|
322
|
+
/** ISO timestamp for the start of the span. */
|
|
323
|
+
startedAt?: string;
|
|
324
|
+
/** ISO timestamp for the end of the span. */
|
|
325
|
+
finishedAt?: string;
|
|
326
|
+
/** Span duration in milliseconds. */
|
|
327
|
+
durationMs?: number;
|
|
328
|
+
/** Success or failure status for the span. */
|
|
329
|
+
status?: "ok" | "error";
|
|
330
|
+
/** Normalized error when the span failed. */
|
|
331
|
+
error?: NormalizedError;
|
|
332
|
+
/** JSON-safe operation attributes. */
|
|
333
|
+
attributes?: NormalizedSpanAttributes;
|
|
334
|
+
/** Events observed inside this span. */
|
|
335
|
+
events?: NormalizedSpanEvent[];
|
|
336
|
+
};
|
|
337
|
+
/** Normalized trace captured during a harness run. */
|
|
338
|
+
declare const NormalizedTraceSchema: z.ZodObject<{
|
|
339
|
+
id: z.ZodOptional<z.ZodString>;
|
|
340
|
+
name: z.ZodOptional<z.ZodString>;
|
|
341
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
342
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
343
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
344
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
345
|
+
spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
346
|
+
id: z.ZodOptional<z.ZodString>;
|
|
347
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
348
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
349
|
+
name: z.ZodString;
|
|
350
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
351
|
+
custom: "custom";
|
|
352
|
+
model: "model";
|
|
353
|
+
tool: "tool";
|
|
354
|
+
run: "run";
|
|
355
|
+
agent: "agent";
|
|
356
|
+
guardrail: "guardrail";
|
|
357
|
+
handoff: "handoff";
|
|
358
|
+
}>>;
|
|
359
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
360
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
361
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
362
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
363
|
+
error: "error";
|
|
364
|
+
ok: "ok";
|
|
365
|
+
}>>;
|
|
366
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
367
|
+
message: z.ZodString;
|
|
368
|
+
type: z.ZodOptional<z.ZodString>;
|
|
369
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
370
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
371
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
372
|
+
name: z.ZodString;
|
|
373
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
374
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
375
|
+
}, z.core.$strict>>>;
|
|
376
|
+
}, z.core.$strict>>>;
|
|
377
|
+
}, z.core.$strict>;
|
|
378
|
+
/** Normalized trace captured during a harness run. */
|
|
379
|
+
type NormalizedTrace = {
|
|
380
|
+
/** Runtime or provider trace id when one is available. */
|
|
381
|
+
id?: string;
|
|
382
|
+
/** Human-readable trace or workflow name. */
|
|
383
|
+
name?: string;
|
|
384
|
+
/** ISO timestamp for the start of the trace. */
|
|
385
|
+
startedAt?: string;
|
|
386
|
+
/** ISO timestamp for the end of the trace. */
|
|
387
|
+
finishedAt?: string;
|
|
388
|
+
/** Trace duration in milliseconds. */
|
|
389
|
+
durationMs?: number;
|
|
390
|
+
/** Extra JSON-safe trace metadata. */
|
|
391
|
+
metadata?: Record<string, JsonValue>;
|
|
392
|
+
/** Spans that make up this trace. */
|
|
393
|
+
spans: NormalizedSpan[];
|
|
394
|
+
};
|
|
395
|
+
/** Full normalized harness run as stored in Vitest assertion metadata. */
|
|
396
|
+
declare const HarnessRunSchema: z.ZodObject<{
|
|
397
|
+
output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
398
|
+
session: z.ZodObject<{
|
|
399
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
400
|
+
role: z.ZodEnum<{
|
|
401
|
+
system: "system";
|
|
402
|
+
user: "user";
|
|
403
|
+
assistant: "assistant";
|
|
404
|
+
tool: "tool";
|
|
405
|
+
}>;
|
|
406
|
+
content: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
407
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
408
|
+
id: z.ZodOptional<z.ZodString>;
|
|
409
|
+
name: z.ZodString;
|
|
410
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
411
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
412
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
413
|
+
message: z.ZodString;
|
|
414
|
+
type: z.ZodOptional<z.ZodString>;
|
|
415
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
416
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
417
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
418
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
419
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
420
|
+
}, z.core.$strict>>>;
|
|
421
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
422
|
+
}, z.core.$strict>>>;
|
|
423
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
424
|
+
model: z.ZodOptional<z.ZodString>;
|
|
425
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
426
|
+
}, z.core.$strict>;
|
|
427
|
+
usage: z.ZodObject<{
|
|
428
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
429
|
+
model: z.ZodOptional<z.ZodString>;
|
|
430
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
431
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
433
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
435
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
436
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
437
|
+
}, z.core.$strict>;
|
|
438
|
+
timings: z.ZodOptional<z.ZodObject<{
|
|
439
|
+
totalMs: z.ZodOptional<z.ZodNumber>;
|
|
440
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
441
|
+
}, z.core.$strict>>;
|
|
442
|
+
artifacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
443
|
+
traces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
444
|
+
id: z.ZodOptional<z.ZodString>;
|
|
445
|
+
name: z.ZodOptional<z.ZodString>;
|
|
446
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
447
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
448
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
449
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
450
|
+
spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
451
|
+
id: z.ZodOptional<z.ZodString>;
|
|
452
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
453
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
454
|
+
name: z.ZodString;
|
|
455
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
456
|
+
custom: "custom";
|
|
457
|
+
model: "model";
|
|
458
|
+
tool: "tool";
|
|
459
|
+
run: "run";
|
|
460
|
+
agent: "agent";
|
|
461
|
+
guardrail: "guardrail";
|
|
462
|
+
handoff: "handoff";
|
|
463
|
+
}>>;
|
|
464
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
465
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
466
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
467
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
468
|
+
error: "error";
|
|
469
|
+
ok: "ok";
|
|
470
|
+
}>>;
|
|
471
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
472
|
+
message: z.ZodString;
|
|
473
|
+
type: z.ZodOptional<z.ZodString>;
|
|
474
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
475
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
476
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
477
|
+
name: z.ZodString;
|
|
478
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
479
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
480
|
+
}, z.core.$strict>>>;
|
|
481
|
+
}, z.core.$strict>>>;
|
|
482
|
+
}, z.core.$strict>>>;
|
|
483
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
484
|
+
}, z.core.$strict>;
|
|
485
|
+
type OutputField<TOutput extends JsonValue | undefined> = undefined extends TOutput ? {
|
|
486
|
+
output?: TOutput;
|
|
487
|
+
} : {
|
|
488
|
+
output: TOutput;
|
|
489
|
+
};
|
|
490
|
+
/**
|
|
491
|
+
* Normalized result returned by every harness execution.
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```ts
|
|
495
|
+
* const run: HarnessRun<{ status: "approved" }> = {
|
|
496
|
+
* output: { status: "approved" },
|
|
497
|
+
* session: {
|
|
498
|
+
* messages: [
|
|
499
|
+
* { role: "user", content: "Refund invoice inv_123" },
|
|
500
|
+
* { role: "assistant", content: { status: "approved" } },
|
|
501
|
+
* ],
|
|
502
|
+
* },
|
|
503
|
+
* usage: { totalTokens: 260 },
|
|
504
|
+
* errors: [],
|
|
505
|
+
* };
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
type HarnessRun<TOutput extends JsonValue | undefined = JsonValue | undefined> = OutputField<TOutput> & {
|
|
509
|
+
/** Normalized transcript and provider/session metadata. */
|
|
510
|
+
session: NormalizedSession;
|
|
511
|
+
/** Stable provider usage units such as tokens, tools, and retries. */
|
|
512
|
+
usage: UsageSummary;
|
|
513
|
+
/** Optional timing summary for the run. */
|
|
514
|
+
timings?: TimingSummary;
|
|
515
|
+
/** JSON-safe run artifacts captured by the harness or test context. */
|
|
516
|
+
artifacts?: Record<string, JsonValue>;
|
|
517
|
+
/** Normalized traces and spans captured during execution. */
|
|
518
|
+
traces?: NormalizedTrace[];
|
|
519
|
+
/** Normalized errors captured during execution. */
|
|
520
|
+
errors: Array<Record<string, JsonValue>>;
|
|
521
|
+
};
|
|
522
|
+
/** Error value with an attached partial or complete normalized harness run. */
|
|
523
|
+
type HarnessRunError = Error & {
|
|
524
|
+
/** Attached normalized harness run recovered from a thrown error. */
|
|
525
|
+
vitestEvalsRun: HarnessRun;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Flattens every recorded tool call from a normalized session.
|
|
530
|
+
*
|
|
531
|
+
* @param session - Normalized session produced by a harness run.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* const names = toolCalls(result.session).map((call) => call.name);
|
|
536
|
+
*
|
|
537
|
+
* expect(names).toEqual(["lookupInvoice", "createRefund"]);
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
declare function toolCalls(session: NormalizedSession): ToolCallRecord[];
|
|
541
|
+
/**
|
|
542
|
+
* Flattens every recorded span from a normalized harness run.
|
|
543
|
+
*
|
|
544
|
+
* @param run - Normalized harness run produced by a harness.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```ts
|
|
548
|
+
* const modelSpans = spans(result).filter((span) => span.kind === "model");
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
551
|
+
declare function spans(run: HarnessRun): NormalizedSpan[];
|
|
552
|
+
/**
|
|
553
|
+
* Alias for `spans(...)` for consumers that prefer trace-oriented naming.
|
|
554
|
+
*
|
|
555
|
+
* @param run - Normalized harness run produced by a harness.
|
|
556
|
+
*/
|
|
557
|
+
declare function traceSpans(run: HarnessRun): NormalizedSpan[];
|
|
558
|
+
/**
|
|
559
|
+
* Returns spans of one coarse operation kind from a normalized run.
|
|
560
|
+
*
|
|
561
|
+
* @param run - Normalized harness run produced by a harness.
|
|
562
|
+
* @param kind - Span kind to keep.
|
|
563
|
+
*/
|
|
564
|
+
declare function spansByKind(run: HarnessRun, kind: NonNullable<NormalizedSpan["kind"]>): NormalizedSpan[];
|
|
565
|
+
/**
|
|
566
|
+
* Returns every span that explicitly failed or carries a normalized error.
|
|
567
|
+
*
|
|
568
|
+
* @param run - Normalized harness run produced by a harness.
|
|
569
|
+
*/
|
|
570
|
+
declare function failedSpans(run: HarnessRun): NormalizedSpan[];
|
|
571
|
+
/**
|
|
572
|
+
* Filters normalized session messages by role.
|
|
573
|
+
*
|
|
574
|
+
* @param session - Normalized session produced by a harness run.
|
|
575
|
+
* @param role - Message role to keep.
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ```ts
|
|
579
|
+
* const assistantText = messagesByRole(result.session, "assistant")
|
|
580
|
+
* .map((message) => message.content)
|
|
581
|
+
* .join("\n");
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
declare function messagesByRole(session: NormalizedSession, role: NormalizedMessage["role"]): NormalizedMessage[];
|
|
585
|
+
/**
|
|
586
|
+
* Returns every normalized system message from a session.
|
|
587
|
+
*
|
|
588
|
+
* @param session - Normalized session produced by a harness run.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* const systemPrompts = systemMessages(result.session);
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
declare function systemMessages(session: NormalizedSession): NormalizedMessage[];
|
|
596
|
+
/**
|
|
597
|
+
* Returns every normalized user message from a session.
|
|
598
|
+
*
|
|
599
|
+
* @param session - Normalized session produced by a harness run.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```ts
|
|
603
|
+
* const firstPrompt = userMessages(result.session)[0]?.content;
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
declare function userMessages(session: NormalizedSession): NormalizedMessage[];
|
|
607
|
+
/**
|
|
608
|
+
* Returns every normalized assistant message from a session.
|
|
609
|
+
*
|
|
610
|
+
* @param session - Normalized session produced by a harness run.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```ts
|
|
614
|
+
* const finalAnswer = assistantMessages(session).at(-1)?.content;
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
declare function assistantMessages(session: NormalizedSession): NormalizedMessage[];
|
|
618
|
+
/**
|
|
619
|
+
* Returns the latest assistant message content, ignoring empty text messages.
|
|
620
|
+
*
|
|
621
|
+
* @param session - Normalized session produced by a harness run.
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```ts
|
|
625
|
+
* const finalAnswer = latestAssistantMessageContent(result.session);
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
628
|
+
declare function latestAssistantMessageContent(session: NormalizedSession): JsonValue | undefined;
|
|
629
|
+
/**
|
|
630
|
+
* Returns every normalized tool message from a session.
|
|
631
|
+
*
|
|
632
|
+
* @param session - Normalized session produced by a harness run.
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```ts
|
|
636
|
+
* const toolOutputs = toolMessages(session).map((message) => message.content);
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
declare function toolMessages(session: NormalizedSession): NormalizedMessage[];
|
|
640
|
+
|
|
641
|
+
/** Harness metadata stored by vitest-evals on Vitest task metadata. */
|
|
642
|
+
declare const HarnessMetaSchema: z.ZodObject<{
|
|
643
|
+
name: z.ZodOptional<z.ZodString>;
|
|
644
|
+
run: z.ZodOptional<z.ZodObject<{
|
|
645
|
+
output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
646
|
+
session: z.ZodObject<{
|
|
647
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
648
|
+
role: z.ZodEnum<{
|
|
649
|
+
system: "system";
|
|
650
|
+
user: "user";
|
|
651
|
+
assistant: "assistant";
|
|
652
|
+
tool: "tool";
|
|
653
|
+
}>;
|
|
654
|
+
content: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
655
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
656
|
+
id: z.ZodOptional<z.ZodString>;
|
|
657
|
+
name: z.ZodString;
|
|
658
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
659
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
660
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
661
|
+
message: z.ZodString;
|
|
662
|
+
type: z.ZodOptional<z.ZodString>;
|
|
663
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
664
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
665
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
666
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
667
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
668
|
+
}, z.core.$strict>>>;
|
|
669
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
670
|
+
}, z.core.$strict>>>;
|
|
671
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
672
|
+
model: z.ZodOptional<z.ZodString>;
|
|
673
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
674
|
+
}, z.core.$strict>;
|
|
675
|
+
usage: z.ZodObject<{
|
|
676
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
677
|
+
model: z.ZodOptional<z.ZodString>;
|
|
678
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
679
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
680
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
681
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
682
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
683
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
684
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
685
|
+
}, z.core.$strict>;
|
|
686
|
+
timings: z.ZodOptional<z.ZodObject<{
|
|
687
|
+
totalMs: z.ZodOptional<z.ZodNumber>;
|
|
688
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
689
|
+
}, z.core.$strict>>;
|
|
690
|
+
artifacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
691
|
+
traces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
692
|
+
id: z.ZodOptional<z.ZodString>;
|
|
693
|
+
name: z.ZodOptional<z.ZodString>;
|
|
694
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
695
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
696
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
697
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
698
|
+
spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
699
|
+
id: z.ZodOptional<z.ZodString>;
|
|
700
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
701
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
702
|
+
name: z.ZodString;
|
|
703
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
704
|
+
custom: "custom";
|
|
705
|
+
model: "model";
|
|
706
|
+
tool: "tool";
|
|
707
|
+
run: "run";
|
|
708
|
+
agent: "agent";
|
|
709
|
+
guardrail: "guardrail";
|
|
710
|
+
handoff: "handoff";
|
|
711
|
+
}>>;
|
|
712
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
713
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
714
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
715
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
716
|
+
error: "error";
|
|
717
|
+
ok: "ok";
|
|
718
|
+
}>>;
|
|
719
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
720
|
+
message: z.ZodString;
|
|
721
|
+
type: z.ZodOptional<z.ZodString>;
|
|
722
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
723
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
724
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
725
|
+
name: z.ZodString;
|
|
726
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
727
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
728
|
+
}, z.core.$strict>>>;
|
|
729
|
+
}, z.core.$strict>>>;
|
|
730
|
+
}, z.core.$strict>>>;
|
|
731
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
732
|
+
}, z.core.$strict>>;
|
|
733
|
+
}, z.core.$strict>;
|
|
734
|
+
/** Harness metadata stored by vitest-evals on Vitest task metadata. */
|
|
735
|
+
type HarnessMeta = z.infer<typeof HarnessMetaSchema>;
|
|
736
|
+
/** Score record stored by vitest-evals on Vitest task metadata. */
|
|
737
|
+
declare const EvalScoreSchema: z.ZodObject<{
|
|
738
|
+
name: z.ZodOptional<z.ZodString>;
|
|
739
|
+
score: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
740
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
741
|
+
}, z.core.$strict>;
|
|
742
|
+
/** Score record stored by vitest-evals on Vitest task metadata. */
|
|
743
|
+
type EvalScore = z.infer<typeof EvalScoreSchema>;
|
|
744
|
+
/** Eval metadata stored by vitest-evals on Vitest task metadata. */
|
|
745
|
+
declare const EvalMetaSchema: z.ZodObject<{
|
|
746
|
+
scores: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
747
|
+
name: z.ZodOptional<z.ZodString>;
|
|
748
|
+
score: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
749
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
750
|
+
}, z.core.$strict>>>;
|
|
751
|
+
avgScore: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
752
|
+
output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
753
|
+
thresholdFailed: z.ZodOptional<z.ZodBoolean>;
|
|
754
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
755
|
+
id: z.ZodOptional<z.ZodString>;
|
|
756
|
+
name: z.ZodString;
|
|
757
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
758
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
759
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
760
|
+
message: z.ZodString;
|
|
761
|
+
type: z.ZodOptional<z.ZodString>;
|
|
762
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
763
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
764
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
765
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
766
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
767
|
+
}, z.core.$strict>>>;
|
|
768
|
+
}, z.core.$strict>;
|
|
769
|
+
/** Eval metadata stored by vitest-evals on Vitest task metadata. */
|
|
770
|
+
type EvalMeta = z.infer<typeof EvalMetaSchema>;
|
|
771
|
+
/** Combined eval and harness metadata stored on a Vitest assertion. */
|
|
772
|
+
declare const EvalTaskMetaSchema: z.ZodObject<{
|
|
773
|
+
eval: z.ZodOptional<z.ZodObject<{
|
|
774
|
+
scores: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
775
|
+
name: z.ZodOptional<z.ZodString>;
|
|
776
|
+
score: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
777
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
778
|
+
}, z.core.$strict>>>;
|
|
779
|
+
avgScore: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
780
|
+
output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
781
|
+
thresholdFailed: z.ZodOptional<z.ZodBoolean>;
|
|
782
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
783
|
+
id: z.ZodOptional<z.ZodString>;
|
|
784
|
+
name: z.ZodString;
|
|
785
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
786
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
787
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
788
|
+
message: z.ZodString;
|
|
789
|
+
type: z.ZodOptional<z.ZodString>;
|
|
790
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
791
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
792
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
793
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
794
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
795
|
+
}, z.core.$strict>>>;
|
|
796
|
+
}, z.core.$strict>>;
|
|
797
|
+
harness: z.ZodOptional<z.ZodObject<{
|
|
798
|
+
name: z.ZodOptional<z.ZodString>;
|
|
799
|
+
run: z.ZodOptional<z.ZodObject<{
|
|
800
|
+
output: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
801
|
+
session: z.ZodObject<{
|
|
802
|
+
messages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
803
|
+
role: z.ZodEnum<{
|
|
804
|
+
system: "system";
|
|
805
|
+
user: "user";
|
|
806
|
+
assistant: "assistant";
|
|
807
|
+
tool: "tool";
|
|
808
|
+
}>;
|
|
809
|
+
content: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
810
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
811
|
+
id: z.ZodOptional<z.ZodString>;
|
|
812
|
+
name: z.ZodString;
|
|
813
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
814
|
+
result: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
815
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
816
|
+
message: z.ZodString;
|
|
817
|
+
type: z.ZodOptional<z.ZodString>;
|
|
818
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
819
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
820
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
821
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
822
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
823
|
+
}, z.core.$strict>>>;
|
|
824
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
825
|
+
}, z.core.$strict>>>;
|
|
826
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
827
|
+
model: z.ZodOptional<z.ZodString>;
|
|
828
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
829
|
+
}, z.core.$strict>;
|
|
830
|
+
usage: z.ZodObject<{
|
|
831
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
832
|
+
model: z.ZodOptional<z.ZodString>;
|
|
833
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
834
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
835
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
836
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
837
|
+
toolCalls: z.ZodOptional<z.ZodNumber>;
|
|
838
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
839
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
840
|
+
}, z.core.$strict>;
|
|
841
|
+
timings: z.ZodOptional<z.ZodObject<{
|
|
842
|
+
totalMs: z.ZodOptional<z.ZodNumber>;
|
|
843
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
844
|
+
}, z.core.$strict>>;
|
|
845
|
+
artifacts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
846
|
+
traces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
847
|
+
id: z.ZodOptional<z.ZodString>;
|
|
848
|
+
name: z.ZodOptional<z.ZodString>;
|
|
849
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
850
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
851
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
852
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
853
|
+
spans: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
854
|
+
id: z.ZodOptional<z.ZodString>;
|
|
855
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
856
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
857
|
+
name: z.ZodString;
|
|
858
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
859
|
+
custom: "custom";
|
|
860
|
+
model: "model";
|
|
861
|
+
tool: "tool";
|
|
862
|
+
run: "run";
|
|
863
|
+
agent: "agent";
|
|
864
|
+
guardrail: "guardrail";
|
|
865
|
+
handoff: "handoff";
|
|
866
|
+
}>>;
|
|
867
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
868
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
869
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
870
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
871
|
+
error: "error";
|
|
872
|
+
ok: "ok";
|
|
873
|
+
}>>;
|
|
874
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
875
|
+
message: z.ZodString;
|
|
876
|
+
type: z.ZodOptional<z.ZodString>;
|
|
877
|
+
}, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
878
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
879
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
880
|
+
name: z.ZodString;
|
|
881
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
882
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
883
|
+
}, z.core.$strict>>>;
|
|
884
|
+
}, z.core.$strict>>>;
|
|
885
|
+
}, z.core.$strict>>>;
|
|
886
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
887
|
+
}, z.core.$strict>>;
|
|
888
|
+
}, z.core.$strict>>;
|
|
889
|
+
}, z.core.$strict>;
|
|
890
|
+
/** Combined eval and harness metadata stored on a Vitest assertion. */
|
|
891
|
+
type EvalTaskMeta = z.infer<typeof EvalTaskMetaSchema>;
|
|
892
|
+
/** Reads eval metadata from an arbitrary Vitest assertion meta value. */
|
|
893
|
+
declare function readEvalTaskMeta(input: unknown): EvalTaskMeta | undefined;
|
|
894
|
+
|
|
895
|
+
export { type EvalMeta, EvalMetaSchema, type EvalScore, EvalScoreSchema, type EvalTaskMeta, EvalTaskMetaSchema, type GenAiOperationName, type GenAiOutputType, type GenAiProviderName, type GenAiSemanticAttributeKey, type GenAiSemanticAttributes, type GenAiTokenType, type GenAiToolType, type HarnessMeta, HarnessMetaSchema, type HarnessRun, type HarnessRunError, HarnessRunSchema, JsonValue, type NormalizedError, NormalizedErrorSchema, type NormalizedMessage, NormalizedMessageSchema, type NormalizedSession, NormalizedSessionSchema, type NormalizedSpan, type NormalizedSpanAttributeKey, type NormalizedSpanAttributes, NormalizedSpanAttributesSchema, type NormalizedSpanEvent, NormalizedSpanEventSchema, NormalizedSpanSchema, type NormalizedTrace, NormalizedTraceSchema, type OpenTelemetrySemanticAttributeKey, type OpenTelemetrySemanticAttributes, type TimingSummary, TimingSummarySchema, type ToolCallRecord, ToolCallRecordSchema, type UsageSummary, UsageSummarySchema, assistantMessages, failedSpans, latestAssistantMessageContent, messagesByRole, readEvalTaskMeta, spans, spansByKind, systemMessages, toolCalls, toolMessages, traceSpans, userMessages };
|