raindrop-ai 1.1.0 → 1.1.1
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/README.md +1 -1
- package/dist/{chunk-MIF3DD2N.mjs → chunk-7HPYMPNJ.mjs} +1 -1
- package/dist/{chunk-ZY5VBIW4.mjs → chunk-HEJQOFNN.mjs} +423 -277
- package/dist/evals/cli.js +469 -323
- package/dist/evals/cli.mjs +2 -2
- package/dist/{index-Dif41B_Z.d.mts → index-mM4Ls3Kv.d.mts} +951 -939
- package/dist/{index-Dif41B_Z.d.ts → index-mM4Ls3Kv.d.ts} +951 -939
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +492 -346
- package/dist/index.mjs +2 -2
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
withReplayTraceDestination,
|
|
50
50
|
withRoutingContext,
|
|
51
51
|
withTask
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-7HPYMPNJ.mjs";
|
|
53
53
|
import {
|
|
54
54
|
AiTrackEventSchema,
|
|
55
55
|
AttachmentSchema,
|
|
@@ -135,7 +135,7 @@ var AttachmentTypeSchema = z.enum(["code", "text", "image", "iframe"]);
|
|
|
135
135
|
|
|
136
136
|
// src/replay/index.ts
|
|
137
137
|
import { context, trace } from "@opentelemetry/api";
|
|
138
|
-
import { z as
|
|
138
|
+
import { z as z4 } from "zod/v4";
|
|
139
139
|
|
|
140
140
|
// src/evals/generated/dataset.ts
|
|
141
141
|
import { z as z2 } from "zod/v4";
|
|
@@ -273,6 +273,137 @@ async function evalDatasetVersionFingerprint(cases) {
|
|
|
273
273
|
return sha256(canonicalJson(normalizeCasesForFingerprint(parsed)));
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
// src/evals/generated/simulation.ts
|
|
277
|
+
import { z as z3 } from "zod/v4";
|
|
278
|
+
var EvalOutputTypeSchema = z3.enum(["boolean", "score", "number", "preference"]);
|
|
279
|
+
var PreferenceValueSchema = z3.enum(["A", "B", "tie"]);
|
|
280
|
+
var TraceIdSchema = z3.string().min(1).max(200);
|
|
281
|
+
var OutcomeNoteSchema = z3.string().trim().min(1).max(600);
|
|
282
|
+
var FailureMessageSchema = z3.string().trim().min(1).max(600);
|
|
283
|
+
var ScoreValueSchema = z3.union([
|
|
284
|
+
z3.literal(1),
|
|
285
|
+
z3.literal(2),
|
|
286
|
+
z3.literal(3),
|
|
287
|
+
z3.literal(4),
|
|
288
|
+
z3.literal(5)
|
|
289
|
+
]);
|
|
290
|
+
var ErroredOutcomeSchema = z3.object({
|
|
291
|
+
state: z3.literal("errored"),
|
|
292
|
+
traceId: TraceIdSchema,
|
|
293
|
+
message: FailureMessageSchema
|
|
294
|
+
});
|
|
295
|
+
var UngradedOutcomeSchema = z3.object({
|
|
296
|
+
state: z3.literal("ungraded"),
|
|
297
|
+
traceId: TraceIdSchema,
|
|
298
|
+
reason: z3.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
299
|
+
});
|
|
300
|
+
var GradedBaseSchema = z3.object({
|
|
301
|
+
state: z3.literal("graded"),
|
|
302
|
+
traceId: TraceIdSchema,
|
|
303
|
+
note: OutcomeNoteSchema.optional()
|
|
304
|
+
});
|
|
305
|
+
var BooleanOutcomeSchema = z3.discriminatedUnion("state", [
|
|
306
|
+
GradedBaseSchema.extend({ pass: z3.boolean() }),
|
|
307
|
+
ErroredOutcomeSchema,
|
|
308
|
+
UngradedOutcomeSchema
|
|
309
|
+
]);
|
|
310
|
+
var ScoreOutcomeSchema = z3.discriminatedUnion("state", [
|
|
311
|
+
GradedBaseSchema.extend({ score: ScoreValueSchema }),
|
|
312
|
+
ErroredOutcomeSchema,
|
|
313
|
+
UngradedOutcomeSchema
|
|
314
|
+
]);
|
|
315
|
+
var NumberOutcomeSchema = z3.discriminatedUnion("state", [
|
|
316
|
+
GradedBaseSchema.extend({ value: z3.number().finite() }),
|
|
317
|
+
ErroredOutcomeSchema,
|
|
318
|
+
UngradedOutcomeSchema
|
|
319
|
+
]);
|
|
320
|
+
var PreferenceOutcomeSchema = z3.discriminatedUnion("state", [
|
|
321
|
+
GradedBaseSchema.extend({ preference: PreferenceValueSchema }),
|
|
322
|
+
ErroredOutcomeSchema,
|
|
323
|
+
UngradedOutcomeSchema
|
|
324
|
+
]);
|
|
325
|
+
var EvalOutcomeSchema = z3.union([
|
|
326
|
+
BooleanOutcomeSchema,
|
|
327
|
+
ScoreOutcomeSchema,
|
|
328
|
+
NumberOutcomeSchema,
|
|
329
|
+
PreferenceOutcomeSchema
|
|
330
|
+
]);
|
|
331
|
+
var SIMULATION_RESULT_PAGE_SIZE = 100;
|
|
332
|
+
var SimulationEvalResultsQuerySchema = z3.object({
|
|
333
|
+
offset: z3.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0)
|
|
334
|
+
});
|
|
335
|
+
var SimulationEvalResultPageSchema = z3.object({
|
|
336
|
+
executionId: z3.string().uuid(),
|
|
337
|
+
evalId: z3.string().uuid(),
|
|
338
|
+
runId: z3.string().uuid(),
|
|
339
|
+
offset: z3.number().int().nonnegative(),
|
|
340
|
+
outcomes: z3.array(EvalOutcomeSchema).max(SIMULATION_RESULT_PAGE_SIZE),
|
|
341
|
+
failures: z3.array(FailureMessageSchema).max(SIMULATION_RESULT_PAGE_SIZE),
|
|
342
|
+
nextOffset: z3.number().int().nonnegative().nullable()
|
|
343
|
+
});
|
|
344
|
+
var EvalExecutionPinsSchema = z3.object({
|
|
345
|
+
datasetVersionId: z3.string().uuid(),
|
|
346
|
+
datasetFingerprint: z3.string().regex(/^[a-f0-9]{64}$/),
|
|
347
|
+
evaluators: z3.array(z3.object({
|
|
348
|
+
evalId: z3.string().uuid(),
|
|
349
|
+
programVersion: z3.number().int().positive()
|
|
350
|
+
}).strict()).min(1).max(20).refine((pins) => new Set(pins.map((pin) => pin.evalId)).size === pins.length, "Evaluator pins must be unique")
|
|
351
|
+
}).strict();
|
|
352
|
+
var SimulationRevisionSchema = z3.object({
|
|
353
|
+
worldVersionId: z3.string().uuid().optional(),
|
|
354
|
+
commitSha: z3.string().regex(/^[0-9a-f]{40}$/).optional(),
|
|
355
|
+
requestKey: z3.string().trim().min(1).max(200).optional()
|
|
356
|
+
});
|
|
357
|
+
var SimulationEvalRequestSchema = z3.union([
|
|
358
|
+
SimulationRevisionSchema.extend({
|
|
359
|
+
datasetId: z3.string().uuid(),
|
|
360
|
+
worldId: z3.string().uuid(),
|
|
361
|
+
pins: EvalExecutionPinsSchema
|
|
362
|
+
}).strict(),
|
|
363
|
+
SimulationRevisionSchema.extend({
|
|
364
|
+
evals: z3.array(z3.string().trim().min(1)).min(1).max(20),
|
|
365
|
+
worldId: z3.string().uuid(),
|
|
366
|
+
datasetId: z3.string().uuid().optional()
|
|
367
|
+
}).strict(),
|
|
368
|
+
SimulationRevisionSchema.extend({
|
|
369
|
+
eval: z3.string().trim().min(1),
|
|
370
|
+
worldId: z3.string().uuid(),
|
|
371
|
+
datasetId: z3.string().uuid().optional(),
|
|
372
|
+
programVersion: z3.number().int().positive().optional()
|
|
373
|
+
}).strict(),
|
|
374
|
+
SimulationRevisionSchema.pick({ commitSha: true, requestKey: true }).extend({
|
|
375
|
+
baselineExecutionId: z3.string().uuid()
|
|
376
|
+
}).strict()
|
|
377
|
+
]);
|
|
378
|
+
var SimulationEvalExecutionSchema = z3.object({
|
|
379
|
+
id: z3.string().uuid(),
|
|
380
|
+
status: z3.enum(["queued", "executing", "grading", "completed", "failed"]),
|
|
381
|
+
error: z3.string().nullable(),
|
|
382
|
+
datasetId: z3.string().uuid(),
|
|
383
|
+
datasetVersionId: z3.string().uuid(),
|
|
384
|
+
datasetFingerprint: z3.string(),
|
|
385
|
+
worldId: z3.string().uuid(),
|
|
386
|
+
worldVersionId: z3.string().uuid(),
|
|
387
|
+
commitSha: z3.string(),
|
|
388
|
+
agent: z3.string(),
|
|
389
|
+
cases: z3.array(z3.object({
|
|
390
|
+
caseId: z3.string(),
|
|
391
|
+
replayId: z3.string().uuid(),
|
|
392
|
+
runId: z3.string().uuid().nullable()
|
|
393
|
+
})),
|
|
394
|
+
evaluations: z3.array(z3.object({
|
|
395
|
+
evalId: z3.string().uuid(),
|
|
396
|
+
slug: z3.string(),
|
|
397
|
+
outputType: EvalOutputTypeSchema,
|
|
398
|
+
programVersion: z3.number().int().positive(),
|
|
399
|
+
runId: z3.string().uuid(),
|
|
400
|
+
status: z3.enum(["queued", "running", "completed", "failed"]),
|
|
401
|
+
error: z3.string().nullable(),
|
|
402
|
+
outcomeCount: z3.number().int().nonnegative(),
|
|
403
|
+
failureCount: z3.number().int().nonnegative()
|
|
404
|
+
}))
|
|
405
|
+
});
|
|
406
|
+
|
|
276
407
|
// src/evals/trace-pair.ts
|
|
277
408
|
var EvalCaseTracePairSchema2 = EvalCaseTracePairSchema.extend({
|
|
278
409
|
reference: EvalCaseTracePairSchema.shape.reference.unwrap().extend({
|
|
@@ -324,123 +455,138 @@ function retryDelayMs(response, retry) {
|
|
|
324
455
|
}
|
|
325
456
|
return EVAL_RETRY_BASE_DELAY_MS * 2 ** retry;
|
|
326
457
|
}
|
|
327
|
-
var ReplayRowSchema =
|
|
328
|
-
id:
|
|
329
|
-
name:
|
|
330
|
-
input:
|
|
458
|
+
var ReplayRowSchema = z4.object({
|
|
459
|
+
id: z4.string(),
|
|
460
|
+
name: z4.string(),
|
|
461
|
+
input: z4.string().nullable(),
|
|
331
462
|
output: JsonValueSchema,
|
|
332
|
-
properties: stringRecord(
|
|
463
|
+
properties: stringRecord(z4.string())
|
|
333
464
|
});
|
|
334
|
-
var WireEvalManifestSchema =
|
|
335
|
-
dataset_id:
|
|
336
|
-
dataset_version_id:
|
|
337
|
-
fingerprint:
|
|
338
|
-
rows:
|
|
465
|
+
var WireEvalManifestSchema = z4.object({
|
|
466
|
+
dataset_id: z4.string().uuid(),
|
|
467
|
+
dataset_version_id: z4.string().uuid().optional(),
|
|
468
|
+
fingerprint: z4.string().regex(/^[a-f0-9]{64}$/),
|
|
469
|
+
rows: z4.array(ReplayRowSchema.extend({ id: z4.string().min(1) }))
|
|
339
470
|
});
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
471
|
+
var EvalDatasetManifestReadSchema = EvalDatasetManifestSchema.extend({
|
|
472
|
+
cases: z4.array(
|
|
473
|
+
z4.object({
|
|
474
|
+
...EvalDatasetManifestSchema.shape.cases.element.shape,
|
|
475
|
+
referenceCapture: z4.object(EvalDatasetCaptureRefSchema.shape).optional(),
|
|
476
|
+
expectation: z4.object(EvalCaseExpectationSchema.shape).optional(),
|
|
477
|
+
expectedVerdict: z4.union([
|
|
478
|
+
z4.object({ pass: z4.boolean() }),
|
|
479
|
+
z4.object({ score: z4.number().int().min(1).max(5) }),
|
|
480
|
+
z4.object({ value: z4.number().finite() }),
|
|
481
|
+
z4.object({ preference: PreferenceValueSchema })
|
|
482
|
+
]).optional().catch(void 0)
|
|
483
|
+
})
|
|
484
|
+
)
|
|
485
|
+
});
|
|
486
|
+
var ReplayCountsSchema = z4.object({
|
|
487
|
+
total: z4.number(),
|
|
488
|
+
pending: z4.number(),
|
|
489
|
+
done: z4.number(),
|
|
490
|
+
missing: z4.number()
|
|
345
491
|
});
|
|
346
|
-
var ReplayEvaluatorCountsSchema =
|
|
347
|
-
traces:
|
|
348
|
-
graded:
|
|
349
|
-
errored:
|
|
350
|
-
ungraded:
|
|
351
|
-
pending:
|
|
492
|
+
var ReplayEvaluatorCountsSchema = z4.object({
|
|
493
|
+
traces: z4.number(),
|
|
494
|
+
graded: z4.number(),
|
|
495
|
+
errored: z4.number(),
|
|
496
|
+
ungraded: z4.number(),
|
|
497
|
+
pending: z4.number()
|
|
352
498
|
});
|
|
353
|
-
var ReplayEvaluatorStatsSchema =
|
|
354
|
-
traceCount:
|
|
355
|
-
hydratedCount:
|
|
356
|
-
judgeCalls:
|
|
357
|
-
durationMs:
|
|
358
|
-
skippedRows:
|
|
359
|
-
skippedReason:
|
|
499
|
+
var ReplayEvaluatorStatsSchema = z4.object({
|
|
500
|
+
traceCount: z4.number(),
|
|
501
|
+
hydratedCount: z4.number(),
|
|
502
|
+
judgeCalls: z4.number(),
|
|
503
|
+
durationMs: z4.number(),
|
|
504
|
+
skippedRows: z4.number(),
|
|
505
|
+
skippedReason: z4.literal("no trace").nullable()
|
|
360
506
|
});
|
|
361
|
-
var ReplayEvaluatorSummarySchema =
|
|
362
|
-
|
|
363
|
-
outputType:
|
|
507
|
+
var ReplayEvaluatorSummarySchema = z4.discriminatedUnion("outputType", [
|
|
508
|
+
z4.object({
|
|
509
|
+
outputType: z4.literal("preference"),
|
|
364
510
|
counts: ReplayEvaluatorCountsSchema,
|
|
365
511
|
stats: ReplayEvaluatorStatsSchema,
|
|
366
|
-
preferences:
|
|
512
|
+
preferences: z4.object({ A: z4.number(), B: z4.number(), tie: z4.number() })
|
|
367
513
|
}),
|
|
368
|
-
|
|
369
|
-
outputType:
|
|
514
|
+
z4.object({
|
|
515
|
+
outputType: z4.literal("boolean"),
|
|
370
516
|
counts: ReplayEvaluatorCountsSchema,
|
|
371
517
|
stats: ReplayEvaluatorStatsSchema,
|
|
372
|
-
passed:
|
|
373
|
-
failed:
|
|
374
|
-
passRate:
|
|
518
|
+
passed: z4.number(),
|
|
519
|
+
failed: z4.number(),
|
|
520
|
+
passRate: z4.number().nullable()
|
|
375
521
|
}),
|
|
376
|
-
|
|
377
|
-
outputType:
|
|
522
|
+
z4.object({
|
|
523
|
+
outputType: z4.literal("score"),
|
|
378
524
|
counts: ReplayEvaluatorCountsSchema,
|
|
379
525
|
stats: ReplayEvaluatorStatsSchema,
|
|
380
|
-
mean:
|
|
381
|
-
median:
|
|
382
|
-
p10:
|
|
383
|
-
p90:
|
|
384
|
-
atLeast4Share:
|
|
385
|
-
histogram:
|
|
526
|
+
mean: z4.number().nullable(),
|
|
527
|
+
median: z4.number().nullable(),
|
|
528
|
+
p10: z4.number().nullable(),
|
|
529
|
+
p90: z4.number().nullable(),
|
|
530
|
+
atLeast4Share: z4.number().nullable(),
|
|
531
|
+
histogram: z4.tuple([z4.number(), z4.number(), z4.number(), z4.number(), z4.number()])
|
|
386
532
|
}),
|
|
387
|
-
|
|
388
|
-
outputType:
|
|
533
|
+
z4.object({
|
|
534
|
+
outputType: z4.literal("number"),
|
|
389
535
|
counts: ReplayEvaluatorCountsSchema,
|
|
390
536
|
stats: ReplayEvaluatorStatsSchema,
|
|
391
|
-
median:
|
|
392
|
-
p10:
|
|
393
|
-
p90:
|
|
537
|
+
median: z4.number().nullable(),
|
|
538
|
+
p10: z4.number().nullable(),
|
|
539
|
+
p90: z4.number().nullable()
|
|
394
540
|
})
|
|
395
541
|
]);
|
|
396
|
-
var ReplayVerdictIdentitySchema =
|
|
397
|
-
evaluator:
|
|
398
|
-
runId:
|
|
399
|
-
url:
|
|
542
|
+
var ReplayVerdictIdentitySchema = z4.object({
|
|
543
|
+
evaluator: z4.string(),
|
|
544
|
+
runId: z4.string(),
|
|
545
|
+
url: z4.string()
|
|
400
546
|
});
|
|
401
547
|
var ReplayVerdictGradedSchema = ReplayVerdictIdentitySchema.extend({
|
|
402
|
-
state:
|
|
403
|
-
note:
|
|
548
|
+
state: z4.literal("graded"),
|
|
549
|
+
note: z4.string().optional()
|
|
404
550
|
});
|
|
405
|
-
var ReplayVerdictSchema =
|
|
406
|
-
ReplayVerdictGradedSchema.extend({ pass:
|
|
551
|
+
var ReplayVerdictSchema = z4.union([
|
|
552
|
+
ReplayVerdictGradedSchema.extend({ pass: z4.boolean() }),
|
|
407
553
|
ReplayVerdictGradedSchema.extend({ score: EvalScoreSchema }),
|
|
408
|
-
ReplayVerdictGradedSchema.extend({ value:
|
|
409
|
-
ReplayVerdictGradedSchema.extend({ preference:
|
|
554
|
+
ReplayVerdictGradedSchema.extend({ value: z4.number().finite() }),
|
|
555
|
+
ReplayVerdictGradedSchema.extend({ preference: z4.enum(["A", "B", "tie"]) }),
|
|
410
556
|
ReplayVerdictIdentitySchema.extend({
|
|
411
|
-
state:
|
|
412
|
-
message:
|
|
557
|
+
state: z4.literal("errored"),
|
|
558
|
+
message: z4.string()
|
|
413
559
|
}),
|
|
414
560
|
ReplayVerdictIdentitySchema.extend({
|
|
415
|
-
state:
|
|
416
|
-
reason:
|
|
561
|
+
state: z4.literal("ungraded"),
|
|
562
|
+
reason: z4.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
417
563
|
})
|
|
418
564
|
]);
|
|
419
565
|
var ReplayResultRowSchema = ReplayRowSchema.extend({
|
|
420
|
-
status:
|
|
421
|
-
traceId:
|
|
422
|
-
error:
|
|
423
|
-
verdicts:
|
|
566
|
+
status: z4.enum(["pending", "done", "missing"]),
|
|
567
|
+
traceId: z4.string().nullable(),
|
|
568
|
+
error: z4.string().nullable(),
|
|
569
|
+
verdicts: z4.array(ReplayVerdictSchema)
|
|
424
570
|
});
|
|
425
|
-
var ReplayTraceEvidenceEntrySchema =
|
|
426
|
-
rowId:
|
|
427
|
-
traceId:
|
|
428
|
-
spanIds:
|
|
571
|
+
var ReplayTraceEvidenceEntrySchema = z4.object({
|
|
572
|
+
rowId: z4.string().min(1).max(512),
|
|
573
|
+
traceId: z4.string().regex(/^[a-f0-9]{32}$/),
|
|
574
|
+
spanIds: z4.array(z4.string().regex(/^[a-f0-9]{16}$/)).min(1).max(500)
|
|
429
575
|
}).superRefine((entry, context2) => {
|
|
430
576
|
if (new Set(entry.spanIds).size !== entry.spanIds.length) {
|
|
431
577
|
context2.addIssue({
|
|
432
|
-
code:
|
|
578
|
+
code: z4.ZodIssueCode.custom,
|
|
433
579
|
message: "Replay trace evidence span ids must be unique",
|
|
434
580
|
path: ["spanIds"]
|
|
435
581
|
});
|
|
436
582
|
}
|
|
437
583
|
});
|
|
438
|
-
var ReplayTraceEvidenceSchema =
|
|
584
|
+
var ReplayTraceEvidenceSchema = z4.array(ReplayTraceEvidenceEntrySchema).superRefine((entries, context2) => {
|
|
439
585
|
const seen = /* @__PURE__ */ new Set();
|
|
440
586
|
for (const [index, entry] of entries.entries()) {
|
|
441
587
|
if (seen.has(entry.rowId)) {
|
|
442
588
|
context2.addIssue({
|
|
443
|
-
code:
|
|
589
|
+
code: z4.ZodIssueCode.custom,
|
|
444
590
|
message: "Replay trace evidence row ids must be unique",
|
|
445
591
|
path: [index, "rowId"]
|
|
446
592
|
});
|
|
@@ -448,17 +594,17 @@ var ReplayTraceEvidenceSchema = z3.array(ReplayTraceEvidenceEntrySchema).superRe
|
|
|
448
594
|
seen.add(entry.rowId);
|
|
449
595
|
}
|
|
450
596
|
});
|
|
451
|
-
var LocalBooleanVerdictSchema =
|
|
452
|
-
var LocalScoreVerdictSchema =
|
|
597
|
+
var LocalBooleanVerdictSchema = z4.object({ pass: z4.boolean(), note: z4.string().trim().min(1).max(600).optional() }).strict();
|
|
598
|
+
var LocalScoreVerdictSchema = z4.object({
|
|
453
599
|
score: EvalScoreSchema,
|
|
454
|
-
note:
|
|
600
|
+
note: z4.string().trim().min(1).max(600).optional()
|
|
455
601
|
}).strict();
|
|
456
|
-
var LocalNumberVerdictSchema =
|
|
457
|
-
var LocalPreferenceVerdictSchema =
|
|
458
|
-
preference:
|
|
459
|
-
note:
|
|
602
|
+
var LocalNumberVerdictSchema = z4.object({ value: z4.number().finite(), note: z4.string().trim().min(1).max(600).optional() }).strict();
|
|
603
|
+
var LocalPreferenceVerdictSchema = z4.object({
|
|
604
|
+
preference: z4.enum(["A", "B", "tie"]),
|
|
605
|
+
note: z4.string().trim().min(1).max(600).optional()
|
|
460
606
|
}).strict();
|
|
461
|
-
var LocalVerdictSchema =
|
|
607
|
+
var LocalVerdictSchema = z4.union([
|
|
462
608
|
LocalBooleanVerdictSchema,
|
|
463
609
|
LocalScoreVerdictSchema,
|
|
464
610
|
LocalNumberVerdictSchema,
|
|
@@ -535,50 +681,50 @@ async function queryApi(request) {
|
|
|
535
681
|
return parsed.data;
|
|
536
682
|
}
|
|
537
683
|
}
|
|
538
|
-
var ReplayStatusSchema =
|
|
539
|
-
var ReplayRowStatusSchema =
|
|
540
|
-
var WireReplaySchema =
|
|
541
|
-
id:
|
|
684
|
+
var ReplayStatusSchema = z4.enum(["queued", "running", "complete", "failed"]);
|
|
685
|
+
var ReplayRowStatusSchema = z4.enum(["pending", "done", "missing"]);
|
|
686
|
+
var WireReplaySchema = z4.object({
|
|
687
|
+
id: z4.string(),
|
|
542
688
|
status: ReplayStatusSchema,
|
|
543
689
|
counts: ReplayCountsSchema,
|
|
544
|
-
traces_expire_at:
|
|
545
|
-
traces_expired:
|
|
690
|
+
traces_expire_at: z4.string(),
|
|
691
|
+
traces_expired: z4.boolean()
|
|
546
692
|
});
|
|
547
|
-
var WireRowSchema =
|
|
548
|
-
row_id:
|
|
549
|
-
attempt:
|
|
693
|
+
var WireRowSchema = z4.object({
|
|
694
|
+
row_id: z4.string(),
|
|
695
|
+
attempt: z4.number().int().nonnegative(),
|
|
550
696
|
status: ReplayRowStatusSchema,
|
|
551
|
-
trace_id:
|
|
552
|
-
error:
|
|
697
|
+
trace_id: z4.string().nullable(),
|
|
698
|
+
error: z4.string().nullable()
|
|
553
699
|
});
|
|
554
|
-
var WirePlanSchema =
|
|
700
|
+
var WirePlanSchema = z4.object({
|
|
555
701
|
replay: WireReplaySchema,
|
|
556
|
-
ingest_url:
|
|
557
|
-
rows:
|
|
702
|
+
ingest_url: z4.string().min(1).nullable(),
|
|
703
|
+
rows: z4.array(
|
|
558
704
|
ReplayRowSchema.omit({ id: true }).extend({
|
|
559
|
-
row_id:
|
|
560
|
-
attempt:
|
|
561
|
-
correlation_id:
|
|
705
|
+
row_id: z4.string(),
|
|
706
|
+
attempt: z4.literal(0),
|
|
707
|
+
correlation_id: z4.string()
|
|
562
708
|
})
|
|
563
709
|
)
|
|
564
710
|
});
|
|
565
|
-
var WireReplayDetailSchema =
|
|
711
|
+
var WireReplayDetailSchema = z4.object({
|
|
566
712
|
replay: WireReplaySchema,
|
|
567
|
-
rows:
|
|
713
|
+
rows: z4.array(WireRowSchema)
|
|
568
714
|
});
|
|
569
715
|
var EvalRunDetailSchema = WireReplayDetailSchema.extend({
|
|
570
716
|
replay: WireReplaySchema.extend({
|
|
571
|
-
dataset_id:
|
|
572
|
-
dataset_version_id:
|
|
717
|
+
dataset_id: z4.string().uuid(),
|
|
718
|
+
dataset_version_id: z4.string().uuid().nullable()
|
|
573
719
|
}),
|
|
574
|
-
eval_runs:
|
|
575
|
-
|
|
576
|
-
id:
|
|
577
|
-
eval_id:
|
|
578
|
-
program_version:
|
|
579
|
-
output_type:
|
|
580
|
-
executed_by:
|
|
581
|
-
status:
|
|
720
|
+
eval_runs: z4.array(
|
|
721
|
+
z4.object({
|
|
722
|
+
id: z4.string().uuid(),
|
|
723
|
+
eval_id: z4.string().uuid(),
|
|
724
|
+
program_version: z4.number().int().positive(),
|
|
725
|
+
output_type: z4.enum(["boolean", "score", "number", "preference"]),
|
|
726
|
+
executed_by: z4.enum(["hosted", "local"]),
|
|
727
|
+
status: z4.enum(["running", "completed", "failed"])
|
|
582
728
|
})
|
|
583
729
|
)
|
|
584
730
|
});
|
|
@@ -594,124 +740,124 @@ async function readReplayDetails(client, runId, options = {}) {
|
|
|
594
740
|
if (detail.replay.id !== runId) throw new Error("Raindrop returned a different run");
|
|
595
741
|
return detail;
|
|
596
742
|
}
|
|
597
|
-
var WireReportSchema =
|
|
598
|
-
var WireAttemptStartedSchema =
|
|
599
|
-
status:
|
|
600
|
-
row:
|
|
601
|
-
row_id:
|
|
602
|
-
attempt:
|
|
603
|
-
correlation_id:
|
|
743
|
+
var WireReportSchema = z4.object({ status: z4.string() });
|
|
744
|
+
var WireAttemptStartedSchema = z4.object({
|
|
745
|
+
status: z4.literal("pending"),
|
|
746
|
+
row: z4.object({
|
|
747
|
+
row_id: z4.string().min(1),
|
|
748
|
+
attempt: z4.number().int().positive(),
|
|
749
|
+
correlation_id: z4.string().min(1)
|
|
604
750
|
})
|
|
605
751
|
});
|
|
606
|
-
var WireLocalEvaluatorSchema =
|
|
607
|
-
data:
|
|
608
|
-
id:
|
|
609
|
-
slug:
|
|
610
|
-
name:
|
|
611
|
-
output:
|
|
612
|
-
kind:
|
|
613
|
-
programVersion:
|
|
752
|
+
var WireLocalEvaluatorSchema = z4.object({
|
|
753
|
+
data: z4.object({
|
|
754
|
+
id: z4.string().uuid(),
|
|
755
|
+
slug: z4.string(),
|
|
756
|
+
name: z4.string(),
|
|
757
|
+
output: z4.enum(["boolean", "score", "number", "preference"]),
|
|
758
|
+
kind: z4.literal("local"),
|
|
759
|
+
programVersion: z4.number().int().positive()
|
|
614
760
|
})
|
|
615
761
|
});
|
|
616
|
-
var WireStartedEvalRunSchema =
|
|
617
|
-
data:
|
|
618
|
-
runId:
|
|
619
|
-
status:
|
|
620
|
-
url:
|
|
621
|
-
evalId:
|
|
622
|
-
programVersion:
|
|
762
|
+
var WireStartedEvalRunSchema = z4.object({
|
|
763
|
+
data: z4.object({
|
|
764
|
+
runId: z4.string(),
|
|
765
|
+
status: z4.literal("running"),
|
|
766
|
+
url: z4.string(),
|
|
767
|
+
evalId: z4.string().uuid().optional(),
|
|
768
|
+
programVersion: z4.number().int().positive().optional()
|
|
623
769
|
})
|
|
624
770
|
});
|
|
625
|
-
var WireEvalRunSchema =
|
|
626
|
-
data:
|
|
627
|
-
id:
|
|
628
|
-
evalSlug:
|
|
629
|
-
status:
|
|
771
|
+
var WireEvalRunSchema = z4.object({
|
|
772
|
+
data: z4.object({
|
|
773
|
+
id: z4.string(),
|
|
774
|
+
evalSlug: z4.string(),
|
|
775
|
+
status: z4.enum(["running", "completed", "failed"]),
|
|
630
776
|
summary: ReplayEvaluatorSummarySchema.nullable(),
|
|
631
|
-
error:
|
|
632
|
-
traces:
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
state:
|
|
636
|
-
traceId:
|
|
637
|
-
pass:
|
|
638
|
-
note:
|
|
777
|
+
error: z4.string().nullable(),
|
|
778
|
+
traces: z4.array(
|
|
779
|
+
z4.union([
|
|
780
|
+
z4.object({
|
|
781
|
+
state: z4.literal("graded"),
|
|
782
|
+
traceId: z4.string(),
|
|
783
|
+
pass: z4.boolean(),
|
|
784
|
+
note: z4.string().optional()
|
|
639
785
|
}),
|
|
640
|
-
|
|
641
|
-
state:
|
|
642
|
-
traceId:
|
|
786
|
+
z4.object({
|
|
787
|
+
state: z4.literal("graded"),
|
|
788
|
+
traceId: z4.string(),
|
|
643
789
|
score: EvalScoreSchema,
|
|
644
|
-
note:
|
|
790
|
+
note: z4.string().optional()
|
|
645
791
|
}),
|
|
646
|
-
|
|
647
|
-
state:
|
|
648
|
-
traceId:
|
|
649
|
-
value:
|
|
650
|
-
note:
|
|
792
|
+
z4.object({
|
|
793
|
+
state: z4.literal("graded"),
|
|
794
|
+
traceId: z4.string(),
|
|
795
|
+
value: z4.number().finite(),
|
|
796
|
+
note: z4.string().optional()
|
|
651
797
|
}),
|
|
652
|
-
|
|
653
|
-
state:
|
|
654
|
-
traceId:
|
|
655
|
-
preference:
|
|
656
|
-
note:
|
|
798
|
+
z4.object({
|
|
799
|
+
state: z4.literal("graded"),
|
|
800
|
+
traceId: z4.string(),
|
|
801
|
+
preference: z4.enum(["A", "B", "tie"]),
|
|
802
|
+
note: z4.string().optional()
|
|
657
803
|
}),
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
state:
|
|
661
|
-
traceId:
|
|
662
|
-
reason:
|
|
804
|
+
z4.object({ state: z4.literal("errored"), traceId: z4.string(), message: z4.string() }),
|
|
805
|
+
z4.object({
|
|
806
|
+
state: z4.literal("ungraded"),
|
|
807
|
+
traceId: z4.string(),
|
|
808
|
+
reason: z4.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
663
809
|
})
|
|
664
810
|
])
|
|
665
811
|
)
|
|
666
812
|
})
|
|
667
813
|
});
|
|
668
|
-
var WireLocalEvalRunSchema =
|
|
669
|
-
data: WireEvalRunSchema.shape.data.extend({ status:
|
|
814
|
+
var WireLocalEvalRunSchema = z4.object({
|
|
815
|
+
data: WireEvalRunSchema.shape.data.extend({ status: z4.literal("completed"), url: z4.string() })
|
|
670
816
|
});
|
|
671
|
-
var WireLocalEvalRunStartedSchema =
|
|
672
|
-
data: WireEvalRunSchema.shape.data.omit({ traces: true }).extend({ status:
|
|
817
|
+
var WireLocalEvalRunStartedSchema = z4.object({
|
|
818
|
+
data: WireEvalRunSchema.shape.data.omit({ traces: true }).extend({ status: z4.literal("running"), url: z4.string() })
|
|
673
819
|
});
|
|
674
|
-
var WireLocalEvalAttemptSchema =
|
|
675
|
-
data:
|
|
676
|
-
runId:
|
|
677
|
-
requestId:
|
|
678
|
-
rowId:
|
|
679
|
-
attempt:
|
|
680
|
-
traceId:
|
|
820
|
+
var WireLocalEvalAttemptSchema = z4.object({
|
|
821
|
+
data: z4.object({
|
|
822
|
+
runId: z4.string().uuid(),
|
|
823
|
+
requestId: z4.string().uuid(),
|
|
824
|
+
rowId: z4.string().min(1),
|
|
825
|
+
attempt: z4.number().int().nonnegative(),
|
|
826
|
+
traceId: z4.string().regex(/^[a-f0-9]{32}$/),
|
|
681
827
|
outcome: WireEvalRunSchema.shape.data.shape.traces.element
|
|
682
828
|
})
|
|
683
829
|
});
|
|
684
|
-
var WireEvalCaseTracePairReadSchema =
|
|
830
|
+
var WireEvalCaseTracePairReadSchema = z4.discriminatedUnion("state", [
|
|
685
831
|
EvalCaseTracePairSchema2.extend({
|
|
686
|
-
state:
|
|
687
|
-
attempt:
|
|
688
|
-
datasetVersion:
|
|
689
|
-
id:
|
|
832
|
+
state: z4.literal("ready"),
|
|
833
|
+
attempt: z4.number().int().nonnegative(),
|
|
834
|
+
datasetVersion: z4.object({
|
|
835
|
+
id: z4.string().uuid(),
|
|
690
836
|
fingerprint: EvalDatasetFingerprintSchema
|
|
691
837
|
})
|
|
692
838
|
}),
|
|
693
|
-
|
|
694
|
-
state:
|
|
695
|
-
caseId:
|
|
696
|
-
attempt:
|
|
839
|
+
z4.object({
|
|
840
|
+
state: z4.literal("pending"),
|
|
841
|
+
caseId: z4.string().min(1),
|
|
842
|
+
attempt: z4.number().int().nonnegative()
|
|
697
843
|
}),
|
|
698
|
-
|
|
699
|
-
state:
|
|
700
|
-
caseId:
|
|
701
|
-
attempt:
|
|
702
|
-
reason:
|
|
844
|
+
z4.object({
|
|
845
|
+
state: z4.literal("missing"),
|
|
846
|
+
caseId: z4.string().min(1),
|
|
847
|
+
attempt: z4.number().int().nonnegative(),
|
|
848
|
+
reason: z4.string()
|
|
703
849
|
}),
|
|
704
|
-
|
|
705
|
-
state:
|
|
706
|
-
caseId:
|
|
707
|
-
attempt:
|
|
708
|
-
expiredAt:
|
|
850
|
+
z4.object({
|
|
851
|
+
state: z4.literal("expired"),
|
|
852
|
+
caseId: z4.string().min(1),
|
|
853
|
+
attempt: z4.number().int().nonnegative(),
|
|
854
|
+
expiredAt: z4.string().datetime({ offset: true })
|
|
709
855
|
}),
|
|
710
|
-
|
|
711
|
-
state:
|
|
712
|
-
caseId:
|
|
713
|
-
attempt:
|
|
714
|
-
reason:
|
|
856
|
+
z4.object({
|
|
857
|
+
state: z4.literal("errored"),
|
|
858
|
+
caseId: z4.string().min(1),
|
|
859
|
+
attempt: z4.number().int().nonnegative(),
|
|
860
|
+
reason: z4.string()
|
|
715
861
|
})
|
|
716
862
|
]);
|
|
717
863
|
var replayGitSnapshots = /* @__PURE__ */ new WeakMap();
|
|
@@ -903,7 +1049,7 @@ async function readEvalDataset(client, dataset, options) {
|
|
|
903
1049
|
var _a;
|
|
904
1050
|
const slug = EvalDatasetSlugSchema.parse(dataset.trim());
|
|
905
1051
|
const versionId = options == null ? void 0 : options.versionId;
|
|
906
|
-
if (versionId !== void 0 && !
|
|
1052
|
+
if (versionId !== void 0 && !z4.string().uuid().safeParse(versionId).success) {
|
|
907
1053
|
throw new Error("Raindrop eval dataset versionId must be a UUID");
|
|
908
1054
|
}
|
|
909
1055
|
const path = versionId ? `/v1/eval-datasets/${encodeURIComponent(slug)}/versions/${encodeURIComponent(versionId)}` : `/v1/eval-datasets/${encodeURIComponent(slug)}`;
|
|
@@ -913,7 +1059,7 @@ async function readEvalDataset(client, dataset, options) {
|
|
|
913
1059
|
queryUrl: (_a = options == null ? void 0 : options.queryUrl) != null ? _a : DEFAULT_QUERY_URL,
|
|
914
1060
|
path,
|
|
915
1061
|
method: "GET",
|
|
916
|
-
schema:
|
|
1062
|
+
schema: EvalDatasetManifestReadSchema
|
|
917
1063
|
})
|
|
918
1064
|
);
|
|
919
1065
|
if (manifest.dataset.slug !== slug && manifest.dataset.id !== slug) {
|
|
@@ -925,7 +1071,7 @@ async function readEvalDataset(client, dataset, options) {
|
|
|
925
1071
|
return manifest;
|
|
926
1072
|
}
|
|
927
1073
|
function validateEvalDatasetManifest(value) {
|
|
928
|
-
const manifest =
|
|
1074
|
+
const manifest = EvalDatasetManifestReadSchema.parse(value);
|
|
929
1075
|
if (manifest.dataset.id !== manifest.version.datasetId) {
|
|
930
1076
|
throw new Error("Raindrop eval dataset and version identities do not match");
|
|
931
1077
|
}
|
|
@@ -1519,7 +1665,7 @@ async function validateReferenceRequirements(client, dataset, rowIds, evaluators
|
|
|
1519
1665
|
queryUrl,
|
|
1520
1666
|
path: `/v1/evals/${encodeURIComponent(evaluator)}`,
|
|
1521
1667
|
method: "GET",
|
|
1522
|
-
schema:
|
|
1668
|
+
schema: z4.object({ data: z4.object({ requiresReference: z4.boolean() }) })
|
|
1523
1669
|
})).data.requiresReference : evaluator.requiresReference === true;
|
|
1524
1670
|
if (requiresReference) {
|
|
1525
1671
|
const name = typeof evaluator === "string" ? evaluator : evaluator.slug;
|
|
@@ -1997,7 +2143,7 @@ function validateEvaluatorPins(evaluators, raw) {
|
|
|
1997
2143
|
if (!allowed.has(slug)) {
|
|
1998
2144
|
throw new Error(`Raindrop evaluator pin names unknown evaluator ${slug}`);
|
|
1999
2145
|
}
|
|
2000
|
-
if (!
|
|
2146
|
+
if (!z4.string().uuid().safeParse(pin.expectedEvalId).success) {
|
|
2001
2147
|
throw new Error(`Raindrop evaluator ${slug} pin has an invalid evaluator id`);
|
|
2002
2148
|
}
|
|
2003
2149
|
if (!Number.isInteger(pin.expectedProgramVersion) || pin.expectedProgramVersion <= 0) {
|
|
@@ -2053,10 +2199,10 @@ function describeError(cause) {
|
|
|
2053
2199
|
}
|
|
2054
2200
|
|
|
2055
2201
|
// src/evals/agent.ts
|
|
2056
|
-
import { z as
|
|
2057
|
-
var ParameterValueSchema =
|
|
2202
|
+
import { z as z5 } from "zod/v4";
|
|
2203
|
+
var ParameterValueSchema = z5.union([z5.string(), z5.number().finite(), z5.boolean()]);
|
|
2058
2204
|
function isZod3Schema(value) {
|
|
2059
|
-
if (typeof value !== "object" || value === null || value instanceof
|
|
2205
|
+
if (typeof value !== "object" || value === null || value instanceof z5.ZodType) return false;
|
|
2060
2206
|
if (!("safeParse" in value) || typeof value.safeParse !== "function") return false;
|
|
2061
2207
|
if (!("_def" in value)) return false;
|
|
2062
2208
|
const def = value._def;
|
|
@@ -2064,20 +2210,20 @@ function isZod3Schema(value) {
|
|
|
2064
2210
|
}
|
|
2065
2211
|
function asZod4(schema) {
|
|
2066
2212
|
const candidate = schema;
|
|
2067
|
-
if (candidate instanceof
|
|
2213
|
+
if (candidate instanceof z5.ZodType) return candidate;
|
|
2068
2214
|
if (!isZod3Schema(candidate)) throw new Error("Parameter schemas must be Zod 3 or Zod 4 schemas");
|
|
2069
|
-
return
|
|
2215
|
+
return z5.unknown().optional().transform((value, context2) => {
|
|
2070
2216
|
const parsed = candidate.safeParse(value);
|
|
2071
2217
|
if (parsed.success) return parsed.data;
|
|
2072
2218
|
for (const issue of parsed.error.issues)
|
|
2073
2219
|
context2.addIssue({ code: "custom", message: issue.message, path: [...issue.path] });
|
|
2074
|
-
return
|
|
2220
|
+
return z5.NEVER;
|
|
2075
2221
|
});
|
|
2076
2222
|
}
|
|
2077
2223
|
function parameterValuesSchema(fields) {
|
|
2078
2224
|
const shape = {};
|
|
2079
2225
|
for (const [key, schema] of Object.entries(fields)) shape[key] = asZod4(schema);
|
|
2080
|
-
return
|
|
2226
|
+
return z5.object(shape).catchall(ParameterValueSchema);
|
|
2081
2227
|
}
|
|
2082
2228
|
var EvalParameterError = class extends Error {
|
|
2083
2229
|
constructor(agent, issues) {
|
|
@@ -2087,10 +2233,10 @@ var EvalParameterError = class extends Error {
|
|
|
2087
2233
|
this.name = "EvalParameterError";
|
|
2088
2234
|
}
|
|
2089
2235
|
};
|
|
2090
|
-
var AgentMetadataSchema =
|
|
2091
|
-
slug:
|
|
2092
|
-
name:
|
|
2093
|
-
description:
|
|
2236
|
+
var AgentMetadataSchema = z5.object({
|
|
2237
|
+
slug: z5.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
2238
|
+
name: z5.string().trim().min(1).max(120),
|
|
2239
|
+
description: z5.string().max(2e3).optional()
|
|
2094
2240
|
});
|
|
2095
2241
|
var PARAMETER_KEY = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
2096
2242
|
var MAX_PARAMETERS = 50;
|
|
@@ -2102,24 +2248,24 @@ function readZod4Field(schema) {
|
|
|
2102
2248
|
var _a;
|
|
2103
2249
|
let inner = schema;
|
|
2104
2250
|
let description;
|
|
2105
|
-
while (inner instanceof
|
|
2251
|
+
while (inner instanceof z5.ZodDefault || inner instanceof z5.ZodOptional) {
|
|
2106
2252
|
description != null ? description : description = inner.description;
|
|
2107
2253
|
const wrapped = inner.unwrap();
|
|
2108
|
-
if (!(wrapped instanceof
|
|
2254
|
+
if (!(wrapped instanceof z5.ZodType)) break;
|
|
2109
2255
|
inner = wrapped;
|
|
2110
2256
|
}
|
|
2111
2257
|
let shape;
|
|
2112
|
-
if (inner instanceof
|
|
2258
|
+
if (inner instanceof z5.ZodString)
|
|
2113
2259
|
shape = { kind: "string", maxLength: (_a = inner.maxLength) != null ? _a : void 0 };
|
|
2114
|
-
else if (inner instanceof
|
|
2260
|
+
else if (inner instanceof z5.ZodNumber)
|
|
2115
2261
|
shape = {
|
|
2116
2262
|
kind: "number",
|
|
2117
2263
|
min: bound(inner.minValue, Number.MIN_SAFE_INTEGER),
|
|
2118
2264
|
max: bound(inner.maxValue, Number.MAX_SAFE_INTEGER),
|
|
2119
2265
|
integer: inner.isInt
|
|
2120
2266
|
};
|
|
2121
|
-
else if (inner instanceof
|
|
2122
|
-
else if (inner instanceof
|
|
2267
|
+
else if (inner instanceof z5.ZodBoolean) shape = { kind: "boolean" };
|
|
2268
|
+
else if (inner instanceof z5.ZodEnum)
|
|
2123
2269
|
shape = { kind: "enum", options: inner.options.filter(isString) };
|
|
2124
2270
|
return {
|
|
2125
2271
|
shape,
|
|
@@ -2190,7 +2336,7 @@ function fieldDefault(key, value, guard) {
|
|
|
2190
2336
|
function describeParameterField(key, schema) {
|
|
2191
2337
|
if (!PARAMETER_KEY.test(key)) throw new Error(`Parameter key ${key} must be an identifier`);
|
|
2192
2338
|
const candidate = schema;
|
|
2193
|
-
const reading = candidate instanceof
|
|
2339
|
+
const reading = candidate instanceof z5.ZodType ? readZod4Field(candidate) : isZod3Schema(candidate) ? readZod3Field(candidate) : void 0;
|
|
2194
2340
|
if ((reading == null ? void 0 : reading.shape) === void 0)
|
|
2195
2341
|
throw new Error(
|
|
2196
2342
|
`Parameter ${key} must be a z.string(), z.number(), z.boolean(), or z.enum() schema`
|
|
@@ -2309,12 +2455,12 @@ function startAgent(definition, parameters) {
|
|
|
2309
2455
|
}
|
|
2310
2456
|
|
|
2311
2457
|
// src/evals/server.ts
|
|
2312
|
-
import { z as
|
|
2313
|
-
var InvocationSchema =
|
|
2314
|
-
runId:
|
|
2315
|
-
agent:
|
|
2316
|
-
parameters: stringRecord(
|
|
2317
|
-
concurrency:
|
|
2458
|
+
import { z as z6 } from "zod/v4";
|
|
2459
|
+
var InvocationSchema = z6.object({
|
|
2460
|
+
runId: z6.string().uuid(),
|
|
2461
|
+
agent: z6.string().min(1).max(64),
|
|
2462
|
+
parameters: stringRecord(z6.unknown()).default({}),
|
|
2463
|
+
concurrency: z6.number().int().min(1).max(100).optional()
|
|
2318
2464
|
});
|
|
2319
2465
|
var MAX_BODY_BYTES = 1024 * 1024;
|
|
2320
2466
|
async function parseInvocation(request) {
|
|
@@ -2446,7 +2592,7 @@ async function publishEvalDataset(client, options) {
|
|
|
2446
2592
|
slug,
|
|
2447
2593
|
body: JSON.stringify(body)
|
|
2448
2594
|
});
|
|
2449
|
-
const manifest =
|
|
2595
|
+
const manifest = EvalDatasetManifestReadSchema.parse(response);
|
|
2450
2596
|
if (manifest.dataset.slug !== slug || manifest.dataset.id !== manifest.version.datasetId || manifest.version.fingerprint !== fingerprint) {
|
|
2451
2597
|
throw new Error(`Raindrop eval dataset ${slug} returned mismatched publication identity`);
|
|
2452
2598
|
}
|
|
@@ -2555,7 +2701,7 @@ function sleep2(ms) {
|
|
|
2555
2701
|
}
|
|
2556
2702
|
|
|
2557
2703
|
// src/evals/publish.ts
|
|
2558
|
-
import { z as
|
|
2704
|
+
import { z as z7 } from "zod/v4";
|
|
2559
2705
|
|
|
2560
2706
|
// src/evals/runs.ts
|
|
2561
2707
|
async function readEvalRun(client, runId, options = {}) {
|
|
@@ -2604,19 +2750,19 @@ async function evaluateEvalRun(client, runId, options) {
|
|
|
2604
2750
|
}
|
|
2605
2751
|
|
|
2606
2752
|
// src/evals/publish.ts
|
|
2607
|
-
var EvaluatorIdentitySchema =
|
|
2608
|
-
id:
|
|
2609
|
-
slug:
|
|
2610
|
-
programVersion:
|
|
2611
|
-
outputType:
|
|
2753
|
+
var EvaluatorIdentitySchema = z7.object({
|
|
2754
|
+
id: z7.string().uuid(),
|
|
2755
|
+
slug: z7.string(),
|
|
2756
|
+
programVersion: z7.number().int().positive(),
|
|
2757
|
+
outputType: z7.enum(["boolean", "score", "number", "preference"])
|
|
2612
2758
|
});
|
|
2613
2759
|
var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
|
|
2614
|
-
name:
|
|
2615
|
-
description:
|
|
2616
|
-
intent:
|
|
2617
|
-
kind:
|
|
2618
|
-
programSource:
|
|
2619
|
-
rules:
|
|
2760
|
+
name: z7.string(),
|
|
2761
|
+
description: z7.string().nullable(),
|
|
2762
|
+
intent: z7.string(),
|
|
2763
|
+
kind: z7.enum(["judge", "deterministic"]),
|
|
2764
|
+
programSource: z7.string(),
|
|
2765
|
+
rules: z7.array(z7.string())
|
|
2620
2766
|
});
|
|
2621
2767
|
var EvalPublishError = class extends Error {
|
|
2622
2768
|
constructor(status, message) {
|
|
@@ -2625,12 +2771,12 @@ var EvalPublishError = class extends Error {
|
|
|
2625
2771
|
this.name = "EvalPublishError";
|
|
2626
2772
|
}
|
|
2627
2773
|
};
|
|
2628
|
-
var ComparisonRunSchema =
|
|
2629
|
-
id:
|
|
2630
|
-
programVersion:
|
|
2774
|
+
var ComparisonRunSchema = z7.object({
|
|
2775
|
+
id: z7.string().uuid(),
|
|
2776
|
+
programVersion: z7.number().int().positive()
|
|
2631
2777
|
});
|
|
2632
|
-
var ComparisonLinkSchema =
|
|
2633
|
-
url:
|
|
2778
|
+
var ComparisonLinkSchema = z7.object({
|
|
2779
|
+
url: z7.string().url(),
|
|
2634
2780
|
first: ComparisonRunSchema,
|
|
2635
2781
|
second: ComparisonRunSchema
|
|
2636
2782
|
});
|
|
@@ -2658,7 +2804,7 @@ async function compareEvalRuns(client, options) {
|
|
|
2658
2804
|
}
|
|
2659
2805
|
const before = selected.id;
|
|
2660
2806
|
const after = counterpart.id;
|
|
2661
|
-
const { data } =
|
|
2807
|
+
const { data } = z7.object({ data: ComparisonLinkSchema }).parse(await evalRequest(client, `/v1/eval-runs/${before}/compare/${after}`, options));
|
|
2662
2808
|
if (data.first.id !== before || data.second.id !== after) {
|
|
2663
2809
|
throw new Error("Raindrop returned a different comparison pair");
|
|
2664
2810
|
}
|
|
@@ -2671,7 +2817,7 @@ async function compareEvalRuns(client, options) {
|
|
|
2671
2817
|
};
|
|
2672
2818
|
}
|
|
2673
2819
|
async function readEvaluator(client, slug, options = {}) {
|
|
2674
|
-
const { data } =
|
|
2820
|
+
const { data } = z7.object({ data: EvaluatorSourceSchema }).parse(await evalRequest(client, `/v1/evals/${encodeURIComponent(slug)}`, options));
|
|
2675
2821
|
if (data.slug !== slug) throw new Error("Raindrop returned a different evaluator slug");
|
|
2676
2822
|
return defineEvaluatorProgram({
|
|
2677
2823
|
slug: data.slug,
|
|
@@ -2788,32 +2934,32 @@ var traceTools = Object.freeze({
|
|
|
2788
2934
|
});
|
|
2789
2935
|
|
|
2790
2936
|
// src/evals/pull.ts
|
|
2791
|
-
import { z as
|
|
2937
|
+
import { z as z8 } from "zod/v4";
|
|
2792
2938
|
var SNAPSHOT_VERSION = 1;
|
|
2793
|
-
var PulledEvaluatorSchema =
|
|
2794
|
-
slug:
|
|
2795
|
-
name:
|
|
2796
|
-
expectedSha256:
|
|
2797
|
-
artifact:
|
|
2939
|
+
var PulledEvaluatorSchema = z8.object({
|
|
2940
|
+
slug: z8.string().min(1),
|
|
2941
|
+
name: z8.string().min(1),
|
|
2942
|
+
expectedSha256: z8.string().regex(/^[a-f0-9]{64}$/),
|
|
2943
|
+
artifact: z8.unknown()
|
|
2798
2944
|
});
|
|
2799
|
-
var EvalSnapshotSchema =
|
|
2800
|
-
schemaVersion:
|
|
2801
|
-
pulledAt:
|
|
2802
|
-
dataset:
|
|
2803
|
-
reference:
|
|
2804
|
-
datasetId:
|
|
2805
|
-
fingerprint:
|
|
2806
|
-
rows:
|
|
2807
|
-
|
|
2808
|
-
id:
|
|
2809
|
-
name:
|
|
2810
|
-
input:
|
|
2945
|
+
var EvalSnapshotSchema = z8.object({
|
|
2946
|
+
schemaVersion: z8.literal(SNAPSHOT_VERSION),
|
|
2947
|
+
pulledAt: z8.string().datetime(),
|
|
2948
|
+
dataset: z8.object({
|
|
2949
|
+
reference: z8.string().min(1),
|
|
2950
|
+
datasetId: z8.string().uuid(),
|
|
2951
|
+
fingerprint: z8.string().regex(/^[a-f0-9]{64}$/),
|
|
2952
|
+
rows: z8.array(
|
|
2953
|
+
z8.object({
|
|
2954
|
+
id: z8.string(),
|
|
2955
|
+
name: z8.string(),
|
|
2956
|
+
input: z8.string().nullable(),
|
|
2811
2957
|
output: JsonValueSchema,
|
|
2812
|
-
properties: stringRecord(
|
|
2958
|
+
properties: stringRecord(z8.string())
|
|
2813
2959
|
})
|
|
2814
2960
|
)
|
|
2815
2961
|
}),
|
|
2816
|
-
evaluators:
|
|
2962
|
+
evaluators: z8.array(PulledEvaluatorSchema)
|
|
2817
2963
|
});
|
|
2818
2964
|
async function pullEval(client, options) {
|
|
2819
2965
|
var _a;
|
|
@@ -2878,11 +3024,11 @@ async function pullEvaluator(client, queryUrl, rawSlug) {
|
|
|
2878
3024
|
`Raindrop evaluator ${rawSlug} pull failed with ${response.status}: ${await response.text()}`
|
|
2879
3025
|
);
|
|
2880
3026
|
}
|
|
2881
|
-
const body =
|
|
2882
|
-
data:
|
|
2883
|
-
slug:
|
|
2884
|
-
name:
|
|
2885
|
-
artifact:
|
|
3027
|
+
const body = z8.object({
|
|
3028
|
+
data: z8.object({
|
|
3029
|
+
slug: z8.string(),
|
|
3030
|
+
name: z8.string(),
|
|
3031
|
+
artifact: z8.unknown().nullable()
|
|
2886
3032
|
})
|
|
2887
3033
|
}).parse(await response.json());
|
|
2888
3034
|
if (!body.data.artifact)
|