raindrop-ai 0.9.1 → 1.0.0-otelv2

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.
@@ -1784,7 +1784,7 @@ installTracingSuppressionHook();
1784
1784
  // package.json
1785
1785
  var package_default = {
1786
1786
  name: "raindrop-ai",
1787
- version: "0.9.1",
1787
+ version: "1.0.0",
1788
1788
  main: "dist/index.js",
1789
1789
  module: "dist/index.mjs",
1790
1790
  types: "dist/index.d.ts",
@@ -1851,8 +1851,8 @@ var package_default = {
1851
1851
  tsup: "^8.4.0",
1852
1852
  tsx: "^4.20.3",
1853
1853
  typescript: "^5.3.3",
1854
- vite: "^7.3.2",
1855
- vitest: "^4.0.10"
1854
+ vite: "^7.3.5",
1855
+ vitest: "^4.1.11"
1856
1856
  },
1857
1857
  dependencies: {
1858
1858
  "@jitl/quickjs-singlefile-cjs-release-sync": "0.32.0",
@@ -36,7 +36,7 @@ import {
36
36
  withReplayTraceDestination,
37
37
  withRoutingContext,
38
38
  withTask
39
- } from "./chunk-WLBBPTI6.mjs";
39
+ } from "./chunk-GQKFYSJ5.mjs";
40
40
  import {
41
41
  CapturedTraceSnapshotSchema,
42
42
  EvalCaseExpectationSchema,
@@ -57,7 +57,7 @@ import {
57
57
  traceToolCalls,
58
58
  validateEvaluatorOutput,
59
59
  verifyPortableEvalArtifact
60
- } from "./chunk-UY6537WW.mjs";
60
+ } from "./chunk-X637VXF6.mjs";
61
61
  import {
62
62
  __commonJS,
63
63
  __toESM
@@ -11218,6 +11218,7 @@ var LocalEvalReplaySessionImpl = class {
11218
11218
  }
11219
11219
  const verdicts = await Promise.all(
11220
11220
  this.parents.map(async (parent) => {
11221
+ var _a2;
11221
11222
  const judgeStartedAt = Date.now();
11222
11223
  let verdict;
11223
11224
  try {
@@ -11225,6 +11226,9 @@ var LocalEvalReplaySessionImpl = class {
11225
11226
  parent.evaluator,
11226
11227
  await parent.evaluator.judge({
11227
11228
  trace: pair.candidate.trace,
11229
+ expectedOutput: pair.output,
11230
+ rowMetadata: row.properties,
11231
+ referenceTrace: (_a2 = pair.reference) == null ? void 0 : _a2.trace,
11228
11232
  case: pair,
11229
11233
  row,
11230
11234
  result
@@ -11516,12 +11520,16 @@ async function claimSuiteRun(client, runId, dataset, rowIds, queryUrl) {
11516
11520
  async function runLocalEvaluators(evaluators, evalCase, row, result) {
11517
11521
  await Promise.all(
11518
11522
  evaluators.map(async (state) => {
11523
+ var _a;
11519
11524
  const startedAt = Date.now();
11520
11525
  try {
11521
11526
  const verdict = parseLocalVerdict(
11522
11527
  state.evaluator,
11523
11528
  await state.evaluator.judge({
11524
11529
  trace: evalCase.candidate.trace,
11530
+ expectedOutput: evalCase.output,
11531
+ rowMetadata: row.properties,
11532
+ referenceTrace: (_a = evalCase.reference) == null ? void 0 : _a.trace,
11525
11533
  row,
11526
11534
  result,
11527
11535
  case: evalCase
@@ -12428,7 +12436,7 @@ async function readEvaluator(client, slug, options = {}) {
12428
12436
  slug: data.slug,
12429
12437
  name: data.name,
12430
12438
  output: data.outputType,
12431
- scope: "batch",
12439
+ scope: "trace",
12432
12440
  executionMode: data.kind,
12433
12441
  source: data.programSource,
12434
12442
  description: data.description,
@@ -13173,7 +13181,7 @@ function replayEvaluator(entry) {
13173
13181
  slug: evaluator.slug,
13174
13182
  name: evaluator.name,
13175
13183
  output: evaluator.output,
13176
- judge: ({ trace: trace2, row, result, case: pair }) => evaluator.judge({ trace: trace2, row, result, reference: pair == null ? void 0 : pair.reference }),
13184
+ judge: ({ case: pair, ...context2 }) => evaluator.judge({ ...context2, reference: pair == null ? void 0 : pair.reference }),
13177
13185
  requiresReference: evaluator.requiresReference
13178
13186
  };
13179
13187
  case "score":
@@ -13181,7 +13189,7 @@ function replayEvaluator(entry) {
13181
13189
  slug: evaluator.slug,
13182
13190
  name: evaluator.name,
13183
13191
  output: evaluator.output,
13184
- judge: ({ trace: trace2, row, result, case: pair }) => evaluator.judge({ trace: trace2, row, result, reference: pair == null ? void 0 : pair.reference }),
13192
+ judge: ({ case: pair, ...context2 }) => evaluator.judge({ ...context2, reference: pair == null ? void 0 : pair.reference }),
13185
13193
  requiresReference: evaluator.requiresReference
13186
13194
  };
13187
13195
  case "number":
@@ -13189,7 +13197,7 @@ function replayEvaluator(entry) {
13189
13197
  slug: evaluator.slug,
13190
13198
  name: evaluator.name,
13191
13199
  output: evaluator.output,
13192
- judge: ({ trace: trace2, row, result, case: pair }) => evaluator.judge({ trace: trace2, row, result, reference: pair == null ? void 0 : pair.reference }),
13200
+ judge: ({ case: pair, ...context2 }) => evaluator.judge({ ...context2, reference: pair == null ? void 0 : pair.reference }),
13193
13201
  requiresReference: evaluator.requiresReference
13194
13202
  };
13195
13203
  }
@@ -27,14 +27,58 @@ var EvalSuiteManifestSchema = z.object({
27
27
 
28
28
  // src/evals/generated/trace.ts
29
29
  import z2 from "zod";
30
- var JsonValueSchema = z2.lazy(() => z2.union([
31
- z2.string(),
32
- z2.number(),
33
- z2.boolean(),
34
- z2.null(),
35
- z2.array(JsonValueSchema),
36
- z2.record(JsonValueSchema)
37
- ]));
30
+ function jsonTreeKind(value, ancestors) {
31
+ switch (typeof value) {
32
+ case "string":
33
+ case "boolean":
34
+ return "plain";
35
+ case "number":
36
+ return Number.isNaN(value) ? "other" : "plain";
37
+ case "object":
38
+ break;
39
+ default:
40
+ return "other";
41
+ }
42
+ if (value === null)
43
+ return "plain";
44
+ if (ancestors.has(value))
45
+ return "cycle";
46
+ const prototype = Object.getPrototypeOf(value);
47
+ const children = Array.isArray(value) ? prototype === Array.prototype && Object.keys(value).length === value.length ? value : null : (prototype === Object.prototype || prototype === null) && !Object.hasOwn(value, "__proto__") ? Object.values(value) : null;
48
+ if (children === null)
49
+ return "other";
50
+ ancestors.add(value);
51
+ let kind = "plain";
52
+ for (const child of children) {
53
+ kind = jsonTreeKind(child, ancestors);
54
+ if (kind !== "plain")
55
+ break;
56
+ }
57
+ ancestors.delete(value);
58
+ return kind;
59
+ }
60
+ var JsonValueLazySchema = class extends z2.ZodLazy {
61
+ _parse(input) {
62
+ const kind = jsonTreeKind(input.data, /* @__PURE__ */ new Set());
63
+ if (kind === "plain")
64
+ return z2.OK(input.data);
65
+ if (kind === "other")
66
+ return super._parse(input);
67
+ z2.addIssueToContext(this._getOrReturnCtx(input), { code: z2.ZodIssueCode.custom, message: "JSON values cannot contain cycles" });
68
+ return z2.INVALID;
69
+ }
70
+ };
71
+ var JsonValueSchema = new JsonValueLazySchema({
72
+ typeName: z2.ZodFirstPartyTypeKind.ZodLazy,
73
+ getter: () => z2.union([
74
+ z2.string(),
75
+ z2.number(),
76
+ z2.boolean(),
77
+ z2.null(),
78
+ z2.array(JsonValueSchema),
79
+ z2.record(JsonValueSchema)
80
+ ])
81
+ });
38
82
  var stringToJSONSchema = z2.string().transform((str, ctx) => {
39
83
  try {
40
84
  return JSON.parse(str);
@@ -415,6 +459,12 @@ var TraceSchema = z2.object({
415
459
  entries: z2.array(RichInteractionEntrySchema),
416
460
  caseContext: z2.object({ caseId: EvalDatasetCaseIdSchema, expectation: EvalCaseExpectationSchema.optional() }).optional()
417
461
  });
462
+ var EvalContextSchema = z2.object({
463
+ trace: TraceSchema,
464
+ expectedOutput: JsonValueSchema.optional(),
465
+ referenceTrace: TraceSchema.optional(),
466
+ rowMetadata: z2.record(z2.string(), z2.string())
467
+ });
418
468
  var CapturedTraceSpanSchema = ReplayTraceSnapshotSpanSchema;
419
469
  var EVAL_DATASET_MAX_SPANS_PER_TRACE = 500;
420
470
  var CapturedTraceSnapshotSchema = z2.object({
@@ -511,6 +561,7 @@ var EvalCaseTraceSchema = z2.object({
511
561
  var EvalCaseTracePairSchema = z2.object({
512
562
  caseId: EvalDatasetCaseIdSchema,
513
563
  output: JsonValueSchema.optional(),
564
+ rowMetadata: z2.record(z2.string(), z2.string()).optional(),
514
565
  candidate: EvalCaseTraceSchema.extend({
515
566
  trace: TraceSchema.extend({ origin: z2.enum(["replay", "dataset"]) })
516
567
  }),
@@ -778,6 +829,9 @@ function traceStepsToEntries(steps) {
778
829
  function projectWorkshopTrace(input) {
779
830
  return createTrace(input.origin, input.event, traceStepsToEntries(buildTraceSteps([...input.spans], { includePayloads: true })).map(boundEvalEntry));
780
831
  }
832
+ function formatTrace(trace) {
833
+ return JSON.stringify(trace);
834
+ }
781
835
  function traceOutput(trace) {
782
836
  var _a;
783
837
  return (_a = trace.event.aiData.output) != null ? _a : null;
@@ -785,7 +839,7 @@ function traceOutput(trace) {
785
839
  function traceToolCalls(trace, name) {
786
840
  return trace.entries.filter((entry) => entry.type === "tool_call" && (name === void 0 || entry.name === name));
787
841
  }
788
- var TRACE_PROJECTION_SHA256 = "22c666c6ace47d74d3f7dc477e68b27547257b319ba4014a4a32fbf977baac72";
842
+ var TRACE_PROJECTION_SHA256 = "243e395493cfac6358d104d6be52e35bf739a0192aed2367fa780b2119f0721c";
789
843
 
790
844
  // src/evals/definition.ts
791
845
  import { createHash } from "crypto";
@@ -816,7 +870,7 @@ function defineDataset(dataset) {
816
870
  id: parsed.id,
817
871
  name: (_a2 = parsed.name) != null ? _a2 : parsed.id,
818
872
  input: parsed.input,
819
- output: parsed.output,
873
+ output: structuredClone(parsed.output),
820
874
  properties: parsed.properties
821
875
  };
822
876
  });
@@ -892,7 +946,7 @@ function defineEvaluatorProgram(program) {
892
946
  return {
893
947
  ...program,
894
948
  kind: "program",
895
- scope: z3.literal("batch").parse((_c = program.scope) != null ? _c : "batch"),
949
+ scope: z3.literal("trace").parse((_c = program.scope) != null ? _c : "trace"),
896
950
  slug,
897
951
  name,
898
952
  source,
@@ -1057,20 +1111,29 @@ import { z as z4 } from "zod";
1057
1111
  var PortableEvalArtifactSchema = z4.object({
1058
1112
  format: z4.literal("raindrop.eval-program"),
1059
1113
  formatVersion: z4.literal(1),
1060
- runtimeAbi: z4.literal("raindrop-eval-v2"),
1114
+ runtimeAbi: z4.literal("raindrop-eval-v3"),
1061
1115
  evaluator: z4.object({
1062
1116
  id: z4.string().uuid(),
1063
1117
  slug: z4.string().min(1),
1064
1118
  programVersion: z4.number().int().positive(),
1065
1119
  executionMode: z4.enum(["deterministic", "judge"]),
1066
1120
  outputType: z4.enum(["boolean", "score", "number"]),
1067
- scope: z4.literal("batch")
1121
+ scope: z4.literal("trace")
1068
1122
  }).strict(),
1069
1123
  traceProjectionVersion: z4.literal(1),
1070
1124
  traceProjectionSha256: z4.string().regex(/^[a-f0-9]{64}$/),
1071
1125
  source: z4.string().min(1),
1072
1126
  sha256: z4.string().regex(/^[a-f0-9]{64}$/)
1073
1127
  }).strict();
1128
+ var PortableEvalLimitsSchema = z4.object({
1129
+ memoryBytes: z4.number().int().positive().optional(),
1130
+ stackBytes: z4.number().int().positive().optional(),
1131
+ timeoutMs: z4.number().int().positive().max(2147483647).optional(),
1132
+ maxInputBytes: z4.number().int().positive().optional(),
1133
+ maxOutputBytes: z4.number().int().positive().optional(),
1134
+ judgeTimeoutMs: z4.number().int().positive().max(2147483647).optional(),
1135
+ judgeConcurrency: z4.number().int().positive().optional()
1136
+ }).readonly();
1074
1137
  var PortableEvalResultSchema = z4.object({
1075
1138
  outcomes: z4.array(
1076
1139
  z4.union([
@@ -1126,7 +1189,7 @@ function importPortableEvaluator(rawArtifact, options = {}) {
1126
1189
  artifact,
1127
1190
  expectedSha256: options.expectedSha256,
1128
1191
  judge: options.judge,
1129
- limits: options.limits,
1192
+ limits: options.limits === void 0 ? void 0 : PortableEvalLimitsSchema.parse(options.limits),
1130
1193
  slug: artifact.evaluator.slug,
1131
1194
  name: ((_a = options.name) == null ? void 0 : _a.trim()) || artifact.evaluator.slug,
1132
1195
  output: artifact.evaluator.outputType,
@@ -1138,7 +1201,10 @@ async function evaluatePortableEvaluator(evaluator, input) {
1138
1201
  const artifact = await verifyPortableEvalArtifact(evaluator.artifact, {
1139
1202
  expectedSha256: evaluator.expectedSha256
1140
1203
  });
1141
- const { runPortableEvaluator } = await import("./portable-runtime-F7W4STGH.mjs");
1204
+ if (new Set(input.traces.map((trace) => trace.event.id)).size !== input.traces.length) {
1205
+ throw new Error("Raindrop portable evaluator input trace ids must be unique");
1206
+ }
1207
+ const { runPortableEvaluator } = await import("./portable-runtime-IIFK7U5Q.mjs");
1142
1208
  const cases = ((_a = input.rows) != null ? _a : []).map(({ rowId, ...pair }) => ({ ...pair, caseId: rowId }));
1143
1209
  if (cases.length > 0 && (cases.length !== input.traces.length || cases.some(
1144
1210
  (entry, index) => {
@@ -1178,9 +1244,6 @@ function validatePortableResult(artifact, traces, result) {
1178
1244
  throw new Error("Raindrop portable evaluator returned an inconsistent trace count");
1179
1245
  }
1180
1246
  const expected = new Set(traces.map((trace) => trace.event.id));
1181
- if (expected.size !== traces.length) {
1182
- throw new Error("Raindrop portable evaluator input trace ids must be unique");
1183
- }
1184
1247
  const returned = /* @__PURE__ */ new Set();
1185
1248
  for (const outcome of result.outcomes) {
1186
1249
  if (!expected.has(outcome.traceId)) {
@@ -1225,9 +1288,11 @@ export {
1225
1288
  EvalDatasetCaseIdSchema,
1226
1289
  EvalCaseExpectationSchema,
1227
1290
  TraceSchema,
1291
+ EvalContextSchema,
1228
1292
  CapturedTraceSnapshotSchema,
1229
1293
  EvalCaseTracePairSchema,
1230
1294
  projectWorkshopTrace,
1295
+ formatTrace,
1231
1296
  traceOutput,
1232
1297
  traceToolCalls,
1233
1298
  EvalScoreSchema,
@@ -1241,6 +1306,7 @@ export {
1241
1306
  evaluatorName,
1242
1307
  evaluatorOutput,
1243
1308
  validateEvaluatorOutput,
1309
+ PortableEvalLimitsSchema,
1244
1310
  parsePortableEvalResult,
1245
1311
  importPortableEvaluator,
1246
1312
  evaluatePortableEvaluator,
package/dist/evals/cli.js CHANGED
@@ -5795,6 +5795,36 @@ var init_manifest = __esm({
5795
5795
  });
5796
5796
 
5797
5797
  // src/evals/generated/trace.ts
5798
+ function jsonTreeKind(value, ancestors) {
5799
+ switch (typeof value) {
5800
+ case "string":
5801
+ case "boolean":
5802
+ return "plain";
5803
+ case "number":
5804
+ return Number.isNaN(value) ? "other" : "plain";
5805
+ case "object":
5806
+ break;
5807
+ default:
5808
+ return "other";
5809
+ }
5810
+ if (value === null)
5811
+ return "plain";
5812
+ if (ancestors.has(value))
5813
+ return "cycle";
5814
+ const prototype = Object.getPrototypeOf(value);
5815
+ const children = Array.isArray(value) ? prototype === Array.prototype && Object.keys(value).length === value.length ? value : null : (prototype === Object.prototype || prototype === null) && !Object.hasOwn(value, "__proto__") ? Object.values(value) : null;
5816
+ if (children === null)
5817
+ return "other";
5818
+ ancestors.add(value);
5819
+ let kind = "plain";
5820
+ for (const child of children) {
5821
+ kind = jsonTreeKind(child, ancestors);
5822
+ if (kind !== "plain")
5823
+ break;
5824
+ }
5825
+ ancestors.delete(value);
5826
+ return kind;
5827
+ }
5798
5828
  function traceOutput(trace8) {
5799
5829
  var _a;
5800
5830
  return (_a = trace8.event.aiData.output) != null ? _a : null;
@@ -5802,19 +5832,33 @@ function traceOutput(trace8) {
5802
5832
  function traceToolCalls(trace8, name) {
5803
5833
  return trace8.entries.filter((entry) => entry.type === "tool_call" && (name === void 0 || entry.name === name));
5804
5834
  }
5805
- var import_zod3, JsonValueSchema, stringToJSONSchema, SignalPropertiesSchema, AIEventMetadataSchema, AnalyticsEventSchema, LensInfoSchema, AttachmentSchema2, SignalSchema, RichTextContentSchema, RichJsonContentSchema, RichMediaContentSchema, RichReferenceContentSchema, RichContentSchema, RichPayloadValueSchema, RichEntrySourceSchema, RichInteractionEntryBaseSchema, RichSystemEntrySchema, RichUserMessageEntrySchema, RichAssistantTextEntrySchema, RichReasoningEntrySchema, RichToolCallEntrySchema, RichUnknownSpanEntrySchema, RichSubAgentEntrySchema, RichDetachedSubAgentEntrySchema, RichAgentHandoffEntrySchema, RichInteractionEntrySchema, RichSpanSummarySchema, RichDiagnosticWarningSchema, RichInteractionStatsSchema, RichEventInteractionSchema, CoreEventSchema, AIAnalyticsEventSchema, SpanStatusSchema, SpanTypeSchema, TracesListPipe, UINT64_MAX, NANOSECONDS_PATTERN, NanosecondsStringSchema, ReplayTraceSnapshotSpanSchema, EvalDatasetCaseIdSchema, EvalCaseExpectationSchema, TraceSchema, CapturedTraceSpanSchema, EVAL_DATASET_MAX_SPANS_PER_TRACE, CapturedTraceSnapshotSchema, EvalCaseTraceSchema, EvalCaseTracePairSchema, MAX_EVAL_PAYLOAD_RAW_CHARS;
5835
+ var import_zod3, JsonValueLazySchema, JsonValueSchema, stringToJSONSchema, SignalPropertiesSchema, AIEventMetadataSchema, AnalyticsEventSchema, LensInfoSchema, AttachmentSchema2, SignalSchema, RichTextContentSchema, RichJsonContentSchema, RichMediaContentSchema, RichReferenceContentSchema, RichContentSchema, RichPayloadValueSchema, RichEntrySourceSchema, RichInteractionEntryBaseSchema, RichSystemEntrySchema, RichUserMessageEntrySchema, RichAssistantTextEntrySchema, RichReasoningEntrySchema, RichToolCallEntrySchema, RichUnknownSpanEntrySchema, RichSubAgentEntrySchema, RichDetachedSubAgentEntrySchema, RichAgentHandoffEntrySchema, RichInteractionEntrySchema, RichSpanSummarySchema, RichDiagnosticWarningSchema, RichInteractionStatsSchema, RichEventInteractionSchema, CoreEventSchema, AIAnalyticsEventSchema, SpanStatusSchema, SpanTypeSchema, TracesListPipe, UINT64_MAX, NANOSECONDS_PATTERN, NanosecondsStringSchema, ReplayTraceSnapshotSpanSchema, EvalDatasetCaseIdSchema, EvalCaseExpectationSchema, TraceSchema, EvalContextSchema, CapturedTraceSpanSchema, EVAL_DATASET_MAX_SPANS_PER_TRACE, CapturedTraceSnapshotSchema, EvalCaseTraceSchema, EvalCaseTracePairSchema, MAX_EVAL_PAYLOAD_RAW_CHARS;
5806
5836
  var init_trace = __esm({
5807
5837
  "src/evals/generated/trace.ts"() {
5808
5838
  "use strict";
5809
5839
  import_zod3 = __toESM(require("zod"));
5810
- JsonValueSchema = import_zod3.default.lazy(() => import_zod3.default.union([
5811
- import_zod3.default.string(),
5812
- import_zod3.default.number(),
5813
- import_zod3.default.boolean(),
5814
- import_zod3.default.null(),
5815
- import_zod3.default.array(JsonValueSchema),
5816
- import_zod3.default.record(JsonValueSchema)
5817
- ]));
5840
+ JsonValueLazySchema = class extends import_zod3.default.ZodLazy {
5841
+ _parse(input) {
5842
+ const kind = jsonTreeKind(input.data, /* @__PURE__ */ new Set());
5843
+ if (kind === "plain")
5844
+ return import_zod3.default.OK(input.data);
5845
+ if (kind === "other")
5846
+ return super._parse(input);
5847
+ import_zod3.default.addIssueToContext(this._getOrReturnCtx(input), { code: import_zod3.default.ZodIssueCode.custom, message: "JSON values cannot contain cycles" });
5848
+ return import_zod3.default.INVALID;
5849
+ }
5850
+ };
5851
+ JsonValueSchema = new JsonValueLazySchema({
5852
+ typeName: import_zod3.default.ZodFirstPartyTypeKind.ZodLazy,
5853
+ getter: () => import_zod3.default.union([
5854
+ import_zod3.default.string(),
5855
+ import_zod3.default.number(),
5856
+ import_zod3.default.boolean(),
5857
+ import_zod3.default.null(),
5858
+ import_zod3.default.array(JsonValueSchema),
5859
+ import_zod3.default.record(JsonValueSchema)
5860
+ ])
5861
+ });
5818
5862
  stringToJSONSchema = import_zod3.default.string().transform((str, ctx) => {
5819
5863
  try {
5820
5864
  return JSON.parse(str);
@@ -6195,6 +6239,12 @@ var init_trace = __esm({
6195
6239
  entries: import_zod3.default.array(RichInteractionEntrySchema),
6196
6240
  caseContext: import_zod3.default.object({ caseId: EvalDatasetCaseIdSchema, expectation: EvalCaseExpectationSchema.optional() }).optional()
6197
6241
  });
6242
+ EvalContextSchema = import_zod3.default.object({
6243
+ trace: TraceSchema,
6244
+ expectedOutput: JsonValueSchema.optional(),
6245
+ referenceTrace: TraceSchema.optional(),
6246
+ rowMetadata: import_zod3.default.record(import_zod3.default.string(), import_zod3.default.string())
6247
+ });
6198
6248
  CapturedTraceSpanSchema = ReplayTraceSnapshotSpanSchema;
6199
6249
  EVAL_DATASET_MAX_SPANS_PER_TRACE = 500;
6200
6250
  CapturedTraceSnapshotSchema = import_zod3.default.object({
@@ -6291,6 +6341,7 @@ var init_trace = __esm({
6291
6341
  EvalCaseTracePairSchema = import_zod3.default.object({
6292
6342
  caseId: EvalDatasetCaseIdSchema,
6293
6343
  output: JsonValueSchema.optional(),
6344
+ rowMetadata: import_zod3.default.record(import_zod3.default.string(), import_zod3.default.string()).optional(),
6294
6345
  candidate: EvalCaseTraceSchema.extend({
6295
6346
  trace: TraceSchema.extend({ origin: import_zod3.default.enum(["replay", "dataset"]) })
6296
6347
  }),
@@ -6314,7 +6365,7 @@ function defineDataset(dataset) {
6314
6365
  id: parsed.id,
6315
6366
  name: (_a2 = parsed.name) != null ? _a2 : parsed.id,
6316
6367
  input: parsed.input,
6317
- output: parsed.output,
6368
+ output: structuredClone(parsed.output),
6318
6369
  properties: parsed.properties
6319
6370
  };
6320
6371
  });
@@ -6389,7 +6440,7 @@ function defineEvaluatorProgram(program) {
6389
6440
  return {
6390
6441
  ...program,
6391
6442
  kind: "program",
6392
- scope: import_zod4.z.literal("batch").parse((_c = program.scope) != null ? _c : "batch"),
6443
+ scope: import_zod4.z.literal("trace").parse((_c = program.scope) != null ? _c : "trace"),
6393
6444
  slug,
6394
6445
  name,
6395
6446
  source,
@@ -6573,7 +6624,7 @@ var init_definition = __esm({
6573
6624
  });
6574
6625
 
6575
6626
  // src/evals/portable.ts
6576
- var import_zod10, PortableEvalArtifactSchema, PortableEvalResultSchema;
6627
+ var import_zod10, PortableEvalArtifactSchema, PortableEvalLimitsSchema, PortableEvalResultSchema;
6577
6628
  var init_portable = __esm({
6578
6629
  "src/evals/portable.ts"() {
6579
6630
  "use strict";
@@ -6583,20 +6634,29 @@ var init_portable = __esm({
6583
6634
  PortableEvalArtifactSchema = import_zod10.z.object({
6584
6635
  format: import_zod10.z.literal("raindrop.eval-program"),
6585
6636
  formatVersion: import_zod10.z.literal(1),
6586
- runtimeAbi: import_zod10.z.literal("raindrop-eval-v2"),
6637
+ runtimeAbi: import_zod10.z.literal("raindrop-eval-v3"),
6587
6638
  evaluator: import_zod10.z.object({
6588
6639
  id: import_zod10.z.string().uuid(),
6589
6640
  slug: import_zod10.z.string().min(1),
6590
6641
  programVersion: import_zod10.z.number().int().positive(),
6591
6642
  executionMode: import_zod10.z.enum(["deterministic", "judge"]),
6592
6643
  outputType: import_zod10.z.enum(["boolean", "score", "number"]),
6593
- scope: import_zod10.z.literal("batch")
6644
+ scope: import_zod10.z.literal("trace")
6594
6645
  }).strict(),
6595
6646
  traceProjectionVersion: import_zod10.z.literal(1),
6596
6647
  traceProjectionSha256: import_zod10.z.string().regex(/^[a-f0-9]{64}$/),
6597
6648
  source: import_zod10.z.string().min(1),
6598
6649
  sha256: import_zod10.z.string().regex(/^[a-f0-9]{64}$/)
6599
6650
  }).strict();
6651
+ PortableEvalLimitsSchema = import_zod10.z.object({
6652
+ memoryBytes: import_zod10.z.number().int().positive().optional(),
6653
+ stackBytes: import_zod10.z.number().int().positive().optional(),
6654
+ timeoutMs: import_zod10.z.number().int().positive().max(2147483647).optional(),
6655
+ maxInputBytes: import_zod10.z.number().int().positive().optional(),
6656
+ maxOutputBytes: import_zod10.z.number().int().positive().optional(),
6657
+ judgeTimeoutMs: import_zod10.z.number().int().positive().max(2147483647).optional(),
6658
+ judgeConcurrency: import_zod10.z.number().int().positive().optional()
6659
+ }).readonly();
6600
6660
  PortableEvalResultSchema = import_zod10.z.object({
6601
6661
  outcomes: import_zod10.z.array(
6602
6662
  import_zod10.z.union([
@@ -12545,7 +12605,7 @@ var SignalEventSchema = external_exports.object({
12545
12605
  // package.json
12546
12606
  var package_default = {
12547
12607
  name: "raindrop-ai",
12548
- version: "0.9.1",
12608
+ version: "1.0.0",
12549
12609
  main: "dist/index.js",
12550
12610
  module: "dist/index.mjs",
12551
12611
  types: "dist/index.d.ts",
@@ -12612,8 +12672,8 @@ var package_default = {
12612
12672
  tsup: "^8.4.0",
12613
12673
  tsx: "^4.20.3",
12614
12674
  typescript: "^5.3.3",
12615
- vite: "^7.3.2",
12616
- vitest: "^4.0.10"
12675
+ vite: "^7.3.5",
12676
+ vitest: "^4.1.11"
12617
12677
  },
12618
12678
  dependencies: {
12619
12679
  "@jitl/quickjs-singlefile-cjs-release-sync": "0.32.0",
@@ -17701,6 +17761,7 @@ var LocalEvalReplaySessionImpl = class {
17701
17761
  }
17702
17762
  const verdicts = await Promise.all(
17703
17763
  this.parents.map(async (parent) => {
17764
+ var _a2;
17704
17765
  const judgeStartedAt = Date.now();
17705
17766
  let verdict;
17706
17767
  try {
@@ -17708,6 +17769,9 @@ var LocalEvalReplaySessionImpl = class {
17708
17769
  parent.evaluator,
17709
17770
  await parent.evaluator.judge({
17710
17771
  trace: pair.candidate.trace,
17772
+ expectedOutput: pair.output,
17773
+ rowMetadata: row.properties,
17774
+ referenceTrace: (_a2 = pair.reference) == null ? void 0 : _a2.trace,
17711
17775
  case: pair,
17712
17776
  row,
17713
17777
  result
@@ -17999,12 +18063,16 @@ async function claimSuiteRun(client, runId, dataset, rowIds, queryUrl) {
17999
18063
  async function runLocalEvaluators(evaluators, evalCase, row, result) {
18000
18064
  await Promise.all(
18001
18065
  evaluators.map(async (state2) => {
18066
+ var _a;
18002
18067
  const startedAt = Date.now();
18003
18068
  try {
18004
18069
  const verdict = parseLocalVerdict(
18005
18070
  state2.evaluator,
18006
18071
  await state2.evaluator.judge({
18007
18072
  trace: evalCase.candidate.trace,
18073
+ expectedOutput: evalCase.output,
18074
+ rowMetadata: row.properties,
18075
+ referenceTrace: (_a = evalCase.reference) == null ? void 0 : _a.trace,
18008
18076
  row,
18009
18077
  result,
18010
18078
  case: evalCase
@@ -18691,7 +18759,7 @@ async function readEvaluator(client, slug, options = {}) {
18691
18759
  slug: data.slug,
18692
18760
  name: data.name,
18693
18761
  output: data.outputType,
18694
- scope: "batch",
18762
+ scope: "trace",
18695
18763
  executionMode: data.kind,
18696
18764
  source: data.programSource,
18697
18765
  description: data.description,
@@ -19283,7 +19351,7 @@ function replayEvaluator(entry) {
19283
19351
  slug: evaluator.slug,
19284
19352
  name: evaluator.name,
19285
19353
  output: evaluator.output,
19286
- judge: ({ trace: trace8, row, result, case: pair }) => evaluator.judge({ trace: trace8, row, result, reference: pair == null ? void 0 : pair.reference }),
19354
+ judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
19287
19355
  requiresReference: evaluator.requiresReference
19288
19356
  };
19289
19357
  case "score":
@@ -19291,7 +19359,7 @@ function replayEvaluator(entry) {
19291
19359
  slug: evaluator.slug,
19292
19360
  name: evaluator.name,
19293
19361
  output: evaluator.output,
19294
- judge: ({ trace: trace8, row, result, case: pair }) => evaluator.judge({ trace: trace8, row, result, reference: pair == null ? void 0 : pair.reference }),
19362
+ judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
19295
19363
  requiresReference: evaluator.requiresReference
19296
19364
  };
19297
19365
  case "number":
@@ -19299,7 +19367,7 @@ function replayEvaluator(entry) {
19299
19367
  slug: evaluator.slug,
19300
19368
  name: evaluator.name,
19301
19369
  output: evaluator.output,
19302
- judge: ({ trace: trace8, row, result, case: pair }) => evaluator.judge({ trace: trace8, row, result, reference: pair == null ? void 0 : pair.reference }),
19370
+ judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
19303
19371
  requiresReference: evaluator.requiresReference
19304
19372
  };
19305
19373
  }
@@ -5,11 +5,11 @@ import {
5
5
  publishEvalSuite,
6
6
  readEvaluator,
7
7
  runEvalSuite
8
- } from "../chunk-SUW3YBV3.mjs";
9
- import "../chunk-WLBBPTI6.mjs";
8
+ } from "../chunk-MVJNJ4TS.mjs";
9
+ import "../chunk-GQKFYSJ5.mjs";
10
10
  import {
11
11
  isEvalSuiteDefinition
12
- } from "../chunk-UY6537WW.mjs";
12
+ } from "../chunk-X637VXF6.mjs";
13
13
  import "../chunk-UJCSKKID.mjs";
14
14
 
15
15
  // src/evals/cli.ts