raindrop-ai 0.5.0 → 0.6.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/README.md CHANGED
@@ -67,6 +67,41 @@ On runtimes that lack a usable `AsyncLocalStorage.enterWith` (notably Cloudflare
67
67
 
68
68
  ## Eval mode
69
69
 
70
+ Run your agent locally and store eval results in hosted Raindrop. Workshop is not required. Define a reusable suite with `defineEvalSuite`, then run it with `runEvalSuite` or the `@raindrop-ai/vitest` adapter. Input-only datasets require the SDK release with optional-reference support and the matching Raindrop backend.
71
+
72
+ ```ts
73
+ import Raindrop, { defineEvalSuite, runEvalSuite } from "raindrop-ai";
74
+ import { supportAgent } from "./support-agent";
75
+
76
+ const client = new Raindrop({
77
+ apiKey: process.env.RAINDROP_QUERY_API_KEY,
78
+ projectId: process.env.RAINDROP_PROJECT_ID,
79
+ localWorkshopUrl: false,
80
+ });
81
+
82
+ const suite = defineEvalSuite({
83
+ name: "Support responses",
84
+ dataset: "support-cases",
85
+ run: ({ input }) => supportAgent(input ?? ""),
86
+ evaluators: [{ evaluator: "task-completed", threshold: { equals: true } }],
87
+ });
88
+
89
+ try {
90
+ const result = await runEvalSuite(client, suite, {
91
+ destination: { kind: "raindrop" },
92
+ });
93
+ console.log(result);
94
+ } finally {
95
+ await client.close();
96
+ }
97
+ ```
98
+
99
+ The dataset string names a published, project-scoped eval dataset, not an ordinary custom-upload dataset ID. Publish its immutable version with `publishEvalDataset`. Cases can contain only input and scenario properties; an optional reference must be a complete captured trace. Local evaluators can declare `requiresReference: true`, and hosted programs can export `const requiresReference = true`, to reject missing references before agent execution. A local `defineDataset` object does not publish itself and is not accepted by the hosted runner. See the [Vitest guide](../vitest/README.md) for publication, evaluator requirements, and credential setup.
100
+
101
+ The Query SDK organization `apiKey` authenticates evals, dataset publication/reads, and replay trace uploads. Browser login and production `writeKey` credentials do not replace it. The agent's model credentials and test environment are separate. Running locally describes where your callback executes, not where results are stored.
102
+
103
+ ### Trace correlation
104
+
70
105
  A replay calls your agent once per row and needs every span and event that call
71
106
  emits to land on that row. `withEvalScope` binds one opaque **correlation id**
72
107
  to the execution context, so it does, with no change to the agent:
@@ -115,9 +150,9 @@ Both limits are demonstrated by tests in `packages/core/src/eval-scope.test.ts`.
115
150
 
116
151
  ### Replaying a dataset
117
152
 
118
- `replay` is the loop that uses the scope. It asks Raindrop for the dataset's
119
- rows, calls your agent once per row inside that row's scope, says which rows
120
- failed, and waits for the traces to land:
153
+ `replay` is the lower-level loop used by hosted suite execution. It reads the
154
+ published dataset's immutable version, calls your agent once per row inside
155
+ that row's scope, reports failed rows, and waits for the traces to land:
121
156
 
122
157
  ```ts
123
158
  import Raindrop, { replay } from "raindrop-ai";
@@ -707,7 +707,7 @@ var EvalCaseTracePairSchema = z2.object({
707
707
  }),
708
708
  reference: EvalCaseTraceSchema.extend({
709
709
  trace: TraceSchema.extend({ origin: z2.literal("dataset") })
710
- })
710
+ }).optional()
711
711
  });
712
712
  function compareNanoseconds(left, right) {
713
713
  if (Number.isFinite(left) && Number.isFinite(right))
@@ -1007,7 +1007,7 @@ function traceOutput(trace) {
1007
1007
  function traceToolCalls(trace, name) {
1008
1008
  return trace.entries.filter((entry) => entry.type === "tool_call" && (name === void 0 || entry.name === name));
1009
1009
  }
1010
- var TRACE_PROJECTION_SHA256 = "8dab83087aa2def3d076324021d5e08911e37967b68597b58b793a80d54b5874";
1010
+ var TRACE_PROJECTION_SHA256 = "7d12eb03150b8f203e4404622f047676f50b3aa1e5442f0ed42d77d6002a33a6";
1011
1011
 
1012
1012
  // src/evals/portable.ts
1013
1013
  import { z as z3 } from "zod";
@@ -1095,7 +1095,7 @@ async function evaluatePortableEvaluator(evaluator, input) {
1095
1095
  const artifact = await verifyPortableEvalArtifact(evaluator.artifact, {
1096
1096
  expectedSha256: evaluator.expectedSha256
1097
1097
  });
1098
- const { runPortableEvaluator } = await import("./portable-runtime-GBE3SHBZ.mjs");
1098
+ const { runPortableEvaluator } = await import("./portable-runtime-QZKU2VXS.mjs");
1099
1099
  const cases = (_a = input.cases) != null ? _a : [];
1100
1100
  if (cases.length > 0 && (cases.length !== input.traces.length || cases.some(
1101
1101
  (entry, index) => {
@@ -1238,7 +1238,7 @@ installTracingSuppressionHook();
1238
1238
  // package.json
1239
1239
  var package_default = {
1240
1240
  name: "raindrop-ai",
1241
- version: "0.5.0",
1241
+ version: "0.6.0",
1242
1242
  main: "dist/index.js",
1243
1243
  module: "dist/index.mjs",
1244
1244
  types: "dist/index.d.ts",
@@ -1082,7 +1082,7 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
1082
1082
  name: z.ZodString;
1083
1083
  input: z.ZodNullable<z.ZodString>;
1084
1084
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
1085
- referenceTrace: z.ZodEffects<z.ZodObject<{
1085
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
1086
1086
  event: z.ZodObject<{
1087
1087
  id: z.ZodString;
1088
1088
  _raindropDatabaseId: z.ZodString;
@@ -5470,13 +5470,13 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
5470
5470
  end_timestamp: string;
5471
5471
  _inserted_at: string;
5472
5472
  }[];
5473
- }>;
5473
+ }>>;
5474
5474
  }, "strict", z.ZodTypeAny, {
5475
5475
  properties: Record<string, string>;
5476
5476
  input: string | null;
5477
5477
  name: string;
5478
5478
  id: string;
5479
- referenceTrace: {
5479
+ referenceTrace?: {
5480
5480
  event: {
5481
5481
  properties: Record<string, unknown> | null;
5482
5482
  timestamp: string;
@@ -5873,13 +5873,13 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
5873
5873
  end_timestamp: string;
5874
5874
  _inserted_at: string;
5875
5875
  }[];
5876
- };
5876
+ } | undefined;
5877
5877
  }, {
5878
5878
  properties: Record<string, string>;
5879
5879
  input: string | null;
5880
5880
  name: string;
5881
5881
  id: string;
5882
- referenceTrace: {
5882
+ referenceTrace?: {
5883
5883
  event: {
5884
5884
  properties: Record<string, unknown> | null;
5885
5885
  timestamp: string;
@@ -6276,7 +6276,7 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
6276
6276
  end_timestamp: string;
6277
6277
  _inserted_at: string;
6278
6278
  }[];
6279
- };
6279
+ } | undefined;
6280
6280
  }>;
6281
6281
  type EvalDatasetCaseInput = z.infer<typeof EvalDatasetCaseInputSchema>;
6282
6282
  declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
@@ -6289,7 +6289,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
6289
6289
  name: z.ZodString;
6290
6290
  input: z.ZodNullable<z.ZodString>;
6291
6291
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
6292
- referenceTrace: z.ZodEffects<z.ZodObject<{
6292
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
6293
6293
  event: z.ZodObject<{
6294
6294
  id: z.ZodString;
6295
6295
  _raindropDatabaseId: z.ZodString;
@@ -10677,13 +10677,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
10677
10677
  end_timestamp: string;
10678
10678
  _inserted_at: string;
10679
10679
  }[];
10680
- }>;
10680
+ }>>;
10681
10681
  }, "strict", z.ZodTypeAny, {
10682
10682
  properties: Record<string, string>;
10683
10683
  input: string | null;
10684
10684
  name: string;
10685
10685
  id: string;
10686
- referenceTrace: {
10686
+ referenceTrace?: {
10687
10687
  event: {
10688
10688
  properties: Record<string, unknown> | null;
10689
10689
  timestamp: string;
@@ -11080,13 +11080,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11080
11080
  end_timestamp: string;
11081
11081
  _inserted_at: string;
11082
11082
  }[];
11083
- };
11083
+ } | undefined;
11084
11084
  }, {
11085
11085
  properties: Record<string, string>;
11086
11086
  input: string | null;
11087
11087
  name: string;
11088
11088
  id: string;
11089
- referenceTrace: {
11089
+ referenceTrace?: {
11090
11090
  event: {
11091
11091
  properties: Record<string, unknown> | null;
11092
11092
  timestamp: string;
@@ -11483,13 +11483,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11483
11483
  end_timestamp: string;
11484
11484
  _inserted_at: string;
11485
11485
  }[];
11486
- };
11486
+ } | undefined;
11487
11487
  }>, "many">, {
11488
11488
  properties: Record<string, string>;
11489
11489
  input: string | null;
11490
11490
  name: string;
11491
11491
  id: string;
11492
- referenceTrace: {
11492
+ referenceTrace?: {
11493
11493
  event: {
11494
11494
  properties: Record<string, unknown> | null;
11495
11495
  timestamp: string;
@@ -11886,13 +11886,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11886
11886
  end_timestamp: string;
11887
11887
  _inserted_at: string;
11888
11888
  }[];
11889
- };
11889
+ } | undefined;
11890
11890
  }[], {
11891
11891
  properties: Record<string, string>;
11892
11892
  input: string | null;
11893
11893
  name: string;
11894
11894
  id: string;
11895
- referenceTrace: {
11895
+ referenceTrace?: {
11896
11896
  event: {
11897
11897
  properties: Record<string, unknown> | null;
11898
11898
  timestamp: string;
@@ -12289,7 +12289,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12289
12289
  end_timestamp: string;
12290
12290
  _inserted_at: string;
12291
12291
  }[];
12292
- };
12292
+ } | undefined;
12293
12293
  }[]>;
12294
12294
  }, "strict", z.ZodTypeAny, {
12295
12295
  name: string;
@@ -12301,7 +12301,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12301
12301
  input: string | null;
12302
12302
  name: string;
12303
12303
  id: string;
12304
- referenceTrace: {
12304
+ referenceTrace?: {
12305
12305
  event: {
12306
12306
  properties: Record<string, unknown> | null;
12307
12307
  timestamp: string;
@@ -12698,7 +12698,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12698
12698
  end_timestamp: string;
12699
12699
  _inserted_at: string;
12700
12700
  }[];
12701
- };
12701
+ } | undefined;
12702
12702
  }[];
12703
12703
  }, {
12704
12704
  name: string;
@@ -12710,7 +12710,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12710
12710
  input: string | null;
12711
12711
  name: string;
12712
12712
  id: string;
12713
- referenceTrace: {
12713
+ referenceTrace?: {
12714
12714
  event: {
12715
12715
  properties: Record<string, unknown> | null;
12716
12716
  timestamp: string;
@@ -13107,7 +13107,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
13107
13107
  end_timestamp: string;
13108
13108
  _inserted_at: string;
13109
13109
  }[];
13110
- };
13110
+ } | undefined;
13111
13111
  }[];
13112
13112
  }>;
13113
13113
  type PublishEvalDatasetVersionInput = z.infer<typeof PublishEvalDatasetVersionInputSchema>;
@@ -13138,7 +13138,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
13138
13138
  name: z.ZodString;
13139
13139
  input: z.ZodNullable<z.ZodString>;
13140
13140
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
13141
- referenceTrace: z.ZodEffects<z.ZodObject<{
13141
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
13142
13142
  event: z.ZodObject<{
13143
13143
  id: z.ZodString;
13144
13144
  _raindropDatabaseId: z.ZodString;
@@ -17526,15 +17526,15 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
17526
17526
  end_timestamp: string;
17527
17527
  _inserted_at: string;
17528
17528
  }[];
17529
- }>;
17529
+ }>>;
17530
17530
  } & {
17531
- referenceTraceSha256: z.ZodString;
17531
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
17532
17532
  }, "strict", z.ZodTypeAny, {
17533
17533
  properties: Record<string, string>;
17534
17534
  input: string | null;
17535
17535
  name: string;
17536
17536
  id: string;
17537
- referenceTrace: {
17537
+ referenceTrace?: {
17538
17538
  event: {
17539
17539
  properties: Record<string, unknown> | null;
17540
17540
  timestamp: string;
@@ -17931,14 +17931,14 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
17931
17931
  end_timestamp: string;
17932
17932
  _inserted_at: string;
17933
17933
  }[];
17934
- };
17935
- referenceTraceSha256: string;
17934
+ } | undefined;
17935
+ referenceTraceSha256?: string | undefined;
17936
17936
  }, {
17937
17937
  properties: Record<string, string>;
17938
17938
  input: string | null;
17939
17939
  name: string;
17940
17940
  id: string;
17941
- referenceTrace: {
17941
+ referenceTrace?: {
17942
17942
  event: {
17943
17943
  properties: Record<string, unknown> | null;
17944
17944
  timestamp: string;
@@ -18335,8 +18335,8 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
18335
18335
  end_timestamp: string;
18336
18336
  _inserted_at: string;
18337
18337
  }[];
18338
- };
18339
- referenceTraceSha256: string;
18338
+ } | undefined;
18339
+ referenceTraceSha256?: string | undefined;
18340
18340
  }>, "many">;
18341
18341
  createdAt: z.ZodString;
18342
18342
  }, "cases">, "strip", z.ZodTypeAny, {
@@ -18357,7 +18357,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
18357
18357
  name: z.ZodString;
18358
18358
  input: z.ZodNullable<z.ZodString>;
18359
18359
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
18360
- referenceTrace: z.ZodEffects<z.ZodObject<{
18360
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
18361
18361
  event: z.ZodObject<{
18362
18362
  id: z.ZodString;
18363
18363
  _raindropDatabaseId: z.ZodString;
@@ -22745,23 +22745,23 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22745
22745
  end_timestamp: string;
22746
22746
  _inserted_at: string;
22747
22747
  }[];
22748
- }>;
22748
+ }>>;
22749
22749
  } & {
22750
- referenceTraceSha256: z.ZodString;
22750
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
22751
22751
  }, "properties" | "input" | "name" | "id"> & {
22752
- referenceTraceSha256: z.ZodString;
22752
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
22753
22753
  }, "strict", z.ZodTypeAny, {
22754
22754
  properties: Record<string, string>;
22755
22755
  input: string | null;
22756
22756
  name: string;
22757
22757
  id: string;
22758
- referenceTraceSha256: string;
22758
+ referenceTraceSha256?: string | undefined;
22759
22759
  }, {
22760
22760
  properties: Record<string, string>;
22761
22761
  input: string | null;
22762
22762
  name: string;
22763
22763
  id: string;
22764
- referenceTraceSha256: string;
22764
+ referenceTraceSha256?: string | undefined;
22765
22765
  }>, "many">;
22766
22766
  }, "strip", z.ZodTypeAny, {
22767
22767
  dataset: {
@@ -22775,7 +22775,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22775
22775
  input: string | null;
22776
22776
  name: string;
22777
22777
  id: string;
22778
- referenceTraceSha256: string;
22778
+ referenceTraceSha256?: string | undefined;
22779
22779
  }[];
22780
22780
  version: {
22781
22781
  id: string;
@@ -22796,7 +22796,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22796
22796
  input: string | null;
22797
22797
  name: string;
22798
22798
  id: string;
22799
- referenceTraceSha256: string;
22799
+ referenceTraceSha256?: string | undefined;
22800
22800
  }[];
22801
22801
  version: {
22802
22802
  id: string;
@@ -43264,7 +43264,7 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
43264
43264
  origin: "replay";
43265
43265
  };
43266
43266
  }>;
43267
- reference: z$1.ZodObject<{
43267
+ reference: z$1.ZodOptional<z$1.ZodObject<{
43268
43268
  snapshot: z$1.ZodEffects<z$1.ZodObject<{
43269
43269
  event: z$1.ZodObject<{
43270
43270
  id: z$1.ZodString;
@@ -54793,9 +54793,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
54793
54793
  })[];
54794
54794
  origin: "dataset";
54795
54795
  };
54796
- }>;
54796
+ }>>;
54797
54797
  }, "strip", z$1.ZodTypeAny, {
54798
- reference: {
54798
+ caseId: string;
54799
+ candidate: {
54799
54800
  snapshot: {
54800
54801
  event: {
54801
54802
  properties: Record<string, unknown> | null;
@@ -55818,11 +55819,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
55818
55819
  fromAgent: string;
55819
55820
  toAgent: string;
55820
55821
  })[];
55821
- origin: "dataset";
55822
+ origin: "replay";
55822
55823
  };
55823
55824
  };
55824
- caseId: string;
55825
- candidate: {
55825
+ reference?: {
55826
55826
  snapshot: {
55827
55827
  event: {
55828
55828
  properties: Record<string, unknown> | null;
@@ -56845,11 +56845,12 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
56845
56845
  fromAgent: string;
56846
56846
  toAgent: string;
56847
56847
  })[];
56848
- origin: "replay";
56848
+ origin: "dataset";
56849
56849
  };
56850
- };
56850
+ } | undefined;
56851
56851
  }, {
56852
- reference: {
56852
+ caseId: string;
56853
+ candidate: {
56853
56854
  snapshot: {
56854
56855
  event: {
56855
56856
  properties: Record<string, unknown> | null;
@@ -57872,11 +57873,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
57872
57873
  fromAgent: string;
57873
57874
  toAgent: string;
57874
57875
  })[];
57875
- origin: "dataset";
57876
+ origin: "replay";
57876
57877
  };
57877
57878
  };
57878
- caseId: string;
57879
- candidate: {
57879
+ reference?: {
57880
57880
  snapshot: {
57881
57881
  event: {
57882
57882
  properties: Record<string, unknown> | null;
@@ -58899,9 +58899,9 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
58899
58899
  fromAgent: string;
58900
58900
  toAgent: string;
58901
58901
  })[];
58902
- origin: "replay";
58902
+ origin: "dataset";
58903
58903
  };
58904
- };
58904
+ } | undefined;
58905
58905
  }>;
58906
58906
  type EvalCaseTracePair = z$1.infer<typeof EvalCaseTracePairSchema>;
58907
58907
  type TraceNanoseconds = number | string;
@@ -59769,6 +59769,8 @@ type LocalEvaluatorContext$1<AgentResult = unknown> = {
59769
59769
  type LocalJudge<AgentResult, Verdict> = (context: LocalEvaluatorContext$1<AgentResult>) => Verdict | Promise<Verdict>;
59770
59770
  /** A named evaluator whose implementation stays in the customer's process. */
59771
59771
  type LocalEvaluator<AgentResult = unknown> = {
59772
+ readonly requiresReference?: boolean;
59773
+ } & ({
59772
59774
  readonly slug: string;
59773
59775
  readonly name: string;
59774
59776
  readonly output: "boolean";
@@ -59783,7 +59785,7 @@ type LocalEvaluator<AgentResult = unknown> = {
59783
59785
  readonly name: string;
59784
59786
  readonly output: "number";
59785
59787
  readonly judge: LocalJudge<AgentResult, LocalNumberVerdict>;
59786
- };
59788
+ });
59787
59789
  type CreateReplayOptions = {
59788
59790
  /** A project-scoped dataset slug, or a manifest already pinned by discovery. */
59789
59791
  dataset: string | EvalDatasetManifest;
@@ -60113,6 +60115,8 @@ type LocalEvaluatorContext<AgentResult = unknown> = {
60113
60115
  readonly result: AgentResult;
60114
60116
  };
60115
60117
  type LocalEvaluatorBase<AgentResult, Output, Verdict> = {
60118
+ /** Reject input-only cases before the agent runs when this evaluator needs a baseline. */
60119
+ readonly requiresReference?: boolean;
60116
60120
  readonly slug: string;
60117
60121
  readonly name: string;
60118
60122
  readonly output: Output;
@@ -60176,7 +60180,7 @@ type PublishEvalDatasetOptions = {
60176
60180
  readonly slug: string;
60177
60181
  /** Display name. Publishing a new version does not rename an existing dataset. */
60178
60182
  readonly name: PublishEvalDatasetVersionInput["name"];
60179
- /** Ordered cases. Each reference is a complete captured trace snapshot. */
60183
+ /** Ordered scenarios. Supplied references must be complete captured trace snapshots. */
60180
60184
  readonly cases: readonly EvalDatasetCaseInput[];
60181
60185
  /** Omit or pass null to create. Pass the discovered current version when changing evidence. */
60182
60186
  readonly expectedCurrentVersionId?: string | null;
@@ -1082,7 +1082,7 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
1082
1082
  name: z.ZodString;
1083
1083
  input: z.ZodNullable<z.ZodString>;
1084
1084
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
1085
- referenceTrace: z.ZodEffects<z.ZodObject<{
1085
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
1086
1086
  event: z.ZodObject<{
1087
1087
  id: z.ZodString;
1088
1088
  _raindropDatabaseId: z.ZodString;
@@ -5470,13 +5470,13 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
5470
5470
  end_timestamp: string;
5471
5471
  _inserted_at: string;
5472
5472
  }[];
5473
- }>;
5473
+ }>>;
5474
5474
  }, "strict", z.ZodTypeAny, {
5475
5475
  properties: Record<string, string>;
5476
5476
  input: string | null;
5477
5477
  name: string;
5478
5478
  id: string;
5479
- referenceTrace: {
5479
+ referenceTrace?: {
5480
5480
  event: {
5481
5481
  properties: Record<string, unknown> | null;
5482
5482
  timestamp: string;
@@ -5873,13 +5873,13 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
5873
5873
  end_timestamp: string;
5874
5874
  _inserted_at: string;
5875
5875
  }[];
5876
- };
5876
+ } | undefined;
5877
5877
  }, {
5878
5878
  properties: Record<string, string>;
5879
5879
  input: string | null;
5880
5880
  name: string;
5881
5881
  id: string;
5882
- referenceTrace: {
5882
+ referenceTrace?: {
5883
5883
  event: {
5884
5884
  properties: Record<string, unknown> | null;
5885
5885
  timestamp: string;
@@ -6276,7 +6276,7 @@ declare const EvalDatasetCaseInputSchema: z.ZodObject<{
6276
6276
  end_timestamp: string;
6277
6277
  _inserted_at: string;
6278
6278
  }[];
6279
- };
6279
+ } | undefined;
6280
6280
  }>;
6281
6281
  type EvalDatasetCaseInput = z.infer<typeof EvalDatasetCaseInputSchema>;
6282
6282
  declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
@@ -6289,7 +6289,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
6289
6289
  name: z.ZodString;
6290
6290
  input: z.ZodNullable<z.ZodString>;
6291
6291
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
6292
- referenceTrace: z.ZodEffects<z.ZodObject<{
6292
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
6293
6293
  event: z.ZodObject<{
6294
6294
  id: z.ZodString;
6295
6295
  _raindropDatabaseId: z.ZodString;
@@ -10677,13 +10677,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
10677
10677
  end_timestamp: string;
10678
10678
  _inserted_at: string;
10679
10679
  }[];
10680
- }>;
10680
+ }>>;
10681
10681
  }, "strict", z.ZodTypeAny, {
10682
10682
  properties: Record<string, string>;
10683
10683
  input: string | null;
10684
10684
  name: string;
10685
10685
  id: string;
10686
- referenceTrace: {
10686
+ referenceTrace?: {
10687
10687
  event: {
10688
10688
  properties: Record<string, unknown> | null;
10689
10689
  timestamp: string;
@@ -11080,13 +11080,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11080
11080
  end_timestamp: string;
11081
11081
  _inserted_at: string;
11082
11082
  }[];
11083
- };
11083
+ } | undefined;
11084
11084
  }, {
11085
11085
  properties: Record<string, string>;
11086
11086
  input: string | null;
11087
11087
  name: string;
11088
11088
  id: string;
11089
- referenceTrace: {
11089
+ referenceTrace?: {
11090
11090
  event: {
11091
11091
  properties: Record<string, unknown> | null;
11092
11092
  timestamp: string;
@@ -11483,13 +11483,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11483
11483
  end_timestamp: string;
11484
11484
  _inserted_at: string;
11485
11485
  }[];
11486
- };
11486
+ } | undefined;
11487
11487
  }>, "many">, {
11488
11488
  properties: Record<string, string>;
11489
11489
  input: string | null;
11490
11490
  name: string;
11491
11491
  id: string;
11492
- referenceTrace: {
11492
+ referenceTrace?: {
11493
11493
  event: {
11494
11494
  properties: Record<string, unknown> | null;
11495
11495
  timestamp: string;
@@ -11886,13 +11886,13 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
11886
11886
  end_timestamp: string;
11887
11887
  _inserted_at: string;
11888
11888
  }[];
11889
- };
11889
+ } | undefined;
11890
11890
  }[], {
11891
11891
  properties: Record<string, string>;
11892
11892
  input: string | null;
11893
11893
  name: string;
11894
11894
  id: string;
11895
- referenceTrace: {
11895
+ referenceTrace?: {
11896
11896
  event: {
11897
11897
  properties: Record<string, unknown> | null;
11898
11898
  timestamp: string;
@@ -12289,7 +12289,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12289
12289
  end_timestamp: string;
12290
12290
  _inserted_at: string;
12291
12291
  }[];
12292
- };
12292
+ } | undefined;
12293
12293
  }[]>;
12294
12294
  }, "strict", z.ZodTypeAny, {
12295
12295
  name: string;
@@ -12301,7 +12301,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12301
12301
  input: string | null;
12302
12302
  name: string;
12303
12303
  id: string;
12304
- referenceTrace: {
12304
+ referenceTrace?: {
12305
12305
  event: {
12306
12306
  properties: Record<string, unknown> | null;
12307
12307
  timestamp: string;
@@ -12698,7 +12698,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12698
12698
  end_timestamp: string;
12699
12699
  _inserted_at: string;
12700
12700
  }[];
12701
- };
12701
+ } | undefined;
12702
12702
  }[];
12703
12703
  }, {
12704
12704
  name: string;
@@ -12710,7 +12710,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
12710
12710
  input: string | null;
12711
12711
  name: string;
12712
12712
  id: string;
12713
- referenceTrace: {
12713
+ referenceTrace?: {
12714
12714
  event: {
12715
12715
  properties: Record<string, unknown> | null;
12716
12716
  timestamp: string;
@@ -13107,7 +13107,7 @@ declare const PublishEvalDatasetVersionInputSchema: z.ZodObject<{
13107
13107
  end_timestamp: string;
13108
13108
  _inserted_at: string;
13109
13109
  }[];
13110
- };
13110
+ } | undefined;
13111
13111
  }[];
13112
13112
  }>;
13113
13113
  type PublishEvalDatasetVersionInput = z.infer<typeof PublishEvalDatasetVersionInputSchema>;
@@ -13138,7 +13138,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
13138
13138
  name: z.ZodString;
13139
13139
  input: z.ZodNullable<z.ZodString>;
13140
13140
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
13141
- referenceTrace: z.ZodEffects<z.ZodObject<{
13141
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
13142
13142
  event: z.ZodObject<{
13143
13143
  id: z.ZodString;
13144
13144
  _raindropDatabaseId: z.ZodString;
@@ -17526,15 +17526,15 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
17526
17526
  end_timestamp: string;
17527
17527
  _inserted_at: string;
17528
17528
  }[];
17529
- }>;
17529
+ }>>;
17530
17530
  } & {
17531
- referenceTraceSha256: z.ZodString;
17531
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
17532
17532
  }, "strict", z.ZodTypeAny, {
17533
17533
  properties: Record<string, string>;
17534
17534
  input: string | null;
17535
17535
  name: string;
17536
17536
  id: string;
17537
- referenceTrace: {
17537
+ referenceTrace?: {
17538
17538
  event: {
17539
17539
  properties: Record<string, unknown> | null;
17540
17540
  timestamp: string;
@@ -17931,14 +17931,14 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
17931
17931
  end_timestamp: string;
17932
17932
  _inserted_at: string;
17933
17933
  }[];
17934
- };
17935
- referenceTraceSha256: string;
17934
+ } | undefined;
17935
+ referenceTraceSha256?: string | undefined;
17936
17936
  }, {
17937
17937
  properties: Record<string, string>;
17938
17938
  input: string | null;
17939
17939
  name: string;
17940
17940
  id: string;
17941
- referenceTrace: {
17941
+ referenceTrace?: {
17942
17942
  event: {
17943
17943
  properties: Record<string, unknown> | null;
17944
17944
  timestamp: string;
@@ -18335,8 +18335,8 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
18335
18335
  end_timestamp: string;
18336
18336
  _inserted_at: string;
18337
18337
  }[];
18338
- };
18339
- referenceTraceSha256: string;
18338
+ } | undefined;
18339
+ referenceTraceSha256?: string | undefined;
18340
18340
  }>, "many">;
18341
18341
  createdAt: z.ZodString;
18342
18342
  }, "cases">, "strip", z.ZodTypeAny, {
@@ -18357,7 +18357,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
18357
18357
  name: z.ZodString;
18358
18358
  input: z.ZodNullable<z.ZodString>;
18359
18359
  properties: z.ZodRecord<z.ZodString, z.ZodString>;
18360
- referenceTrace: z.ZodEffects<z.ZodObject<{
18360
+ referenceTrace: z.ZodOptional<z.ZodEffects<z.ZodObject<{
18361
18361
  event: z.ZodObject<{
18362
18362
  id: z.ZodString;
18363
18363
  _raindropDatabaseId: z.ZodString;
@@ -22745,23 +22745,23 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22745
22745
  end_timestamp: string;
22746
22746
  _inserted_at: string;
22747
22747
  }[];
22748
- }>;
22748
+ }>>;
22749
22749
  } & {
22750
- referenceTraceSha256: z.ZodString;
22750
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
22751
22751
  }, "properties" | "input" | "name" | "id"> & {
22752
- referenceTraceSha256: z.ZodString;
22752
+ referenceTraceSha256: z.ZodOptional<z.ZodString>;
22753
22753
  }, "strict", z.ZodTypeAny, {
22754
22754
  properties: Record<string, string>;
22755
22755
  input: string | null;
22756
22756
  name: string;
22757
22757
  id: string;
22758
- referenceTraceSha256: string;
22758
+ referenceTraceSha256?: string | undefined;
22759
22759
  }, {
22760
22760
  properties: Record<string, string>;
22761
22761
  input: string | null;
22762
22762
  name: string;
22763
22763
  id: string;
22764
- referenceTraceSha256: string;
22764
+ referenceTraceSha256?: string | undefined;
22765
22765
  }>, "many">;
22766
22766
  }, "strip", z.ZodTypeAny, {
22767
22767
  dataset: {
@@ -22775,7 +22775,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22775
22775
  input: string | null;
22776
22776
  name: string;
22777
22777
  id: string;
22778
- referenceTraceSha256: string;
22778
+ referenceTraceSha256?: string | undefined;
22779
22779
  }[];
22780
22780
  version: {
22781
22781
  id: string;
@@ -22796,7 +22796,7 @@ declare const EvalDatasetManifestSchema: z.ZodObject<{
22796
22796
  input: string | null;
22797
22797
  name: string;
22798
22798
  id: string;
22799
- referenceTraceSha256: string;
22799
+ referenceTraceSha256?: string | undefined;
22800
22800
  }[];
22801
22801
  version: {
22802
22802
  id: string;
@@ -43264,7 +43264,7 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
43264
43264
  origin: "replay";
43265
43265
  };
43266
43266
  }>;
43267
- reference: z$1.ZodObject<{
43267
+ reference: z$1.ZodOptional<z$1.ZodObject<{
43268
43268
  snapshot: z$1.ZodEffects<z$1.ZodObject<{
43269
43269
  event: z$1.ZodObject<{
43270
43270
  id: z$1.ZodString;
@@ -54793,9 +54793,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
54793
54793
  })[];
54794
54794
  origin: "dataset";
54795
54795
  };
54796
- }>;
54796
+ }>>;
54797
54797
  }, "strip", z$1.ZodTypeAny, {
54798
- reference: {
54798
+ caseId: string;
54799
+ candidate: {
54799
54800
  snapshot: {
54800
54801
  event: {
54801
54802
  properties: Record<string, unknown> | null;
@@ -55818,11 +55819,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
55818
55819
  fromAgent: string;
55819
55820
  toAgent: string;
55820
55821
  })[];
55821
- origin: "dataset";
55822
+ origin: "replay";
55822
55823
  };
55823
55824
  };
55824
- caseId: string;
55825
- candidate: {
55825
+ reference?: {
55826
55826
  snapshot: {
55827
55827
  event: {
55828
55828
  properties: Record<string, unknown> | null;
@@ -56845,11 +56845,12 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
56845
56845
  fromAgent: string;
56846
56846
  toAgent: string;
56847
56847
  })[];
56848
- origin: "replay";
56848
+ origin: "dataset";
56849
56849
  };
56850
- };
56850
+ } | undefined;
56851
56851
  }, {
56852
- reference: {
56852
+ caseId: string;
56853
+ candidate: {
56853
56854
  snapshot: {
56854
56855
  event: {
56855
56856
  properties: Record<string, unknown> | null;
@@ -57872,11 +57873,10 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
57872
57873
  fromAgent: string;
57873
57874
  toAgent: string;
57874
57875
  })[];
57875
- origin: "dataset";
57876
+ origin: "replay";
57876
57877
  };
57877
57878
  };
57878
- caseId: string;
57879
- candidate: {
57879
+ reference?: {
57880
57880
  snapshot: {
57881
57881
  event: {
57882
57882
  properties: Record<string, unknown> | null;
@@ -58899,9 +58899,9 @@ declare const EvalCaseTracePairSchema: z$1.ZodObject<{
58899
58899
  fromAgent: string;
58900
58900
  toAgent: string;
58901
58901
  })[];
58902
- origin: "replay";
58902
+ origin: "dataset";
58903
58903
  };
58904
- };
58904
+ } | undefined;
58905
58905
  }>;
58906
58906
  type EvalCaseTracePair = z$1.infer<typeof EvalCaseTracePairSchema>;
58907
58907
  type TraceNanoseconds = number | string;
@@ -59769,6 +59769,8 @@ type LocalEvaluatorContext$1<AgentResult = unknown> = {
59769
59769
  type LocalJudge<AgentResult, Verdict> = (context: LocalEvaluatorContext$1<AgentResult>) => Verdict | Promise<Verdict>;
59770
59770
  /** A named evaluator whose implementation stays in the customer's process. */
59771
59771
  type LocalEvaluator<AgentResult = unknown> = {
59772
+ readonly requiresReference?: boolean;
59773
+ } & ({
59772
59774
  readonly slug: string;
59773
59775
  readonly name: string;
59774
59776
  readonly output: "boolean";
@@ -59783,7 +59785,7 @@ type LocalEvaluator<AgentResult = unknown> = {
59783
59785
  readonly name: string;
59784
59786
  readonly output: "number";
59785
59787
  readonly judge: LocalJudge<AgentResult, LocalNumberVerdict>;
59786
- };
59788
+ });
59787
59789
  type CreateReplayOptions = {
59788
59790
  /** A project-scoped dataset slug, or a manifest already pinned by discovery. */
59789
59791
  dataset: string | EvalDatasetManifest;
@@ -60113,6 +60115,8 @@ type LocalEvaluatorContext<AgentResult = unknown> = {
60113
60115
  readonly result: AgentResult;
60114
60116
  };
60115
60117
  type LocalEvaluatorBase<AgentResult, Output, Verdict> = {
60118
+ /** Reject input-only cases before the agent runs when this evaluator needs a baseline. */
60119
+ readonly requiresReference?: boolean;
60116
60120
  readonly slug: string;
60117
60121
  readonly name: string;
60118
60122
  readonly output: Output;
@@ -60176,7 +60180,7 @@ type PublishEvalDatasetOptions = {
60176
60180
  readonly slug: string;
60177
60181
  /** Display name. Publishing a new version does not rename an existing dataset. */
60178
60182
  readonly name: PublishEvalDatasetVersionInput["name"];
60179
- /** Ordered cases. Each reference is a complete captured trace snapshot. */
60183
+ /** Ordered scenarios. Supplied references must be complete captured trace snapshots. */
60180
60184
  readonly cases: readonly EvalDatasetCaseInput[];
60181
60185
  /** Omit or pass null to create. Pass the discovered current version when changing evidence. */
60182
60186
  readonly expectedCurrentVersionId?: string | null;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@opentelemetry/instrumentation';
2
- export { f as AiTrackEvent, A as AiTrackUsage, g as Attachment, h as AttachmentType, B as BeginInteractionOptions, i as BooleanThreshold, j as BooleanThresholdSchema, k as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, l as DEFAULT_EVAL_WAIT_MS, m as DEFAULT_QUERY_URL, n as DEFAULT_TRACE_WAIT_MS, o as DefinedEvalDataset, E as EvalCaseResult, p as EvalClient, q as EvalDataset, r as EvalDatasetCaseInput, s as EvalDatasetCaseInputSchema, t as EvalDatasetManifest, u as EvalDatasetPublishConflictError, v as EvalDestination, w as EvalEvaluator, x as EvalLocalEvaluator, y as EvalManifest, z as EvalProgram, F as EvalSuiteDefinition, G as EvalSuiteDefinitionInput, H as EvalSuiteResult, J as EvalSuiteRunSession, K as EvalVerdictAssessment, L as EvaluateReplayOptions, M as FinishInteractionOptions, N as HostedEvaluatorPin, O as IdentifyEvent, b as Interaction, Q as LocalBooleanVerdict, U as LocalBooleanVerdictSchema, V as LocalDebuggerLiveEventInput, W as LocalEvaluator, X as LocalEvaluatorContext, Y as LocalNumberVerdict, Z as LocalNumberVerdictSchema, _ as LocalScoreVerdict, $ as LocalScoreVerdictSchema, a0 as LocalVerdict, a1 as LocalVerdictSchema, a2 as MAX_EVAL_STATUS_RETRIES, a3 as MAX_INGEST_SIZE_BYTES, a4 as NumericThreshold, a5 as NumericThresholdSchema, P as PartialAiTrackEvent, a6 as PortableEvalArtifact, a7 as PortableEvalLimits, a8 as PortableEvalOutcome, a9 as PortableEvalResult, aa as PortableEvaluator, ab as PortableJudgeRequest, ac as PortableJudgeVerdict, ad as PublishEvalDatasetOptions, ae as PullEvalOptions, af as PulledEvalSnapshot, R as Raindrop, ag as RaindropConnection, ah as RaindropFeatureFlagValue, ai as RaindropFeatureFlags, aj as RaindropProperties, ak as RaindropPropertyLeaf, al as RaindropPropertyValue, a as RaindropSpanProcessor, am as ReplayClient, an as ReplayCounts, ao as ReplayCountsSchema, ap as ReplayEvaluator, aq as ReplayEvaluatorCounts, ar as ReplayEvaluatorCountsSchema, as as ReplayEvaluatorStats, at as ReplayEvaluatorStatsSchema, au as ReplayEvaluatorSummary, av as ReplayEvaluatorSummarySchema, aw as ReplayHandle, ax as ReplayLocalEvaluatorContext, ay as ReplayOptions, az as ReplayReading, aA as ReplayResult, aB as ReplayResultRow, aC as ReplayResultRowSchema, aD as ReplayRow, aE as ReplayRowOutcome, aF as ReplayVerdict, aG as ReplayVerdictSchema, aH as RunEvalSuiteOptions, aI as RunReplayOptions, aJ as SelfDiagnoseOptions, aK as SelfDiagnosticsExecuteContext, aL as SelfDiagnosticsExecuteResult, aM as SelfDiagnosticsSignalDefinition, aN as SelfDiagnosticsSignalDefinitions, aO as SelfDiagnosticsTool, aP as SelfDiagnosticsToolInputSchema, aQ as SelfDiagnosticsToolOptions, aR as SignalEvent, aS as SpanParams, aT as SubagentDispatch, aU as SubagentDispatchOptions, aV as SubagentFinishOptions, c as SubagentResumeOptions, d as SubagentRun, aW as ToolParams, aX as ToolSpan, aY as Trace, aZ as TraceContext, a_ as TraceSchema, e as Tracer, a$ as TrackToolParams, b0 as WorkflowParams, b1 as claimReplay, b2 as createEvalSuiteRun, b3 as createReplay, R as default, b4 as defineDataset, b5 as defineEvalSuite, b6 as defineEvaluatorProgram, b7 as defineLocalEvaluator, b8 as evaluatePortableEvaluator, b9 as evaluateReplay, ba as importPortableEvaluator, bb as isEvalDataset, bc as isEvalSuiteDefinition, bd as loadEvalSnapshot, be as projectWorkshopTrace, bf as publishEvalDataset, bg as pullEval, bh as readEvalDataset, bi as readEvalManifest, bj as readReplay, bk as replay, bl as resolveDisableBatching, bm as runEvalSuite, bn as runReplay, bo as traceOutput, bp as traceToolCalls, bq as verifyPortableEvalArtifact } from './index-CQj4bn2v.mjs';
2
+ export { f as AiTrackEvent, A as AiTrackUsage, g as Attachment, h as AttachmentType, B as BeginInteractionOptions, i as BooleanThreshold, j as BooleanThresholdSchema, k as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, l as DEFAULT_EVAL_WAIT_MS, m as DEFAULT_QUERY_URL, n as DEFAULT_TRACE_WAIT_MS, o as DefinedEvalDataset, E as EvalCaseResult, p as EvalClient, q as EvalDataset, r as EvalDatasetCaseInput, s as EvalDatasetCaseInputSchema, t as EvalDatasetManifest, u as EvalDatasetPublishConflictError, v as EvalDestination, w as EvalEvaluator, x as EvalLocalEvaluator, y as EvalManifest, z as EvalProgram, F as EvalSuiteDefinition, G as EvalSuiteDefinitionInput, H as EvalSuiteResult, J as EvalSuiteRunSession, K as EvalVerdictAssessment, L as EvaluateReplayOptions, M as FinishInteractionOptions, N as HostedEvaluatorPin, O as IdentifyEvent, b as Interaction, Q as LocalBooleanVerdict, U as LocalBooleanVerdictSchema, V as LocalDebuggerLiveEventInput, W as LocalEvaluator, X as LocalEvaluatorContext, Y as LocalNumberVerdict, Z as LocalNumberVerdictSchema, _ as LocalScoreVerdict, $ as LocalScoreVerdictSchema, a0 as LocalVerdict, a1 as LocalVerdictSchema, a2 as MAX_EVAL_STATUS_RETRIES, a3 as MAX_INGEST_SIZE_BYTES, a4 as NumericThreshold, a5 as NumericThresholdSchema, P as PartialAiTrackEvent, a6 as PortableEvalArtifact, a7 as PortableEvalLimits, a8 as PortableEvalOutcome, a9 as PortableEvalResult, aa as PortableEvaluator, ab as PortableJudgeRequest, ac as PortableJudgeVerdict, ad as PublishEvalDatasetOptions, ae as PullEvalOptions, af as PulledEvalSnapshot, R as Raindrop, ag as RaindropConnection, ah as RaindropFeatureFlagValue, ai as RaindropFeatureFlags, aj as RaindropProperties, ak as RaindropPropertyLeaf, al as RaindropPropertyValue, a as RaindropSpanProcessor, am as ReplayClient, an as ReplayCounts, ao as ReplayCountsSchema, ap as ReplayEvaluator, aq as ReplayEvaluatorCounts, ar as ReplayEvaluatorCountsSchema, as as ReplayEvaluatorStats, at as ReplayEvaluatorStatsSchema, au as ReplayEvaluatorSummary, av as ReplayEvaluatorSummarySchema, aw as ReplayHandle, ax as ReplayLocalEvaluatorContext, ay as ReplayOptions, az as ReplayReading, aA as ReplayResult, aB as ReplayResultRow, aC as ReplayResultRowSchema, aD as ReplayRow, aE as ReplayRowOutcome, aF as ReplayVerdict, aG as ReplayVerdictSchema, aH as RunEvalSuiteOptions, aI as RunReplayOptions, aJ as SelfDiagnoseOptions, aK as SelfDiagnosticsExecuteContext, aL as SelfDiagnosticsExecuteResult, aM as SelfDiagnosticsSignalDefinition, aN as SelfDiagnosticsSignalDefinitions, aO as SelfDiagnosticsTool, aP as SelfDiagnosticsToolInputSchema, aQ as SelfDiagnosticsToolOptions, aR as SignalEvent, aS as SpanParams, aT as SubagentDispatch, aU as SubagentDispatchOptions, aV as SubagentFinishOptions, c as SubagentResumeOptions, d as SubagentRun, aW as ToolParams, aX as ToolSpan, aY as Trace, aZ as TraceContext, a_ as TraceSchema, e as Tracer, a$ as TrackToolParams, b0 as WorkflowParams, b1 as claimReplay, b2 as createEvalSuiteRun, b3 as createReplay, R as default, b4 as defineDataset, b5 as defineEvalSuite, b6 as defineEvaluatorProgram, b7 as defineLocalEvaluator, b8 as evaluatePortableEvaluator, b9 as evaluateReplay, ba as importPortableEvaluator, bb as isEvalDataset, bc as isEvalSuiteDefinition, bd as loadEvalSnapshot, be as projectWorkshopTrace, bf as publishEvalDataset, bg as pullEval, bh as readEvalDataset, bi as readEvalManifest, bj as readReplay, bk as replay, bl as resolveDisableBatching, bm as runEvalSuite, bn as runReplay, bo as traceOutput, bp as traceToolCalls, bq as verifyPortableEvalArtifact } from './index-APN1jN-i.mjs';
3
3
  export { E as EVAL_CORRELATION_ID_ATTRIBUTE, a as EvalScope, c as currentEvalScope, w as withEvalScope } from './eval-scope-BYkhP4uI.js';
4
4
  import '@opentelemetry/api';
5
5
  import 'zod';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@opentelemetry/instrumentation';
2
- export { f as AiTrackEvent, A as AiTrackUsage, g as Attachment, h as AttachmentType, B as BeginInteractionOptions, i as BooleanThreshold, j as BooleanThresholdSchema, k as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, l as DEFAULT_EVAL_WAIT_MS, m as DEFAULT_QUERY_URL, n as DEFAULT_TRACE_WAIT_MS, o as DefinedEvalDataset, E as EvalCaseResult, p as EvalClient, q as EvalDataset, r as EvalDatasetCaseInput, s as EvalDatasetCaseInputSchema, t as EvalDatasetManifest, u as EvalDatasetPublishConflictError, v as EvalDestination, w as EvalEvaluator, x as EvalLocalEvaluator, y as EvalManifest, z as EvalProgram, F as EvalSuiteDefinition, G as EvalSuiteDefinitionInput, H as EvalSuiteResult, J as EvalSuiteRunSession, K as EvalVerdictAssessment, L as EvaluateReplayOptions, M as FinishInteractionOptions, N as HostedEvaluatorPin, O as IdentifyEvent, b as Interaction, Q as LocalBooleanVerdict, U as LocalBooleanVerdictSchema, V as LocalDebuggerLiveEventInput, W as LocalEvaluator, X as LocalEvaluatorContext, Y as LocalNumberVerdict, Z as LocalNumberVerdictSchema, _ as LocalScoreVerdict, $ as LocalScoreVerdictSchema, a0 as LocalVerdict, a1 as LocalVerdictSchema, a2 as MAX_EVAL_STATUS_RETRIES, a3 as MAX_INGEST_SIZE_BYTES, a4 as NumericThreshold, a5 as NumericThresholdSchema, P as PartialAiTrackEvent, a6 as PortableEvalArtifact, a7 as PortableEvalLimits, a8 as PortableEvalOutcome, a9 as PortableEvalResult, aa as PortableEvaluator, ab as PortableJudgeRequest, ac as PortableJudgeVerdict, ad as PublishEvalDatasetOptions, ae as PullEvalOptions, af as PulledEvalSnapshot, R as Raindrop, ag as RaindropConnection, ah as RaindropFeatureFlagValue, ai as RaindropFeatureFlags, aj as RaindropProperties, ak as RaindropPropertyLeaf, al as RaindropPropertyValue, a as RaindropSpanProcessor, am as ReplayClient, an as ReplayCounts, ao as ReplayCountsSchema, ap as ReplayEvaluator, aq as ReplayEvaluatorCounts, ar as ReplayEvaluatorCountsSchema, as as ReplayEvaluatorStats, at as ReplayEvaluatorStatsSchema, au as ReplayEvaluatorSummary, av as ReplayEvaluatorSummarySchema, aw as ReplayHandle, ax as ReplayLocalEvaluatorContext, ay as ReplayOptions, az as ReplayReading, aA as ReplayResult, aB as ReplayResultRow, aC as ReplayResultRowSchema, aD as ReplayRow, aE as ReplayRowOutcome, aF as ReplayVerdict, aG as ReplayVerdictSchema, aH as RunEvalSuiteOptions, aI as RunReplayOptions, aJ as SelfDiagnoseOptions, aK as SelfDiagnosticsExecuteContext, aL as SelfDiagnosticsExecuteResult, aM as SelfDiagnosticsSignalDefinition, aN as SelfDiagnosticsSignalDefinitions, aO as SelfDiagnosticsTool, aP as SelfDiagnosticsToolInputSchema, aQ as SelfDiagnosticsToolOptions, aR as SignalEvent, aS as SpanParams, aT as SubagentDispatch, aU as SubagentDispatchOptions, aV as SubagentFinishOptions, c as SubagentResumeOptions, d as SubagentRun, aW as ToolParams, aX as ToolSpan, aY as Trace, aZ as TraceContext, a_ as TraceSchema, e as Tracer, a$ as TrackToolParams, b0 as WorkflowParams, b1 as claimReplay, b2 as createEvalSuiteRun, b3 as createReplay, R as default, b4 as defineDataset, b5 as defineEvalSuite, b6 as defineEvaluatorProgram, b7 as defineLocalEvaluator, b8 as evaluatePortableEvaluator, b9 as evaluateReplay, ba as importPortableEvaluator, bb as isEvalDataset, bc as isEvalSuiteDefinition, bd as loadEvalSnapshot, be as projectWorkshopTrace, bf as publishEvalDataset, bg as pullEval, bh as readEvalDataset, bi as readEvalManifest, bj as readReplay, bk as replay, bl as resolveDisableBatching, bm as runEvalSuite, bn as runReplay, bo as traceOutput, bp as traceToolCalls, bq as verifyPortableEvalArtifact } from './index-CQj4bn2v.js';
2
+ export { f as AiTrackEvent, A as AiTrackUsage, g as Attachment, h as AttachmentType, B as BeginInteractionOptions, i as BooleanThreshold, j as BooleanThresholdSchema, k as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, l as DEFAULT_EVAL_WAIT_MS, m as DEFAULT_QUERY_URL, n as DEFAULT_TRACE_WAIT_MS, o as DefinedEvalDataset, E as EvalCaseResult, p as EvalClient, q as EvalDataset, r as EvalDatasetCaseInput, s as EvalDatasetCaseInputSchema, t as EvalDatasetManifest, u as EvalDatasetPublishConflictError, v as EvalDestination, w as EvalEvaluator, x as EvalLocalEvaluator, y as EvalManifest, z as EvalProgram, F as EvalSuiteDefinition, G as EvalSuiteDefinitionInput, H as EvalSuiteResult, J as EvalSuiteRunSession, K as EvalVerdictAssessment, L as EvaluateReplayOptions, M as FinishInteractionOptions, N as HostedEvaluatorPin, O as IdentifyEvent, b as Interaction, Q as LocalBooleanVerdict, U as LocalBooleanVerdictSchema, V as LocalDebuggerLiveEventInput, W as LocalEvaluator, X as LocalEvaluatorContext, Y as LocalNumberVerdict, Z as LocalNumberVerdictSchema, _ as LocalScoreVerdict, $ as LocalScoreVerdictSchema, a0 as LocalVerdict, a1 as LocalVerdictSchema, a2 as MAX_EVAL_STATUS_RETRIES, a3 as MAX_INGEST_SIZE_BYTES, a4 as NumericThreshold, a5 as NumericThresholdSchema, P as PartialAiTrackEvent, a6 as PortableEvalArtifact, a7 as PortableEvalLimits, a8 as PortableEvalOutcome, a9 as PortableEvalResult, aa as PortableEvaluator, ab as PortableJudgeRequest, ac as PortableJudgeVerdict, ad as PublishEvalDatasetOptions, ae as PullEvalOptions, af as PulledEvalSnapshot, R as Raindrop, ag as RaindropConnection, ah as RaindropFeatureFlagValue, ai as RaindropFeatureFlags, aj as RaindropProperties, ak as RaindropPropertyLeaf, al as RaindropPropertyValue, a as RaindropSpanProcessor, am as ReplayClient, an as ReplayCounts, ao as ReplayCountsSchema, ap as ReplayEvaluator, aq as ReplayEvaluatorCounts, ar as ReplayEvaluatorCountsSchema, as as ReplayEvaluatorStats, at as ReplayEvaluatorStatsSchema, au as ReplayEvaluatorSummary, av as ReplayEvaluatorSummarySchema, aw as ReplayHandle, ax as ReplayLocalEvaluatorContext, ay as ReplayOptions, az as ReplayReading, aA as ReplayResult, aB as ReplayResultRow, aC as ReplayResultRowSchema, aD as ReplayRow, aE as ReplayRowOutcome, aF as ReplayVerdict, aG as ReplayVerdictSchema, aH as RunEvalSuiteOptions, aI as RunReplayOptions, aJ as SelfDiagnoseOptions, aK as SelfDiagnosticsExecuteContext, aL as SelfDiagnosticsExecuteResult, aM as SelfDiagnosticsSignalDefinition, aN as SelfDiagnosticsSignalDefinitions, aO as SelfDiagnosticsTool, aP as SelfDiagnosticsToolInputSchema, aQ as SelfDiagnosticsToolOptions, aR as SignalEvent, aS as SpanParams, aT as SubagentDispatch, aU as SubagentDispatchOptions, aV as SubagentFinishOptions, c as SubagentResumeOptions, d as SubagentRun, aW as ToolParams, aX as ToolSpan, aY as Trace, aZ as TraceContext, a_ as TraceSchema, e as Tracer, a$ as TrackToolParams, b0 as WorkflowParams, b1 as claimReplay, b2 as createEvalSuiteRun, b3 as createReplay, R as default, b4 as defineDataset, b5 as defineEvalSuite, b6 as defineEvaluatorProgram, b7 as defineLocalEvaluator, b8 as evaluatePortableEvaluator, b9 as evaluateReplay, ba as importPortableEvaluator, bb as isEvalDataset, bc as isEvalSuiteDefinition, bd as loadEvalSnapshot, be as projectWorkshopTrace, bf as publishEvalDataset, bg as pullEval, bh as readEvalDataset, bi as readEvalManifest, bj as readReplay, bk as replay, bl as resolveDisableBatching, bm as runEvalSuite, bn as runReplay, bo as traceOutput, bp as traceToolCalls, bq as verifyPortableEvalArtifact } from './index-APN1jN-i.js';
3
3
  export { E as EVAL_CORRELATION_ID_ATTRIBUTE, a as EvalScope, c as currentEvalScope, w as withEvalScope } from './eval-scope-BYkhP4uI.js';
4
4
  import '@opentelemetry/api';
5
5
  import 'zod';
package/dist/index.js CHANGED
@@ -6718,7 +6718,7 @@ var init_trace = __esm({
6718
6718
  }),
6719
6719
  reference: EvalCaseTraceSchema.extend({
6720
6720
  trace: TraceSchema.extend({ origin: import_zod3.default.literal("dataset") })
6721
- })
6721
+ }).optional()
6722
6722
  });
6723
6723
  MAX_CUSTOM_ATTRIBUTES = 25;
6724
6724
  MAX_ATTRIBUTE_VALUE_CHARS = 500;
@@ -6784,7 +6784,7 @@ var init_trace = __esm({
6784
6784
  "refresh token"
6785
6785
  ]);
6786
6786
  MAX_EVAL_PAYLOAD_RAW_CHARS = 16 * 1024;
6787
- TRACE_PROJECTION_SHA256 = "8dab83087aa2def3d076324021d5e08911e37967b68597b58b793a80d54b5874";
6787
+ TRACE_PROJECTION_SHA256 = "7d12eb03150b8f203e4404622f047676f50b3aa1e5442f0ed42d77d6002a33a6";
6788
6788
  }
6789
6789
  });
6790
6790
 
@@ -12558,7 +12558,7 @@ var SignalEventSchema = external_exports.object({
12558
12558
  // package.json
12559
12559
  var package_default = {
12560
12560
  name: "raindrop-ai",
12561
- version: "0.5.0",
12561
+ version: "0.6.0",
12562
12562
  main: "dist/index.js",
12563
12563
  module: "dist/index.mjs",
12564
12564
  types: "dist/index.d.ts",
@@ -16438,10 +16438,10 @@ var EvalDatasetCaseInputSchema = import_zod4.z.object({
16438
16438
  name: import_zod4.z.string().trim().min(1).max(200),
16439
16439
  input: import_zod4.z.string().nullable(),
16440
16440
  properties: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string()),
16441
- referenceTrace: CapturedTraceSnapshotSchema
16441
+ referenceTrace: CapturedTraceSnapshotSchema.optional()
16442
16442
  }).strict();
16443
16443
  var EvalDatasetVersionCaseSchema = EvalDatasetCaseInputSchema.extend({
16444
- referenceTraceSha256: EvalDatasetFingerprintSchema
16444
+ referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
16445
16445
  });
16446
16446
  var EvalDatasetCaseInputsSchema = import_zod4.z.array(EvalDatasetCaseInputSchema).min(1).max(EVAL_DATASET_MAX_CASES).superRefine((cases, context9) => {
16447
16447
  const seen = /* @__PURE__ */ new Set();
@@ -16480,8 +16480,13 @@ var EvalDatasetVersionSchema = import_zod4.z.object({
16480
16480
  var EvalDatasetManifestSchema = import_zod4.z.object({
16481
16481
  dataset: EvalDatasetIdentitySchema,
16482
16482
  version: EvalDatasetVersionSchema.omit({ cases: true }),
16483
- cases: import_zod4.z.array(EvalDatasetVersionCaseSchema.pick({ id: true, name: true, input: true, properties: true }).extend({
16484
- referenceTraceSha256: EvalDatasetFingerprintSchema
16483
+ cases: import_zod4.z.array(EvalDatasetVersionCaseSchema.pick({
16484
+ id: true,
16485
+ name: true,
16486
+ input: true,
16487
+ properties: true
16488
+ }).extend({
16489
+ referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
16485
16490
  }))
16486
16491
  });
16487
16492
  function compareNanoseconds2(left, right) {
@@ -16496,10 +16501,10 @@ function orderSnapshot(snapshot) {
16496
16501
  };
16497
16502
  }
16498
16503
  function normalizeCasesForFingerprint(cases) {
16499
- return cases.map((entry) => ({
16504
+ return cases.map((entry) => entry.referenceTrace === void 0 ? entry : {
16500
16505
  ...entry,
16501
16506
  referenceTrace: orderSnapshot(entry.referenceTrace)
16502
- }));
16507
+ });
16503
16508
  }
16504
16509
  function stableStringify(value) {
16505
16510
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -17328,6 +17333,7 @@ async function createLocalEvalReplaySession(client, options) {
17328
17333
  throw new Error("Raindrop local eval replay requires at least one evaluator");
17329
17334
  }
17330
17335
  const queryUrl = (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL;
17336
+ await validateReferenceRequirements(client, options.dataset, options.rowIds, options.evaluators, queryUrl);
17331
17337
  const handle = await createReplay(client, {
17332
17338
  dataset: options.dataset,
17333
17339
  rowIds: options.rowIds,
@@ -17651,9 +17657,30 @@ function reportReplay(client, queryUrl, replayId, body) {
17651
17657
  maxRetries: MAX_REPLAY_REPORT_RETRIES
17652
17658
  });
17653
17659
  }
17660
+ async function validateReferenceRequirements(client, dataset, rowIds, evaluators, queryUrl) {
17661
+ const selected = new Set(selectEvalDatasetRows(dataset, rowIds));
17662
+ const missing = dataset.cases.filter((entry) => selected.has(entry.id) && entry.referenceTraceSha256 === void 0);
17663
+ if (missing.length === 0) return;
17664
+ for (const evaluator of evaluators) {
17665
+ const requiresReference = typeof evaluator === "string" ? (await queryApi({
17666
+ client,
17667
+ queryUrl,
17668
+ path: `/v1/evals/${encodeURIComponent(evaluator)}`,
17669
+ method: "GET",
17670
+ schema: import_zod5.z.object({ data: import_zod5.z.object({ requiresReference: import_zod5.z.boolean() }) })
17671
+ })).data.requiresReference : evaluator.requiresReference === true;
17672
+ if (requiresReference) {
17673
+ const name = typeof evaluator === "string" ? evaluator : evaluator.slug;
17674
+ throw new Error(`Raindrop evaluator ${name} requires a reference trace. Missing references for cases: ${missing.map((entry) => entry.id).join(", ")}`);
17675
+ }
17676
+ }
17677
+ }
17654
17678
  async function replay(client, options) {
17655
- var _a, _b;
17679
+ var _a, _b, _c;
17656
17680
  const evaluators = normalizeEvaluators(options.evaluators);
17681
+ const queryUrl = (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL;
17682
+ const dataset = typeof options.dataset === "string" ? await readEvalDataset(client, options.dataset, { queryUrl }) : options.dataset;
17683
+ await validateReferenceRequirements(client, dataset, options.rowIds, evaluators, queryUrl);
17657
17684
  const local = evaluators.flatMap(
17658
17685
  (evaluator) => typeof evaluator === "string" ? [] : [{ evaluator, verdicts: [], durationMs: 0 }]
17659
17686
  );
@@ -17665,7 +17692,7 @@ async function replay(client, options) {
17665
17692
  }
17666
17693
  )
17667
17694
  );
17668
- const handle = await createReplay(client, options);
17695
+ const handle = await createReplay(client, { ...options, dataset });
17669
17696
  const execution = await runReplayRows(client, handle, options);
17670
17697
  const { reading } = execution;
17671
17698
  const doneRowIds = new Set(
@@ -17678,11 +17705,11 @@ async function replay(client, options) {
17678
17705
  if (local.length > 0) {
17679
17706
  const pairs = await readEvalCaseTracePairs({
17680
17707
  client,
17681
- queryUrl: (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL,
17708
+ queryUrl: (_b = options.queryUrl) != null ? _b : DEFAULT_QUERY_URL,
17682
17709
  replayId: reading.replayId,
17683
17710
  datasetVersion: handle.datasetVersion,
17684
17711
  evidence: traceEvidence,
17685
- waitMs: (_b = options.traceWaitMs) != null ? _b : DEFAULT_TRACE_WAIT_MS
17712
+ waitMs: (_c = options.traceWaitMs) != null ? _c : DEFAULT_TRACE_WAIT_MS
17686
17713
  });
17687
17714
  const rowsById = new Map(
17688
17715
  handle.rows.map(({ correlationId: _correlationId, ...row }) => [row.id, row])
@@ -18181,6 +18208,7 @@ async function publishEvalDataset(client, options) {
18181
18208
  }
18182
18209
  function validateUploadSizes(body) {
18183
18210
  for (const [index, entry] of body.cases.entries()) {
18211
+ if (entry.referenceTrace === void 0) continue;
18184
18212
  const bytes2 = encodedBytes(entry.referenceTrace);
18185
18213
  if (bytes2 > EVAL_DATASET_MAX_REFERENCE_BYTES) {
18186
18214
  throw new Error(
@@ -19324,21 +19352,24 @@ function replayEvaluator(entry) {
19324
19352
  slug: entry.evaluator.slug,
19325
19353
  name: entry.evaluator.name,
19326
19354
  output: entry.evaluator.output,
19327
- judge: entry.evaluator.judge
19355
+ judge: entry.evaluator.judge,
19356
+ requiresReference: entry.evaluator.requiresReference
19328
19357
  };
19329
19358
  case "score":
19330
19359
  return {
19331
19360
  slug: entry.evaluator.slug,
19332
19361
  name: entry.evaluator.name,
19333
19362
  output: entry.evaluator.output,
19334
- judge: entry.evaluator.judge
19363
+ judge: entry.evaluator.judge,
19364
+ requiresReference: entry.evaluator.requiresReference
19335
19365
  };
19336
19366
  case "number":
19337
19367
  return {
19338
19368
  slug: entry.evaluator.slug,
19339
19369
  name: entry.evaluator.name,
19340
19370
  output: entry.evaluator.output,
19341
- judge: entry.evaluator.judge
19371
+ judge: entry.evaluator.judge,
19372
+ requiresReference: entry.evaluator.requiresReference
19342
19373
  };
19343
19374
  }
19344
19375
  }
package/dist/index.mjs CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  withReplayTraceDestination,
31
31
  withRoutingContext,
32
32
  withTask
33
- } from "./chunk-AUNFORWV.mjs";
33
+ } from "./chunk-ZVHQBBST.mjs";
34
34
  import {
35
35
  BooleanThresholdSchema,
36
36
  CapturedTraceSnapshotSchema,
@@ -55,7 +55,7 @@ import {
55
55
  traceToolCalls,
56
56
  validateEvaluatorOutput,
57
57
  verifyPortableEvalArtifact
58
- } from "./chunk-HFHHGRTW.mjs";
58
+ } from "./chunk-CFGEE5ID.mjs";
59
59
  import {
60
60
  __commonJS,
61
61
  __toESM
@@ -10034,10 +10034,10 @@ var EvalDatasetCaseInputSchema = z2.object({
10034
10034
  name: z2.string().trim().min(1).max(200),
10035
10035
  input: z2.string().nullable(),
10036
10036
  properties: z2.record(z2.string(), z2.string()),
10037
- referenceTrace: CapturedTraceSnapshotSchema
10037
+ referenceTrace: CapturedTraceSnapshotSchema.optional()
10038
10038
  }).strict();
10039
10039
  var EvalDatasetVersionCaseSchema = EvalDatasetCaseInputSchema.extend({
10040
- referenceTraceSha256: EvalDatasetFingerprintSchema
10040
+ referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
10041
10041
  });
10042
10042
  var EvalDatasetCaseInputsSchema = z2.array(EvalDatasetCaseInputSchema).min(1).max(EVAL_DATASET_MAX_CASES).superRefine((cases, context3) => {
10043
10043
  const seen = /* @__PURE__ */ new Set();
@@ -10076,8 +10076,13 @@ var EvalDatasetVersionSchema = z2.object({
10076
10076
  var EvalDatasetManifestSchema = z2.object({
10077
10077
  dataset: EvalDatasetIdentitySchema,
10078
10078
  version: EvalDatasetVersionSchema.omit({ cases: true }),
10079
- cases: z2.array(EvalDatasetVersionCaseSchema.pick({ id: true, name: true, input: true, properties: true }).extend({
10080
- referenceTraceSha256: EvalDatasetFingerprintSchema
10079
+ cases: z2.array(EvalDatasetVersionCaseSchema.pick({
10080
+ id: true,
10081
+ name: true,
10082
+ input: true,
10083
+ properties: true
10084
+ }).extend({
10085
+ referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
10081
10086
  }))
10082
10087
  });
10083
10088
  function compareNanoseconds(left, right) {
@@ -10092,10 +10097,10 @@ function orderSnapshot(snapshot) {
10092
10097
  };
10093
10098
  }
10094
10099
  function normalizeCasesForFingerprint(cases) {
10095
- return cases.map((entry) => ({
10100
+ return cases.map((entry) => entry.referenceTrace === void 0 ? entry : {
10096
10101
  ...entry,
10097
10102
  referenceTrace: orderSnapshot(entry.referenceTrace)
10098
- }));
10103
+ });
10099
10104
  }
10100
10105
  function stableStringify(value) {
10101
10106
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -10921,6 +10926,7 @@ async function createLocalEvalReplaySession(client, options) {
10921
10926
  throw new Error("Raindrop local eval replay requires at least one evaluator");
10922
10927
  }
10923
10928
  const queryUrl = (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL;
10929
+ await validateReferenceRequirements(client, options.dataset, options.rowIds, options.evaluators, queryUrl);
10924
10930
  const handle = await createReplay(client, {
10925
10931
  dataset: options.dataset,
10926
10932
  rowIds: options.rowIds,
@@ -11244,9 +11250,30 @@ function reportReplay(client, queryUrl, replayId, body) {
11244
11250
  maxRetries: MAX_REPLAY_REPORT_RETRIES
11245
11251
  });
11246
11252
  }
11253
+ async function validateReferenceRequirements(client, dataset, rowIds, evaluators, queryUrl) {
11254
+ const selected = new Set(selectEvalDatasetRows(dataset, rowIds));
11255
+ const missing = dataset.cases.filter((entry) => selected.has(entry.id) && entry.referenceTraceSha256 === void 0);
11256
+ if (missing.length === 0) return;
11257
+ for (const evaluator of evaluators) {
11258
+ const requiresReference = typeof evaluator === "string" ? (await queryApi({
11259
+ client,
11260
+ queryUrl,
11261
+ path: `/v1/evals/${encodeURIComponent(evaluator)}`,
11262
+ method: "GET",
11263
+ schema: z3.object({ data: z3.object({ requiresReference: z3.boolean() }) })
11264
+ })).data.requiresReference : evaluator.requiresReference === true;
11265
+ if (requiresReference) {
11266
+ const name = typeof evaluator === "string" ? evaluator : evaluator.slug;
11267
+ throw new Error(`Raindrop evaluator ${name} requires a reference trace. Missing references for cases: ${missing.map((entry) => entry.id).join(", ")}`);
11268
+ }
11269
+ }
11270
+ }
11247
11271
  async function replay(client, options) {
11248
- var _a, _b;
11272
+ var _a, _b, _c;
11249
11273
  const evaluators = normalizeEvaluators(options.evaluators);
11274
+ const queryUrl = (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL;
11275
+ const dataset = typeof options.dataset === "string" ? await readEvalDataset(client, options.dataset, { queryUrl }) : options.dataset;
11276
+ await validateReferenceRequirements(client, dataset, options.rowIds, evaluators, queryUrl);
11250
11277
  const local = evaluators.flatMap(
11251
11278
  (evaluator) => typeof evaluator === "string" ? [] : [{ evaluator, verdicts: [], durationMs: 0 }]
11252
11279
  );
@@ -11258,7 +11285,7 @@ async function replay(client, options) {
11258
11285
  }
11259
11286
  )
11260
11287
  );
11261
- const handle = await createReplay(client, options);
11288
+ const handle = await createReplay(client, { ...options, dataset });
11262
11289
  const execution = await runReplayRows(client, handle, options);
11263
11290
  const { reading } = execution;
11264
11291
  const doneRowIds = new Set(
@@ -11271,11 +11298,11 @@ async function replay(client, options) {
11271
11298
  if (local.length > 0) {
11272
11299
  const pairs = await readEvalCaseTracePairs({
11273
11300
  client,
11274
- queryUrl: (_a = options.queryUrl) != null ? _a : DEFAULT_QUERY_URL,
11301
+ queryUrl: (_b = options.queryUrl) != null ? _b : DEFAULT_QUERY_URL,
11275
11302
  replayId: reading.replayId,
11276
11303
  datasetVersion: handle.datasetVersion,
11277
11304
  evidence: traceEvidence,
11278
- waitMs: (_b = options.traceWaitMs) != null ? _b : DEFAULT_TRACE_WAIT_MS
11305
+ waitMs: (_c = options.traceWaitMs) != null ? _c : DEFAULT_TRACE_WAIT_MS
11279
11306
  });
11280
11307
  const rowsById = new Map(
11281
11308
  handle.rows.map(({ correlationId: _correlationId, ...row }) => [row.id, row])
@@ -11771,6 +11798,7 @@ async function publishEvalDataset(client, options) {
11771
11798
  }
11772
11799
  function validateUploadSizes(body) {
11773
11800
  for (const [index, entry] of body.cases.entries()) {
11801
+ if (entry.referenceTrace === void 0) continue;
11774
11802
  const bytes2 = encodedBytes(entry.referenceTrace);
11775
11803
  if (bytes2 > EVAL_DATASET_MAX_REFERENCE_BYTES) {
11776
11804
  throw new Error(
@@ -12902,21 +12930,24 @@ function replayEvaluator(entry) {
12902
12930
  slug: entry.evaluator.slug,
12903
12931
  name: entry.evaluator.name,
12904
12932
  output: entry.evaluator.output,
12905
- judge: entry.evaluator.judge
12933
+ judge: entry.evaluator.judge,
12934
+ requiresReference: entry.evaluator.requiresReference
12906
12935
  };
12907
12936
  case "score":
12908
12937
  return {
12909
12938
  slug: entry.evaluator.slug,
12910
12939
  name: entry.evaluator.name,
12911
12940
  output: entry.evaluator.output,
12912
- judge: entry.evaluator.judge
12941
+ judge: entry.evaluator.judge,
12942
+ requiresReference: entry.evaluator.requiresReference
12913
12943
  };
12914
12944
  case "number":
12915
12945
  return {
12916
12946
  slug: entry.evaluator.slug,
12917
12947
  name: entry.evaluator.name,
12918
12948
  output: entry.evaluator.output,
12919
- judge: entry.evaluator.judge
12949
+ judge: entry.evaluator.judge,
12950
+ requiresReference: entry.evaluator.requiresReference
12920
12951
  };
12921
12952
  }
12922
12953
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parsePortableEvalResult
3
- } from "./chunk-HFHHGRTW.mjs";
3
+ } from "./chunk-CFGEE5ID.mjs";
4
4
  import "./chunk-UJCSKKID.mjs";
5
5
 
6
6
  // src/evals/portable-runtime.ts
@@ -1,5 +1,5 @@
1
1
  import { Instrumentation } from '@opentelemetry/instrumentation';
2
- import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, P as PartialAiTrackEvent, b as Interaction, A as AiTrackUsage, C as CarrierHeaders, T as TraceCarrier, c as SubagentResumeOptions, d as SubagentRun, e as Tracer } from '../index-CQj4bn2v.mjs';
2
+ import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, P as PartialAiTrackEvent, b as Interaction, A as AiTrackUsage, C as CarrierHeaders, T as TraceCarrier, c as SubagentResumeOptions, d as SubagentRun, e as Tracer } from '../index-APN1jN-i.mjs';
3
3
  import '@opentelemetry/api';
4
4
  import 'zod';
5
5
  import '@opentelemetry/sdk-trace-base';
@@ -1,5 +1,5 @@
1
1
  import { Instrumentation } from '@opentelemetry/instrumentation';
2
- import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, P as PartialAiTrackEvent, b as Interaction, A as AiTrackUsage, C as CarrierHeaders, T as TraceCarrier, c as SubagentResumeOptions, d as SubagentRun, e as Tracer } from '../index-CQj4bn2v.js';
2
+ import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, P as PartialAiTrackEvent, b as Interaction, A as AiTrackUsage, C as CarrierHeaders, T as TraceCarrier, c as SubagentResumeOptions, d as SubagentRun, e as Tracer } from '../index-APN1jN-i.js';
3
3
  import '@opentelemetry/api';
4
4
  import 'zod';
5
5
  import '@opentelemetry/sdk-trace-base';
@@ -1384,7 +1384,7 @@ function base64ToHex2(base64) {
1384
1384
  // package.json
1385
1385
  var package_default = {
1386
1386
  name: "raindrop-ai",
1387
- version: "0.5.0",
1387
+ version: "0.6.0",
1388
1388
  main: "dist/index.js",
1389
1389
  module: "dist/index.mjs",
1390
1390
  types: "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-AUNFORWV.mjs";
3
+ } from "../chunk-ZVHQBBST.mjs";
4
4
  import "../chunk-UJCSKKID.mjs";
5
5
 
6
6
  // src/tracing/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",