raindrop-ai 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6789,6 +6789,10 @@ function validateEvaluatorOutput(evaluator, rawOutput) {
6789
6789
  throw new Error(`Raindrop local evaluator ${name} expected ${localOutput}, received ${output}`);
6790
6790
  }
6791
6791
  switch (output) {
6792
+ case "preference":
6793
+ if (evaluator.threshold !== void 0)
6794
+ throw new Error("Preference evaluators do not accept thresholds");
6795
+ break;
6792
6796
  case "boolean":
6793
6797
  parseBooleanThreshold(evaluator.threshold);
6794
6798
  break;
@@ -6889,7 +6893,7 @@ var init_definition = __esm({
6889
6893
  output: JsonValueSchema.default(null),
6890
6894
  properties: import_zod4.z.record(import_zod4.z.string()).default({})
6891
6895
  });
6892
- EvalOutputSchema = import_zod4.z.enum(["boolean", "score", "number"]);
6896
+ EvalOutputSchema = import_zod4.z.enum(["boolean", "score", "number", "preference"]);
6893
6897
  EVAL_DEFINITION = /* @__PURE__ */ Symbol.for("raindrop.evalDefinition");
6894
6898
  }
6895
6899
  });
@@ -7120,7 +7124,7 @@ var init_portable_runtime = __esm({
7120
7124
  traceId: import_zod10.z.string(),
7121
7125
  rubric: import_zod10.z.string().min(1).max(4e4),
7122
7126
  text: import_zod10.z.string().max(4 * 1024 * 1024),
7123
- outputType: import_zod10.z.enum(["boolean", "score"])
7127
+ outputType: import_zod10.z.enum(["boolean", "score", "preference"])
7124
7128
  });
7125
7129
  }
7126
7130
  });
@@ -7207,7 +7211,7 @@ function validatePortableResult(artifact, traces, result) {
7207
7211
  }
7208
7212
  returned.add(outcome.traceId);
7209
7213
  if (outcome.state !== "graded") continue;
7210
- const valid = artifact.evaluator.outputType === "boolean" ? "pass" in outcome : artifact.evaluator.outputType === "score" ? "score" in outcome : "value" in outcome;
7214
+ const valid = artifact.evaluator.outputType === "boolean" ? "pass" in outcome : artifact.evaluator.outputType === "score" ? "score" in outcome : artifact.evaluator.outputType === "preference" ? "preference" in outcome : "value" in outcome;
7211
7215
  if (!valid) {
7212
7216
  throw new Error(
7213
7217
  `Raindrop portable evaluator ${artifact.evaluator.slug} returned the wrong graded value`
@@ -7248,7 +7252,7 @@ var init_portable = __esm({
7248
7252
  slug: import_zod11.z.string().min(1),
7249
7253
  programVersion: import_zod11.z.number().int().positive(),
7250
7254
  executionMode: import_zod11.z.enum(["deterministic", "judge"]),
7251
- outputType: import_zod11.z.enum(["boolean", "score", "number"]),
7255
+ outputType: import_zod11.z.enum(["boolean", "score", "number", "preference"]),
7252
7256
  scope: import_zod11.z.literal("trace")
7253
7257
  }).strict(),
7254
7258
  traceProjectionVersion: import_zod11.z.literal(1),
@@ -7286,6 +7290,12 @@ var init_portable = __esm({
7286
7290
  value: import_zod11.z.number().finite(),
7287
7291
  note: import_zod11.z.string().optional()
7288
7292
  }),
7293
+ import_zod11.z.object({
7294
+ state: import_zod11.z.literal("graded"),
7295
+ traceId: import_zod11.z.string(),
7296
+ preference: import_zod11.z.enum(["A", "B", "tie"]),
7297
+ note: import_zod11.z.string().optional()
7298
+ }),
7289
7299
  import_zod11.z.object({ state: import_zod11.z.literal("errored"), traceId: import_zod11.z.string(), message: import_zod11.z.string() }),
7290
7300
  import_zod11.z.object({
7291
7301
  state: import_zod11.z.literal("ungraded"),
@@ -7324,6 +7334,7 @@ __export(index_exports, {
7324
7334
  EvalSuiteManifestSchema: () => EvalSuiteManifestSchema,
7325
7335
  LocalBooleanVerdictSchema: () => LocalBooleanVerdictSchema,
7326
7336
  LocalNumberVerdictSchema: () => LocalNumberVerdictSchema,
7337
+ LocalPreferenceVerdictSchema: () => LocalPreferenceVerdictSchema,
7327
7338
  LocalScoreVerdictSchema: () => LocalScoreVerdictSchema,
7328
7339
  LocalVerdictSchema: () => LocalVerdictSchema,
7329
7340
  MAX_EVAL_STATUS_RETRIES: () => MAX_EVAL_STATUS_RETRIES,
@@ -13279,7 +13290,7 @@ var SignalEventSchema = external_exports.object({
13279
13290
  // package.json
13280
13291
  var package_default = {
13281
13292
  name: "raindrop-ai",
13282
- version: "1.0.0",
13293
+ version: "1.0.1",
13283
13294
  main: "dist/index.js",
13284
13295
  module: "dist/index.mjs",
13285
13296
  types: "dist/index.d.ts",
@@ -17492,6 +17503,12 @@ var ReplayEvaluatorStatsSchema = import_zod6.z.object({
17492
17503
  skippedReason: import_zod6.z.literal("no trace").nullable()
17493
17504
  });
17494
17505
  var ReplayEvaluatorSummarySchema = import_zod6.z.discriminatedUnion("outputType", [
17506
+ import_zod6.z.object({
17507
+ outputType: import_zod6.z.literal("preference"),
17508
+ counts: ReplayEvaluatorCountsSchema,
17509
+ stats: ReplayEvaluatorStatsSchema,
17510
+ preferences: import_zod6.z.object({ A: import_zod6.z.number(), B: import_zod6.z.number(), tie: import_zod6.z.number() })
17511
+ }),
17495
17512
  import_zod6.z.object({
17496
17513
  outputType: import_zod6.z.literal("boolean"),
17497
17514
  counts: ReplayEvaluatorCountsSchema,
@@ -17533,6 +17550,7 @@ var ReplayVerdictSchema = import_zod6.z.union([
17533
17550
  ReplayVerdictGradedSchema.extend({ pass: import_zod6.z.boolean() }),
17534
17551
  ReplayVerdictGradedSchema.extend({ score: EvalScoreSchema }),
17535
17552
  ReplayVerdictGradedSchema.extend({ value: import_zod6.z.number().finite() }),
17553
+ ReplayVerdictGradedSchema.extend({ preference: import_zod6.z.enum(["A", "B", "tie"]) }),
17536
17554
  ReplayVerdictIdentitySchema.extend({
17537
17555
  state: import_zod6.z.literal("errored"),
17538
17556
  message: import_zod6.z.string()
@@ -17580,10 +17598,15 @@ var LocalScoreVerdictSchema = import_zod6.z.object({
17580
17598
  note: import_zod6.z.string().trim().min(1).max(600).optional()
17581
17599
  }).strict();
17582
17600
  var LocalNumberVerdictSchema = import_zod6.z.object({ value: import_zod6.z.number().finite(), note: import_zod6.z.string().trim().min(1).max(600).optional() }).strict();
17601
+ var LocalPreferenceVerdictSchema = import_zod6.z.object({
17602
+ preference: import_zod6.z.enum(["A", "B", "tie"]),
17603
+ note: import_zod6.z.string().trim().min(1).max(600).optional()
17604
+ }).strict();
17583
17605
  var LocalVerdictSchema = import_zod6.z.union([
17584
17606
  LocalBooleanVerdictSchema,
17585
17607
  LocalScoreVerdictSchema,
17586
- LocalNumberVerdictSchema
17608
+ LocalNumberVerdictSchema,
17609
+ LocalPreferenceVerdictSchema
17587
17610
  ]);
17588
17611
  async function queryApi(request) {
17589
17612
  var _a, _b;
@@ -17697,7 +17720,7 @@ var EvalRunDetailSchema = WireReplayDetailSchema.extend({
17697
17720
  id: import_zod6.z.string().uuid(),
17698
17721
  eval_id: import_zod6.z.string().uuid(),
17699
17722
  program_version: import_zod6.z.number().int().positive(),
17700
- output_type: import_zod6.z.enum(["boolean", "score", "number"]),
17723
+ output_type: import_zod6.z.enum(["boolean", "score", "number", "preference"]),
17701
17724
  executed_by: import_zod6.z.enum(["hosted", "local"]),
17702
17725
  status: import_zod6.z.enum(["running", "completed", "failed"])
17703
17726
  })
@@ -17729,7 +17752,7 @@ var WireLocalEvaluatorSchema = import_zod6.z.object({
17729
17752
  id: import_zod6.z.string().uuid(),
17730
17753
  slug: import_zod6.z.string(),
17731
17754
  name: import_zod6.z.string(),
17732
- output: import_zod6.z.enum(["boolean", "score", "number"]),
17755
+ output: import_zod6.z.enum(["boolean", "score", "number", "preference"]),
17733
17756
  kind: import_zod6.z.literal("local"),
17734
17757
  programVersion: import_zod6.z.number().int().positive()
17735
17758
  })
@@ -17770,6 +17793,12 @@ var WireEvalRunSchema = import_zod6.z.object({
17770
17793
  value: import_zod6.z.number().finite(),
17771
17794
  note: import_zod6.z.string().optional()
17772
17795
  }),
17796
+ import_zod6.z.object({
17797
+ state: import_zod6.z.literal("graded"),
17798
+ traceId: import_zod6.z.string(),
17799
+ preference: import_zod6.z.enum(["A", "B", "tie"]),
17800
+ note: import_zod6.z.string().optional()
17801
+ }),
17773
17802
  import_zod6.z.object({ state: import_zod6.z.literal("errored"), traceId: import_zod6.z.string(), message: import_zod6.z.string() }),
17774
17803
  import_zod6.z.object({
17775
17804
  state: import_zod6.z.literal("ungraded"),
@@ -18807,6 +18836,8 @@ function parseLocalVerdict(evaluator, verdict) {
18807
18836
  return LocalScoreVerdictSchema.parse(verdict);
18808
18837
  case "number":
18809
18838
  return LocalNumberVerdictSchema.parse(verdict);
18839
+ case "preference":
18840
+ return LocalPreferenceVerdictSchema.parse(verdict);
18810
18841
  }
18811
18842
  }
18812
18843
  async function submitLocalEvaluator(client, replayId, state2, queryUrl, traceEvidence) {
@@ -18924,6 +18955,9 @@ function replayVerdict(evaluator, outcome) {
18924
18955
  if ("score" in outcome) {
18925
18956
  return { ...identity, state: outcome.state, score: outcome.score, note: outcome.note };
18926
18957
  }
18958
+ if ("preference" in outcome) {
18959
+ return { ...identity, state: outcome.state, preference: outcome.preference, note: outcome.note };
18960
+ }
18927
18961
  return { ...identity, state: outcome.state, value: outcome.value, note: outcome.note };
18928
18962
  }
18929
18963
  function replayResultRows(handle, reading, evaluators) {
@@ -19167,6 +19201,7 @@ init_manifest();
19167
19201
 
19168
19202
  // src/evals/agent.ts
19169
19203
  var import_zod7 = require("zod");
19204
+ var ParameterValueSchema = import_zod7.z.union([import_zod7.z.string(), import_zod7.z.number().finite(), import_zod7.z.boolean()]);
19170
19205
  var EvalParameterError = class extends Error {
19171
19206
  constructor(agent, issues) {
19172
19207
  super(
@@ -19253,7 +19288,7 @@ function defineAgent(definition) {
19253
19288
  if (entries.length > MAX_PARAMETERS)
19254
19289
  throw new Error(`Agent ${slug} declares more than ${MAX_PARAMETERS} parameters`);
19255
19290
  const parameters = entries.map(([key, schema2]) => describeParameterField(key, schema2));
19256
- const schema = import_zod7.z.object(fields).strict();
19291
+ const schema = import_zod7.z.object(fields).catchall(ParameterValueSchema);
19257
19292
  return {
19258
19293
  slug,
19259
19294
  name,
@@ -19323,9 +19358,10 @@ var import_zod8 = require("zod");
19323
19358
  var InvocationSchema = import_zod8.z.object({
19324
19359
  runId: import_zod8.z.string().uuid(),
19325
19360
  agent: import_zod8.z.string().min(1).max(64),
19326
- parameters: import_zod8.z.record(import_zod8.z.unknown()).default({})
19361
+ parameters: import_zod8.z.record(import_zod8.z.unknown()).default({}),
19362
+ concurrency: import_zod8.z.number().int().min(1).max(100).optional()
19327
19363
  });
19328
- var MAX_BODY_BYTES = 64 * 1024;
19364
+ var MAX_BODY_BYTES = 1024 * 1024;
19329
19365
  async function parseInvocation(request) {
19330
19366
  var _a;
19331
19367
  if (Number((_a = request.headers.get("content-length")) != null ? _a : 0) > MAX_BODY_BYTES) return void 0;
@@ -19363,7 +19399,8 @@ function createEvalHandler(client, options) {
19363
19399
  parameters
19364
19400
  }));
19365
19401
  return async (request) => {
19366
- if (request.method === "GET") return Response.json({ agents: catalog });
19402
+ if (request.method === "GET")
19403
+ return Response.json({ agents: catalog, concurrencySupported: true });
19367
19404
  if (request.method !== "POST") {
19368
19405
  return Response.json(
19369
19406
  { error: "Method not allowed" },
@@ -19396,6 +19433,7 @@ function createEvalHandler(client, options) {
19396
19433
  execution,
19397
19434
  () => runEvalReplay(client, handle, {
19398
19435
  run: execution.run,
19436
+ concurrency: invocation.concurrency,
19399
19437
  queryUrl: options.queryUrl,
19400
19438
  replayIngestUrl: options.replayIngestUrl
19401
19439
  })
@@ -19619,7 +19657,7 @@ var EvaluatorIdentitySchema = import_zod9.z.object({
19619
19657
  id: import_zod9.z.string().uuid(),
19620
19658
  slug: import_zod9.z.string(),
19621
19659
  programVersion: import_zod9.z.number().int().positive(),
19622
- outputType: import_zod9.z.enum(["boolean", "score", "number"])
19660
+ outputType: import_zod9.z.enum(["boolean", "score", "number", "preference"])
19623
19661
  });
19624
19662
  var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
19625
19663
  name: import_zod9.z.string(),
@@ -20004,6 +20042,12 @@ function assessEvalVerdict(evaluator, verdict, resolvedOutput) {
20004
20042
  if (output === void 0) {
20005
20043
  throw new Error(`Raindrop hosted evaluator ${name} requires its canonical output type`);
20006
20044
  }
20045
+ if (output === "preference") {
20046
+ if (!("preference" in verdict)) throw outputMismatch(name, output);
20047
+ if (evaluator.threshold !== void 0)
20048
+ throw new Error("Preference evaluators do not accept thresholds");
20049
+ return { state: "measurement", evaluator: name, verdict };
20050
+ }
20007
20051
  if (output === "boolean") {
20008
20052
  if (!("pass" in verdict)) throw outputMismatch(name, output);
20009
20053
  const threshold2 = evaluator.threshold;
@@ -20464,6 +20508,14 @@ function replayEvaluator(entry) {
20464
20508
  judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
20465
20509
  requiresReference: evaluator.requiresReference
20466
20510
  };
20511
+ case "preference":
20512
+ return {
20513
+ slug: evaluator.slug,
20514
+ name: evaluator.name,
20515
+ output: evaluator.output,
20516
+ judge: ({ case: pair, ...context8 }) => evaluator.judge({ ...context8, reference: pair == null ? void 0 : pair.reference }),
20517
+ requiresReference: evaluator.requiresReference
20518
+ };
20467
20519
  }
20468
20520
  }
20469
20521
  function validateDefinition(definition) {
@@ -21872,6 +21924,7 @@ var withEvalScope2 = withEvalScope;
21872
21924
  EvalSuiteManifestSchema,
21873
21925
  LocalBooleanVerdictSchema,
21874
21926
  LocalNumberVerdictSchema,
21927
+ LocalPreferenceVerdictSchema,
21875
21928
  LocalScoreVerdictSchema,
21876
21929
  LocalVerdictSchema,
21877
21930
  MAX_EVAL_STATUS_RETRIES,
package/dist/index.mjs CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  EvalPublishError,
11
11
  LocalBooleanVerdictSchema,
12
12
  LocalNumberVerdictSchema,
13
+ LocalPreferenceVerdictSchema,
13
14
  LocalScoreVerdictSchema,
14
15
  LocalVerdictSchema,
15
16
  MAX_EVAL_STATUS_RETRIES,
@@ -46,8 +47,8 @@ import {
46
47
  runReplay,
47
48
  traceTools,
48
49
  withEvalScope
49
- } from "./chunk-MVJNJ4TS.mjs";
50
- import "./chunk-GQKFYSJ5.mjs";
50
+ } from "./chunk-K427YJE7.mjs";
51
+ import "./chunk-M6RTFC5O.mjs";
51
52
  import {
52
53
  BooleanThresholdSchema,
53
54
  EvalContextSchema,
@@ -68,7 +69,7 @@ import {
68
69
  traceOutput,
69
70
  traceToolCalls,
70
71
  verifyPortableEvalArtifact
71
- } from "./chunk-X637VXF6.mjs";
72
+ } from "./chunk-OZMT7UW4.mjs";
72
73
  import "./chunk-UJCSKKID.mjs";
73
74
  export {
74
75
  BooleanThresholdSchema,
@@ -85,6 +86,7 @@ export {
85
86
  EvalSuiteManifestSchema,
86
87
  LocalBooleanVerdictSchema,
87
88
  LocalNumberVerdictSchema,
89
+ LocalPreferenceVerdictSchema,
88
90
  LocalScoreVerdictSchema,
89
91
  LocalVerdictSchema,
90
92
  MAX_EVAL_STATUS_RETRIES,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PortableEvalLimitsSchema,
3
3
  parsePortableEvalResult
4
- } from "./chunk-X637VXF6.mjs";
4
+ } from "./chunk-OZMT7UW4.mjs";
5
5
  import "./chunk-UJCSKKID.mjs";
6
6
 
7
7
  // src/evals/portable-runtime.ts
@@ -25,7 +25,7 @@ var JudgeRequestSchema = z.object({
25
25
  traceId: z.string(),
26
26
  rubric: z.string().min(1).max(4e4),
27
27
  text: z.string().max(4 * 1024 * 1024),
28
- outputType: z.enum(["boolean", "score"])
28
+ outputType: z.enum(["boolean", "score", "preference"])
29
29
  });
30
30
  async function runPortableEvaluator(evaluator, input) {
31
31
  var _a, _b, _c, _d, _e, _f, _g;
@@ -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, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-BBP9eqvk.mjs';
2
+ import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-Dwn_0jsy.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, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-BBP9eqvk.js';
2
+ import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-Dwn_0jsy.js';
3
3
  import '@opentelemetry/api';
4
4
  import 'zod';
5
5
  import '@opentelemetry/sdk-trace-base';
@@ -1594,7 +1594,7 @@ function base64ToHex2(base64) {
1594
1594
  // package.json
1595
1595
  var package_default = {
1596
1596
  name: "raindrop-ai",
1597
- version: "1.0.0",
1597
+ version: "1.0.1",
1598
1598
  main: "dist/index.js",
1599
1599
  module: "dist/index.mjs",
1600
1600
  types: "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-GQKFYSJ5.mjs";
3
+ } from "../chunk-M6RTFC5O.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": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",