raindrop-ai 0.8.0 → 0.9.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/dist/{chunk-EWHJ2YBW.mjs → chunk-RIL2CV7Q.mjs} +1 -2
- package/dist/{chunk-EFATLUNL.mjs → chunk-UY6537WW.mjs} +359 -357
- package/dist/{chunk-22CNYHSA.mjs → chunk-VBZXQNJY.mjs} +101 -699
- package/dist/evals/cli.js +667 -1803
- package/dist/evals/cli.mjs +3 -3
- package/dist/{index-gf1epf_P.d.ts → index-DZB7DoZS.d.mts} +33354 -32553
- package/dist/{index-gf1epf_P.d.mts → index-DZB7DoZS.d.ts} +33354 -32553
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +868 -1451
- package/dist/index.mjs +5 -3
- package/dist/{portable-runtime-6X2HHB4Y.mjs → portable-runtime-F7W4STGH.mjs} +1 -1
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -723,11 +723,11 @@ var require_lodash = __commonJS({
|
|
|
723
723
|
function unicodeWords(string) {
|
|
724
724
|
return string.match(reUnicodeWord) || [];
|
|
725
725
|
}
|
|
726
|
-
var runInContext = (function runInContext2(
|
|
727
|
-
|
|
728
|
-
var Array2 =
|
|
726
|
+
var runInContext = (function runInContext2(context8) {
|
|
727
|
+
context8 = context8 == null ? root : _.defaults(root.Object(), context8, _.pick(root, contextProps));
|
|
728
|
+
var Array2 = context8.Array, Date2 = context8.Date, Error2 = context8.Error, Function2 = context8.Function, Math2 = context8.Math, Object2 = context8.Object, RegExp2 = context8.RegExp, String2 = context8.String, TypeError2 = context8.TypeError;
|
|
729
729
|
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
730
|
-
var coreJsData =
|
|
730
|
+
var coreJsData = context8["__core-js_shared__"];
|
|
731
731
|
var funcToString = funcProto.toString;
|
|
732
732
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
733
733
|
var idCounter = 0;
|
|
@@ -741,7 +741,7 @@ var require_lodash = __commonJS({
|
|
|
741
741
|
var reIsNative = RegExp2(
|
|
742
742
|
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
743
743
|
);
|
|
744
|
-
var Buffer2 = moduleExports ?
|
|
744
|
+
var Buffer2 = moduleExports ? context8.Buffer : undefined2, Symbol2 = context8.Symbol, Uint8Array2 = context8.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
|
|
745
745
|
var defineProperty = (function() {
|
|
746
746
|
try {
|
|
747
747
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -750,9 +750,9 @@ var require_lodash = __commonJS({
|
|
|
750
750
|
} catch (e) {
|
|
751
751
|
}
|
|
752
752
|
})();
|
|
753
|
-
var ctxClearTimeout =
|
|
754
|
-
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite =
|
|
755
|
-
var DataView = getNative(
|
|
753
|
+
var ctxClearTimeout = context8.clearTimeout !== root.clearTimeout && context8.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context8.setTimeout !== root.setTimeout && context8.setTimeout;
|
|
754
|
+
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context8.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context8.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
755
|
+
var DataView = getNative(context8, "DataView"), Map2 = getNative(context8, "Map"), Promise2 = getNative(context8, "Promise"), Set2 = getNative(context8, "Set"), WeakMap2 = getNative(context8, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
756
756
|
var metaMap = WeakMap2 && new WeakMap2();
|
|
757
757
|
var realNames = {};
|
|
758
758
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
@@ -5765,268 +5765,14 @@ var require_dist = __commonJS({
|
|
|
5765
5765
|
}
|
|
5766
5766
|
});
|
|
5767
5767
|
|
|
5768
|
-
// src/evals/
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
const name = dataset.name.trim();
|
|
5773
|
-
const rows = dataset.rows.map((row) => {
|
|
5774
|
-
var _a2;
|
|
5775
|
-
const parsed = DatasetRowInputSchema.parse(row);
|
|
5776
|
-
return {
|
|
5777
|
-
id: parsed.id,
|
|
5778
|
-
name: (_a2 = parsed.name) != null ? _a2 : parsed.id,
|
|
5779
|
-
input: parsed.input,
|
|
5780
|
-
output: parsed.output,
|
|
5781
|
-
properties: parsed.properties
|
|
5782
|
-
};
|
|
5783
|
-
});
|
|
5784
|
-
const version = (_b = (_a = dataset.version) == null ? void 0 : _a.trim()) != null ? _b : (0, import_node_crypto2.createHash)("sha256").update(
|
|
5785
|
-
JSON.stringify(
|
|
5786
|
-
rows.map((row) => ({
|
|
5787
|
-
...row,
|
|
5788
|
-
properties: Object.fromEntries(
|
|
5789
|
-
Object.keys(row.properties).sort().map((key) => [key, row.properties[key]])
|
|
5790
|
-
)
|
|
5791
|
-
}))
|
|
5792
|
-
)
|
|
5793
|
-
).digest("hex");
|
|
5794
|
-
if (!id) throw new Error("Raindrop eval dataset ids cannot be empty");
|
|
5795
|
-
if (!name) throw new Error("Raindrop eval dataset names cannot be empty");
|
|
5796
|
-
if (!version) throw new Error("Raindrop eval dataset versions cannot be empty");
|
|
5797
|
-
if (dataset.rows.length === 0) throw new Error("Raindrop eval datasets require at least one row");
|
|
5798
|
-
const ids = rows.map((entry) => entry.id);
|
|
5799
|
-
if (ids.some((rowId) => !rowId)) throw new Error("Raindrop eval row ids cannot be empty");
|
|
5800
|
-
if (new Set(ids).size !== ids.length) throw new Error("Raindrop eval row ids must be unique");
|
|
5801
|
-
if (dataset.remote) {
|
|
5802
|
-
if (!dataset.remote.reference.trim())
|
|
5803
|
-
throw new Error("Raindrop remote dataset reference cannot be empty");
|
|
5804
|
-
if (!/^[a-f0-9]{64}$/.test(dataset.remote.fingerprint)) {
|
|
5805
|
-
throw new Error("Raindrop remote dataset fingerprint must be a SHA-256 digest");
|
|
5806
|
-
}
|
|
5807
|
-
}
|
|
5808
|
-
const defined2 = {
|
|
5809
|
-
...dataset,
|
|
5810
|
-
id,
|
|
5811
|
-
name,
|
|
5812
|
-
version,
|
|
5813
|
-
rows,
|
|
5814
|
-
[EVAL_DATASET]: true
|
|
5815
|
-
};
|
|
5816
|
-
Object.defineProperty(defined2, EVAL_DATASET, { enumerable: false });
|
|
5817
|
-
return defined2;
|
|
5818
|
-
}
|
|
5819
|
-
function isEvalDataset(value) {
|
|
5820
|
-
return typeof value === "object" && value !== null && EVAL_DATASET in value && value[EVAL_DATASET] === true;
|
|
5821
|
-
}
|
|
5822
|
-
function defineEvaluatorProgram(program) {
|
|
5823
|
-
var _a, _b, _c, _d;
|
|
5824
|
-
const slug = program.slug.trim();
|
|
5825
|
-
const name = program.name.trim();
|
|
5826
|
-
const source = program.source.trim();
|
|
5827
|
-
const intent = program.intent.trim();
|
|
5828
|
-
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug) || slug.length > 64) {
|
|
5829
|
-
throw new Error(
|
|
5830
|
-
"Raindrop evaluator program slugs must use lowercase letters, numbers, and single hyphens"
|
|
5831
|
-
);
|
|
5832
|
-
}
|
|
5833
|
-
if (!name || name.length > 120) {
|
|
5834
|
-
throw new Error("Raindrop evaluator program names must be between 1 and 120 characters");
|
|
5835
|
-
}
|
|
5836
|
-
if (!source) throw new Error(`Raindrop evaluator program ${slug} source cannot be empty`);
|
|
5837
|
-
if (!intent || intent.length > 1e4) {
|
|
5838
|
-
throw new Error(
|
|
5839
|
-
`Raindrop evaluator program ${slug} intent must be between 1 and 10000 characters`
|
|
5840
|
-
);
|
|
5841
|
-
}
|
|
5842
|
-
if (program.description != null && program.description.trim().length > 2e3) {
|
|
5843
|
-
throw new Error(`Raindrop evaluator program ${slug} description exceeds 2000 characters`);
|
|
5844
|
-
}
|
|
5845
|
-
const rules = (_b = (_a = program.rules) == null ? void 0 : _a.map((rule) => rule.trim())) != null ? _b : [];
|
|
5846
|
-
if (rules.length > 12 || rules.some((rule) => !rule || rule.length > 2e3)) {
|
|
5847
|
-
throw new Error(`Raindrop evaluator program ${slug} rules are invalid`);
|
|
5848
|
-
}
|
|
5849
|
-
if (program.expected && (!import_zod2.z.string().uuid().safeParse(program.expected.evalId).success || !Number.isInteger(program.expected.programVersion) || program.expected.programVersion <= 0)) {
|
|
5850
|
-
throw new Error(`Raindrop evaluator program ${slug} expected identity is invalid`);
|
|
5851
|
-
}
|
|
5852
|
-
return {
|
|
5853
|
-
...program,
|
|
5854
|
-
kind: "program",
|
|
5855
|
-
scope: import_zod2.z.literal("batch").parse((_c = program.scope) != null ? _c : "batch"),
|
|
5856
|
-
slug,
|
|
5857
|
-
name,
|
|
5858
|
-
source,
|
|
5859
|
-
intent,
|
|
5860
|
-
description: ((_d = program.description) == null ? void 0 : _d.trim()) || null,
|
|
5861
|
-
rules
|
|
5862
|
-
};
|
|
5863
|
-
}
|
|
5864
|
-
function defineLocalEvaluator(evaluator) {
|
|
5865
|
-
var _a;
|
|
5866
|
-
return { ...evaluator, scope: import_zod2.z.literal("row").parse((_a = evaluator.scope) != null ? _a : "row") };
|
|
5867
|
-
}
|
|
5868
|
-
function defineEvalSuite(definition) {
|
|
5869
|
-
const name = definition.name.trim();
|
|
5870
|
-
if (name.length === 0) throw new Error("Raindrop eval suite names cannot be empty");
|
|
5871
|
-
const dataset = typeof definition.dataset === "string" ? definition.dataset.trim() : defineDataset(definition.dataset);
|
|
5872
|
-
if (typeof dataset === "string" && dataset.length === 0) {
|
|
5873
|
-
throw new Error("Raindrop eval suite datasets cannot be empty");
|
|
5874
|
-
}
|
|
5875
|
-
if (definition.datasetVersionId !== void 0) {
|
|
5876
|
-
import_zod2.z.string().uuid().parse(definition.datasetVersionId);
|
|
5877
|
-
if (typeof dataset !== "string")
|
|
5878
|
-
throw new Error("A dataset version pin requires a published dataset slug");
|
|
5879
|
-
}
|
|
5880
|
-
if (definition.agent !== void 0 && definition.run !== void 0) {
|
|
5881
|
-
throw new Error("An eval suite accepts either agent or run, not both");
|
|
5882
|
-
}
|
|
5883
|
-
if (definition.agent === void 0 && typeof definition.run !== "function") {
|
|
5884
|
-
throw new Error("Raindrop eval suite run must be a function");
|
|
5885
|
-
}
|
|
5886
|
-
if (!Array.isArray(definition.evaluators) || definition.evaluators.length === 0) {
|
|
5887
|
-
throw new Error("Raindrop eval suites require at least one evaluator");
|
|
5888
|
-
}
|
|
5889
|
-
validateOptionalNumber("concurrency", definition.concurrency, true, false);
|
|
5890
|
-
validateOptionalNumber("traceWaitMs", definition.traceWaitMs, false, true);
|
|
5891
|
-
validateOptionalNumber("evalWaitMs", definition.evalWaitMs, false, true);
|
|
5892
|
-
validateOptionalNumber("evalPollIntervalMs", definition.evalPollIntervalMs, false, false);
|
|
5893
|
-
const evaluators = definition.evaluators.map((evaluator) => validateEvaluator(evaluator));
|
|
5894
|
-
const evaluatorNames = evaluators.map((entry) => evaluatorName(entry));
|
|
5895
|
-
if (new Set(evaluatorNames).size !== evaluatorNames.length) {
|
|
5896
|
-
throw new Error("Raindrop eval suite evaluators must be unique");
|
|
5897
|
-
}
|
|
5898
|
-
const branded = {
|
|
5899
|
-
...definition,
|
|
5900
|
-
[EVAL_DEFINITION]: true,
|
|
5901
|
-
name,
|
|
5902
|
-
dataset,
|
|
5903
|
-
evaluators
|
|
5904
|
-
};
|
|
5905
|
-
Object.defineProperty(branded, EVAL_DEFINITION, { enumerable: false });
|
|
5906
|
-
return branded;
|
|
5907
|
-
}
|
|
5908
|
-
function isEvalSuiteDefinition(value) {
|
|
5909
|
-
return typeof value === "object" && value !== null && EVAL_DEFINITION in value && value[EVAL_DEFINITION] === true;
|
|
5910
|
-
}
|
|
5911
|
-
function isPublishedEvalSuite(definition) {
|
|
5912
|
-
return typeof definition.dataset === "string" && definition.datasetVersionId !== void 0 && definition.evaluators.every(
|
|
5913
|
-
({ evaluator }) => typeof evaluator !== "string" && (!("kind" in evaluator) || evaluator.kind !== "program" || evaluator.expected !== void 0)
|
|
5914
|
-
);
|
|
5915
|
-
}
|
|
5916
|
-
function evaluatorName(evaluator) {
|
|
5917
|
-
return typeof evaluator.evaluator === "string" ? evaluator.evaluator.trim() : evaluator.evaluator.slug.trim();
|
|
5918
|
-
}
|
|
5919
|
-
function evaluatorOutput(evaluator) {
|
|
5920
|
-
return typeof evaluator.evaluator === "string" ? void 0 : evaluator.evaluator.output;
|
|
5921
|
-
}
|
|
5922
|
-
function validateEvaluatorOutput(evaluator, rawOutput) {
|
|
5923
|
-
const name = evaluatorName(evaluator);
|
|
5924
|
-
const output = EvalOutputSchema.parse(rawOutput);
|
|
5925
|
-
const localOutput = evaluatorOutput(evaluator);
|
|
5926
|
-
if (localOutput !== void 0 && localOutput !== output) {
|
|
5927
|
-
throw new Error(`Raindrop local evaluator ${name} expected ${localOutput}, received ${output}`);
|
|
5928
|
-
}
|
|
5929
|
-
switch (output) {
|
|
5930
|
-
case "boolean":
|
|
5931
|
-
parseBooleanThreshold(evaluator.threshold);
|
|
5932
|
-
break;
|
|
5933
|
-
case "score":
|
|
5934
|
-
parseNumericThreshold(name, "score", evaluator.threshold);
|
|
5935
|
-
break;
|
|
5936
|
-
case "number":
|
|
5937
|
-
parseNumericThreshold(name, "number", evaluator.threshold);
|
|
5938
|
-
break;
|
|
5939
|
-
}
|
|
5940
|
-
}
|
|
5941
|
-
function validateEvaluator(evaluator) {
|
|
5942
|
-
if (typeof evaluator !== "object" || evaluator === null || !("evaluator" in evaluator)) {
|
|
5943
|
-
throw new Error("Raindrop eval evaluator entries must name an evaluator");
|
|
5944
|
-
}
|
|
5945
|
-
if ("output" in evaluator) {
|
|
5946
|
-
throw new Error(
|
|
5947
|
-
"Raindrop eval evaluator entries do not accept output; the evaluator definition owns it"
|
|
5948
|
-
);
|
|
5949
|
-
}
|
|
5950
|
-
if (typeof evaluator.evaluator !== "string" && (typeof evaluator.evaluator !== "object" || evaluator.evaluator === null || typeof evaluator.evaluator.slug !== "string" || typeof evaluator.evaluator.name !== "string")) {
|
|
5951
|
-
throw new Error("Raindrop local eval evaluators require a slug, name, output, and judge");
|
|
5952
|
-
}
|
|
5953
|
-
const name = evaluatorName(evaluator);
|
|
5954
|
-
if (name.length === 0) throw new Error("Raindrop eval evaluator names cannot be empty");
|
|
5955
|
-
if (typeof evaluator.evaluator === "string") {
|
|
5956
|
-
const threshold = evaluator.threshold;
|
|
5957
|
-
if (threshold !== void 0) {
|
|
5958
|
-
const boolean = BooleanThresholdSchema.safeParse(threshold);
|
|
5959
|
-
const numeric = NumericThresholdSchema.safeParse(threshold);
|
|
5960
|
-
if (!boolean.success && !numeric.success) {
|
|
5961
|
-
throw new Error(`Raindrop hosted evaluator ${name} has an invalid threshold`);
|
|
5962
|
-
}
|
|
5963
|
-
}
|
|
5964
|
-
return { ...evaluator, evaluator: name };
|
|
5965
|
-
}
|
|
5966
|
-
if ("kind" in evaluator.evaluator && evaluator.evaluator.kind === "portable") {
|
|
5967
|
-
validateEvaluatorOutput(evaluator, evaluator.evaluator.output);
|
|
5968
|
-
return evaluator;
|
|
5969
|
-
}
|
|
5970
|
-
if ("kind" in evaluator.evaluator && evaluator.evaluator.kind === "program") {
|
|
5971
|
-
const program = defineEvaluatorProgram(evaluator.evaluator);
|
|
5972
|
-
validateEvaluatorOutput({ ...evaluator, evaluator: program }, program.output);
|
|
5973
|
-
return { ...evaluator, evaluator: program };
|
|
5974
|
-
}
|
|
5975
|
-
if (typeof evaluator.evaluator.judge !== "function") {
|
|
5976
|
-
throw new Error(`Raindrop local evaluator ${name} judge must be a function`);
|
|
5977
|
-
}
|
|
5978
|
-
if (evaluator.evaluator.scope !== "row") {
|
|
5979
|
-
throw new Error(`Raindrop local evaluator ${name} scope must be row`);
|
|
5980
|
-
}
|
|
5981
|
-
const output = EvalOutputSchema.parse(evaluator.evaluator.output);
|
|
5982
|
-
validateEvaluatorOutput(evaluator, output);
|
|
5983
|
-
return evaluator;
|
|
5984
|
-
}
|
|
5985
|
-
function validateOptionalNumber(name, value, integer, allowZero) {
|
|
5986
|
-
if (value === void 0) return;
|
|
5987
|
-
const valid = Number.isFinite(value) && (!integer || Number.isInteger(value)) && (allowZero ? value >= 0 : value > 0);
|
|
5988
|
-
if (!valid) {
|
|
5989
|
-
const kind = integer ? "a positive integer" : allowZero ? "non-negative" : "positive";
|
|
5990
|
-
throw new Error(`Raindrop eval ${name} must be ${kind}`);
|
|
5991
|
-
}
|
|
5992
|
-
}
|
|
5993
|
-
function parseBooleanThreshold(threshold) {
|
|
5994
|
-
return threshold === void 0 ? void 0 : BooleanThresholdSchema.parse(threshold);
|
|
5995
|
-
}
|
|
5996
|
-
function parseNumericThreshold(name, output, threshold) {
|
|
5997
|
-
const parsed = threshold === void 0 ? void 0 : NumericThresholdSchema.parse(threshold);
|
|
5998
|
-
if (output === "score" && parsed) {
|
|
5999
|
-
const lower = "gte" in parsed ? parsed.gte : void 0;
|
|
6000
|
-
const inRange = (lower === void 0 || lower >= 1 && lower <= 5) && (parsed.lte === void 0 || parsed.lte >= 1 && parsed.lte <= 5);
|
|
6001
|
-
if (!inRange)
|
|
6002
|
-
throw new Error(`Raindrop score evaluator ${name} thresholds must be from 1 to 5`);
|
|
6003
|
-
}
|
|
6004
|
-
return parsed;
|
|
6005
|
-
}
|
|
6006
|
-
var import_node_crypto2, import_zod2, EvalScoreSchema, EVAL_DATASET, DatasetRowInputSchema, BooleanThresholdSchema, FiniteThresholdSchema, EvalOutputSchema, NumericThresholdSchema, EVAL_DEFINITION;
|
|
6007
|
-
var init_definition = __esm({
|
|
6008
|
-
"src/evals/definition.ts"() {
|
|
5768
|
+
// src/evals/generated/manifest.ts
|
|
5769
|
+
var import_zod2, BooleanThresholdSchema, FiniteThresholdSchema, NumericThresholdSchema, EvalSuiteManifestSchema;
|
|
5770
|
+
var init_manifest = __esm({
|
|
5771
|
+
"src/evals/generated/manifest.ts"() {
|
|
6009
5772
|
"use strict";
|
|
6010
|
-
import_node_crypto2 = require("crypto");
|
|
6011
5773
|
import_zod2 = require("zod");
|
|
6012
|
-
EvalScoreSchema = import_zod2.z.union([
|
|
6013
|
-
import_zod2.z.literal(1),
|
|
6014
|
-
import_zod2.z.literal(2),
|
|
6015
|
-
import_zod2.z.literal(3),
|
|
6016
|
-
import_zod2.z.literal(4),
|
|
6017
|
-
import_zod2.z.literal(5)
|
|
6018
|
-
]);
|
|
6019
|
-
EVAL_DATASET = /* @__PURE__ */ Symbol.for("raindrop.evalDataset");
|
|
6020
|
-
DatasetRowInputSchema = import_zod2.z.object({
|
|
6021
|
-
id: import_zod2.z.string().trim().min(1),
|
|
6022
|
-
name: import_zod2.z.string().optional(),
|
|
6023
|
-
input: import_zod2.z.string().nullable(),
|
|
6024
|
-
output: import_zod2.z.string().nullable().default(null),
|
|
6025
|
-
properties: import_zod2.z.record(import_zod2.z.string()).default({})
|
|
6026
|
-
});
|
|
6027
5774
|
BooleanThresholdSchema = import_zod2.z.object({ equals: import_zod2.z.boolean() }).strict();
|
|
6028
5775
|
FiniteThresholdSchema = import_zod2.z.number().finite();
|
|
6029
|
-
EvalOutputSchema = import_zod2.z.enum(["boolean", "score", "number"]);
|
|
6030
5776
|
NumericThresholdSchema = import_zod2.z.union([
|
|
6031
5777
|
import_zod2.z.object({ gte: FiniteThresholdSchema, lte: FiniteThresholdSchema.optional() }).strict(),
|
|
6032
5778
|
import_zod2.z.object({ lte: FiniteThresholdSchema }).strict()
|
|
@@ -6034,7 +5780,21 @@ var init_definition = __esm({
|
|
|
6034
5780
|
(threshold) => !("gte" in threshold) || threshold.lte === void 0 || threshold.gte <= threshold.lte,
|
|
6035
5781
|
{ message: "Lower threshold cannot exceed upper threshold" }
|
|
6036
5782
|
);
|
|
6037
|
-
|
|
5783
|
+
EvalSuiteManifestSchema = import_zod2.z.object({
|
|
5784
|
+
name: import_zod2.z.string().trim().min(1),
|
|
5785
|
+
dataset: import_zod2.z.string().trim().min(1),
|
|
5786
|
+
datasetVersionId: import_zod2.z.string().uuid().optional(),
|
|
5787
|
+
evaluators: import_zod2.z.array(
|
|
5788
|
+
import_zod2.z.object({
|
|
5789
|
+
evaluator: import_zod2.z.string().trim().min(1),
|
|
5790
|
+
threshold: import_zod2.z.union([BooleanThresholdSchema, NumericThresholdSchema]).optional()
|
|
5791
|
+
}).strict()
|
|
5792
|
+
).min(1),
|
|
5793
|
+
concurrency: import_zod2.z.number().int().positive().optional(),
|
|
5794
|
+
traceWaitMs: import_zod2.z.number().nonnegative().optional(),
|
|
5795
|
+
evalWaitMs: import_zod2.z.number().nonnegative().optional(),
|
|
5796
|
+
evalPollIntervalMs: import_zod2.z.number().positive().optional()
|
|
5797
|
+
}).strict();
|
|
6038
5798
|
}
|
|
6039
5799
|
});
|
|
6040
5800
|
|
|
@@ -6235,37 +5995,6 @@ function traceStepsToEntries(steps) {
|
|
|
6235
5995
|
function projectWorkshopTrace(input) {
|
|
6236
5996
|
return createTrace(input.origin, input.event, traceStepsToEntries(buildTraceSteps([...input.spans], { includePayloads: true })).map(boundEvalEntry));
|
|
6237
5997
|
}
|
|
6238
|
-
function projectCapturedEvent(input) {
|
|
6239
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6240
|
-
const ordered = [...input.spans].sort((left, right) => compareNanoseconds(left.start_unix_ns, right.start_unix_ns));
|
|
6241
|
-
const eventSpan = ordered.find((span) => span.span_id === `evt_${input.eventId}`);
|
|
6242
|
-
const llmSpans = ordered.filter((span) => span.span_type === "LLM_GENERATION" || span.span_type === "LLM_GENERATION_STREAM");
|
|
6243
|
-
const inputSpan = ((_a = eventSpan == null ? void 0 : eventSpan.input_payload) == null ? void 0 : _a.trim()) ? eventSpan : llmSpans.find((span) => {
|
|
6244
|
-
var _a2;
|
|
6245
|
-
return Boolean((_a2 = span.input_payload) == null ? void 0 : _a2.trim());
|
|
6246
|
-
});
|
|
6247
|
-
const reverseLlmSpans = [...llmSpans].reverse();
|
|
6248
|
-
const outputSpan = (_c = ((_b = eventSpan == null ? void 0 : eventSpan.output_payload) == null ? void 0 : _b.trim()) ? eventSpan : void 0) != null ? _c : reverseLlmSpans.find((span) => {
|
|
6249
|
-
var _a2;
|
|
6250
|
-
return Boolean((_a2 = span.output_payload) == null ? void 0 : _a2.trim()) && extractFinishReason(span) !== "tool-calls";
|
|
6251
|
-
});
|
|
6252
|
-
const modelSpan = (eventSpan == null ? void 0 : eventSpan.model) ? eventSpan : reverseLlmSpans.find((span) => Boolean(span.model));
|
|
6253
|
-
return AIAnalyticsEventSchema.parse({
|
|
6254
|
-
id: input.eventId,
|
|
6255
|
-
_raindropDatabaseId: input.internalEventId,
|
|
6256
|
-
name: input.name,
|
|
6257
|
-
timestamp: input.timestamp,
|
|
6258
|
-
receivedAt: input.receivedAt,
|
|
6259
|
-
userId: input.userId,
|
|
6260
|
-
aiData: {
|
|
6261
|
-
input: (_d = inputSpan == null ? void 0 : inputSpan.input_payload) != null ? _d : null,
|
|
6262
|
-
output: (_e = outputSpan == null ? void 0 : outputSpan.output_payload) != null ? _e : null,
|
|
6263
|
-
model: (_f = modelSpan == null ? void 0 : modelSpan.model) != null ? _f : null,
|
|
6264
|
-
convoId: input.convoId
|
|
6265
|
-
},
|
|
6266
|
-
properties: input.properties
|
|
6267
|
-
});
|
|
6268
|
-
}
|
|
6269
5998
|
function traceOutput(trace8) {
|
|
6270
5999
|
var _a;
|
|
6271
6000
|
return (_a = trace8.event.aiData.output) != null ? _a : null;
|
|
@@ -6273,11 +6002,19 @@ function traceOutput(trace8) {
|
|
|
6273
6002
|
function traceToolCalls(trace8, name) {
|
|
6274
6003
|
return trace8.entries.filter((entry) => entry.type === "tool_call" && (name === void 0 || entry.name === name));
|
|
6275
6004
|
}
|
|
6276
|
-
var import_zod3, 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, TraceSchema, CapturedTraceSpanSchema, EVAL_DATASET_MAX_SPANS_PER_TRACE,
|
|
6005
|
+
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_CUSTOM_ATTRIBUTES, MAX_ATTRIBUTE_VALUE_CHARS, KNOWN_ATTRIBUTE_PREFIXES, SENSITIVE_KEY_TOKENS, SENSITIVE_KEY_TOKEN_PAIRS, MAX_EVAL_PAYLOAD_RAW_CHARS, TRACE_PROJECTION_SHA256;
|
|
6277
6006
|
var init_trace = __esm({
|
|
6278
6007
|
"src/evals/generated/trace.ts"() {
|
|
6279
6008
|
"use strict";
|
|
6280
6009
|
import_zod3 = __toESM(require("zod"));
|
|
6010
|
+
JsonValueSchema = import_zod3.default.lazy(() => import_zod3.default.union([
|
|
6011
|
+
import_zod3.default.string(),
|
|
6012
|
+
import_zod3.default.number(),
|
|
6013
|
+
import_zod3.default.boolean(),
|
|
6014
|
+
import_zod3.default.null(),
|
|
6015
|
+
import_zod3.default.array(JsonValueSchema),
|
|
6016
|
+
import_zod3.default.record(JsonValueSchema)
|
|
6017
|
+
]));
|
|
6281
6018
|
stringToJSONSchema = import_zod3.default.string().transform((str, ctx) => {
|
|
6282
6019
|
try {
|
|
6283
6020
|
return JSON.parse(str);
|
|
@@ -6646,52 +6383,58 @@ var init_trace = __esm({
|
|
|
6646
6383
|
duration_ns: NanosecondsStringSchema,
|
|
6647
6384
|
_inserted_at: import_zod3.default.string().min(1)
|
|
6648
6385
|
}).strict();
|
|
6386
|
+
EvalDatasetCaseIdSchema = import_zod3.default.string().min(1).max(512).refine((value) => value === value.trim(), "Case id cannot have surrounding whitespace");
|
|
6387
|
+
EvalCaseExpectationSchema = import_zod3.default.object({
|
|
6388
|
+
description: import_zod3.default.string().trim().min(1).max(1e4),
|
|
6389
|
+
basis: import_zod3.default.enum(["human", "policy", "code", "inferred"]).optional(),
|
|
6390
|
+
reference: import_zod3.default.string().trim().min(1).max(2e3).optional()
|
|
6391
|
+
}).strict();
|
|
6649
6392
|
TraceSchema = import_zod3.default.object({
|
|
6650
6393
|
origin: import_zod3.default.enum(["production", "dataset", "simulation", "replay"]),
|
|
6651
6394
|
event: AIAnalyticsEventSchema,
|
|
6652
|
-
entries: import_zod3.default.array(RichInteractionEntrySchema)
|
|
6395
|
+
entries: import_zod3.default.array(RichInteractionEntrySchema),
|
|
6396
|
+
caseContext: import_zod3.default.object({ caseId: EvalDatasetCaseIdSchema, expectation: EvalCaseExpectationSchema.optional() }).optional()
|
|
6653
6397
|
});
|
|
6654
6398
|
CapturedTraceSpanSchema = ReplayTraceSnapshotSpanSchema;
|
|
6655
6399
|
EVAL_DATASET_MAX_SPANS_PER_TRACE = 500;
|
|
6656
|
-
EvalDatasetCaseIdSchema = import_zod3.default.string().min(1).max(512).refine((value) => value === value.trim(), "Case id cannot have surrounding whitespace");
|
|
6657
6400
|
CapturedTraceSnapshotSchema = import_zod3.default.object({
|
|
6658
6401
|
event: AIAnalyticsEventSchema,
|
|
6659
6402
|
spans: import_zod3.default.array(CapturedTraceSpanSchema).min(1).max(EVAL_DATASET_MAX_SPANS_PER_TRACE)
|
|
6660
|
-
}).strict().superRefine(({ event, spans },
|
|
6403
|
+
}).strict().superRefine(({ event, spans }, context8) => {
|
|
6661
6404
|
var _a;
|
|
6662
6405
|
const spanIds = /* @__PURE__ */ new Set();
|
|
6663
6406
|
const traceIds = /* @__PURE__ */ new Set();
|
|
6664
6407
|
for (const [index, span] of spans.entries()) {
|
|
6665
6408
|
if (!/^[0-9a-f]{32}$/.test(span.trace_id)) {
|
|
6666
|
-
|
|
6409
|
+
context8.addIssue({
|
|
6667
6410
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6668
6411
|
message: "Captured trace id must be a lowercase 32-character hexadecimal value",
|
|
6669
6412
|
path: ["spans", index, "trace_id"]
|
|
6670
6413
|
});
|
|
6671
6414
|
}
|
|
6672
6415
|
if (!/^[0-9a-f]{16}$/.test(span.span_id)) {
|
|
6673
|
-
|
|
6416
|
+
context8.addIssue({
|
|
6674
6417
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6675
6418
|
message: "Captured span id must be a lowercase 16-character hexadecimal value",
|
|
6676
6419
|
path: ["spans", index, "span_id"]
|
|
6677
6420
|
});
|
|
6678
6421
|
}
|
|
6679
6422
|
if (span.parent_span_id !== "" && !/^[0-9a-f]{16}$/.test(span.parent_span_id)) {
|
|
6680
|
-
|
|
6423
|
+
context8.addIssue({
|
|
6681
6424
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6682
6425
|
message: "Captured parent span id must be empty or lowercase hexadecimal",
|
|
6683
6426
|
path: ["spans", index, "parent_span_id"]
|
|
6684
6427
|
});
|
|
6685
6428
|
}
|
|
6686
6429
|
if (span.event_id.length === 0) {
|
|
6687
|
-
|
|
6430
|
+
context8.addIssue({
|
|
6688
6431
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6689
6432
|
message: "Captured event id cannot be empty",
|
|
6690
6433
|
path: ["spans", index, "event_id"]
|
|
6691
6434
|
});
|
|
6692
6435
|
}
|
|
6693
6436
|
if (spanIds.has(span.span_id)) {
|
|
6694
|
-
|
|
6437
|
+
context8.addIssue({
|
|
6695
6438
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6696
6439
|
message: `Duplicate span id ${span.span_id}`,
|
|
6697
6440
|
path: ["spans", index, "span_id"]
|
|
@@ -6700,7 +6443,7 @@ var init_trace = __esm({
|
|
|
6700
6443
|
spanIds.add(span.span_id);
|
|
6701
6444
|
traceIds.add(span.trace_id);
|
|
6702
6445
|
if (span.event_id !== event._raindropDatabaseId) {
|
|
6703
|
-
|
|
6446
|
+
context8.addIssue({
|
|
6704
6447
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6705
6448
|
message: "Span event identity does not match the captured event",
|
|
6706
6449
|
path: ["spans", index, "event_id"]
|
|
@@ -6709,7 +6452,7 @@ var init_trace = __esm({
|
|
|
6709
6452
|
const validStart = /^\d{1,20}$/.test(span.start_unix_ns);
|
|
6710
6453
|
const validEnd = /^\d{1,20}$/.test(span.end_unix_ns);
|
|
6711
6454
|
if (validStart && validEnd && (BigInt(span.start_unix_ns) === BigInt(0) || BigInt(span.end_unix_ns) < BigInt(span.start_unix_ns))) {
|
|
6712
|
-
|
|
6455
|
+
context8.addIssue({
|
|
6713
6456
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6714
6457
|
message: "A captured span must have an end time at or after its start time",
|
|
6715
6458
|
path: ["spans", index, "end_unix_ns"]
|
|
@@ -6717,28 +6460,19 @@ var init_trace = __esm({
|
|
|
6717
6460
|
}
|
|
6718
6461
|
}
|
|
6719
6462
|
if (traceIds.size !== 1) {
|
|
6720
|
-
|
|
6463
|
+
context8.addIssue({
|
|
6721
6464
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6722
6465
|
message: "A reference snapshot must contain exactly one trace id",
|
|
6723
6466
|
path: ["spans"]
|
|
6724
6467
|
});
|
|
6725
6468
|
}
|
|
6726
|
-
for (const [index, span] of spans.entries()) {
|
|
6727
|
-
if (span.parent_span_id && !spanIds.has(span.parent_span_id)) {
|
|
6728
|
-
context9.addIssue({
|
|
6729
|
-
code: import_zod3.default.ZodIssueCode.custom,
|
|
6730
|
-
message: `Missing parent span ${span.parent_span_id}`,
|
|
6731
|
-
path: ["spans", index, "parent_span_id"]
|
|
6732
|
-
});
|
|
6733
|
-
}
|
|
6734
|
-
}
|
|
6735
6469
|
const parentBySpanId = new Map(spans.map((span) => [span.span_id, span.parent_span_id]));
|
|
6736
6470
|
for (const [index, span] of spans.entries()) {
|
|
6737
6471
|
const path = /* @__PURE__ */ new Set();
|
|
6738
6472
|
let spanId = span.span_id;
|
|
6739
6473
|
while (spanId !== "") {
|
|
6740
6474
|
if (path.has(spanId)) {
|
|
6741
|
-
|
|
6475
|
+
context8.addIssue({
|
|
6742
6476
|
code: import_zod3.default.ZodIssueCode.custom,
|
|
6743
6477
|
message: "Captured span parent relationships cannot contain a cycle",
|
|
6744
6478
|
path: ["spans", index, "parent_span_id"]
|
|
@@ -6749,85 +6483,360 @@ var init_trace = __esm({
|
|
|
6749
6483
|
spanId = (_a = parentBySpanId.get(spanId)) != null ? _a : "";
|
|
6750
6484
|
}
|
|
6751
6485
|
}
|
|
6752
|
-
});
|
|
6753
|
-
EvalCaseTraceSchema = import_zod3.default.object({
|
|
6754
|
-
snapshot: CapturedTraceSnapshotSchema,
|
|
6755
|
-
trace: TraceSchema
|
|
6756
|
-
});
|
|
6757
|
-
EvalCaseTracePairSchema = import_zod3.default.object({
|
|
6758
|
-
caseId: EvalDatasetCaseIdSchema,
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
"
|
|
6771
|
-
"
|
|
6772
|
-
"
|
|
6773
|
-
"
|
|
6774
|
-
"
|
|
6775
|
-
"
|
|
6776
|
-
"
|
|
6777
|
-
"
|
|
6778
|
-
"
|
|
6779
|
-
"
|
|
6780
|
-
"
|
|
6781
|
-
"
|
|
6782
|
-
"
|
|
6783
|
-
"
|
|
6784
|
-
"
|
|
6785
|
-
"
|
|
6786
|
-
"
|
|
6787
|
-
"
|
|
6788
|
-
"
|
|
6789
|
-
"
|
|
6790
|
-
"
|
|
6791
|
-
"
|
|
6792
|
-
"
|
|
6793
|
-
"
|
|
6794
|
-
"
|
|
6795
|
-
"
|
|
6796
|
-
"
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
"
|
|
6801
|
-
"
|
|
6802
|
-
"
|
|
6803
|
-
"
|
|
6804
|
-
"
|
|
6805
|
-
"
|
|
6806
|
-
"
|
|
6807
|
-
"
|
|
6808
|
-
"
|
|
6809
|
-
"
|
|
6810
|
-
"
|
|
6811
|
-
"
|
|
6812
|
-
"
|
|
6813
|
-
"
|
|
6814
|
-
"
|
|
6815
|
-
"
|
|
6816
|
-
"
|
|
6817
|
-
"
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
"
|
|
6822
|
-
"
|
|
6823
|
-
"
|
|
6824
|
-
"
|
|
6825
|
-
"
|
|
6826
|
-
"
|
|
6827
|
-
"
|
|
6486
|
+
});
|
|
6487
|
+
EvalCaseTraceSchema = import_zod3.default.object({
|
|
6488
|
+
snapshot: CapturedTraceSnapshotSchema,
|
|
6489
|
+
trace: TraceSchema
|
|
6490
|
+
});
|
|
6491
|
+
EvalCaseTracePairSchema = import_zod3.default.object({
|
|
6492
|
+
caseId: EvalDatasetCaseIdSchema,
|
|
6493
|
+
output: JsonValueSchema.optional(),
|
|
6494
|
+
candidate: EvalCaseTraceSchema.extend({
|
|
6495
|
+
trace: TraceSchema.extend({ origin: import_zod3.default.enum(["replay", "dataset"]) })
|
|
6496
|
+
}),
|
|
6497
|
+
reference: EvalCaseTraceSchema.extend({
|
|
6498
|
+
trace: TraceSchema.extend({ origin: import_zod3.default.literal("dataset") })
|
|
6499
|
+
}).optional()
|
|
6500
|
+
});
|
|
6501
|
+
MAX_CUSTOM_ATTRIBUTES = 25;
|
|
6502
|
+
MAX_ATTRIBUTE_VALUE_CHARS = 500;
|
|
6503
|
+
KNOWN_ATTRIBUTE_PREFIXES = [
|
|
6504
|
+
"ai.",
|
|
6505
|
+
"gen_ai.",
|
|
6506
|
+
"llm.",
|
|
6507
|
+
"openinference.",
|
|
6508
|
+
"traceloop.",
|
|
6509
|
+
"raindrop.",
|
|
6510
|
+
"otel.",
|
|
6511
|
+
"telemetry.",
|
|
6512
|
+
"service.",
|
|
6513
|
+
"resource.",
|
|
6514
|
+
"http.",
|
|
6515
|
+
"net.",
|
|
6516
|
+
"network.",
|
|
6517
|
+
"server.",
|
|
6518
|
+
"client.",
|
|
6519
|
+
"url.",
|
|
6520
|
+
"rpc.",
|
|
6521
|
+
"db.",
|
|
6522
|
+
"messaging.",
|
|
6523
|
+
"code.",
|
|
6524
|
+
"thread.",
|
|
6525
|
+
"session.",
|
|
6526
|
+
"user_agent.",
|
|
6527
|
+
"process.",
|
|
6528
|
+
"host.",
|
|
6529
|
+
"os.",
|
|
6530
|
+
"exception.",
|
|
6531
|
+
"span."
|
|
6532
|
+
];
|
|
6533
|
+
SENSITIVE_KEY_TOKENS = /* @__PURE__ */ new Set([
|
|
6534
|
+
"secret",
|
|
6535
|
+
"secrets",
|
|
6536
|
+
"secretkey",
|
|
6537
|
+
"password",
|
|
6538
|
+
"passwd",
|
|
6539
|
+
"pwd",
|
|
6540
|
+
"token",
|
|
6541
|
+
"tokens",
|
|
6542
|
+
"auth",
|
|
6543
|
+
"authorization",
|
|
6544
|
+
"credential",
|
|
6545
|
+
"credentials",
|
|
6546
|
+
"bearer",
|
|
6547
|
+
"cookie",
|
|
6548
|
+
"cookies",
|
|
6549
|
+
"apikey",
|
|
6550
|
+
"accesskey",
|
|
6551
|
+
"privatekey",
|
|
6552
|
+
"sessionid"
|
|
6553
|
+
]);
|
|
6554
|
+
SENSITIVE_KEY_TOKEN_PAIRS = /* @__PURE__ */ new Set([
|
|
6555
|
+
"api key",
|
|
6556
|
+
"access key",
|
|
6557
|
+
"private key",
|
|
6558
|
+
"secret key",
|
|
6559
|
+
"session id",
|
|
6560
|
+
"auth token",
|
|
6561
|
+
"access token",
|
|
6562
|
+
"refresh token"
|
|
6563
|
+
]);
|
|
6564
|
+
MAX_EVAL_PAYLOAD_RAW_CHARS = 16 * 1024;
|
|
6565
|
+
TRACE_PROJECTION_SHA256 = "22c666c6ace47d74d3f7dc477e68b27547257b319ba4014a4a32fbf977baac72";
|
|
6566
|
+
}
|
|
6567
|
+
});
|
|
6568
|
+
|
|
6569
|
+
// src/evals/definition.ts
|
|
6570
|
+
function defineDataset(dataset) {
|
|
6571
|
+
var _a, _b;
|
|
6572
|
+
const id = dataset.id.trim();
|
|
6573
|
+
const name = dataset.name.trim();
|
|
6574
|
+
const rows = dataset.rows.map((row) => {
|
|
6575
|
+
var _a2;
|
|
6576
|
+
const parsed = DatasetRowInputSchema.parse(row);
|
|
6577
|
+
return {
|
|
6578
|
+
id: parsed.id,
|
|
6579
|
+
name: (_a2 = parsed.name) != null ? _a2 : parsed.id,
|
|
6580
|
+
input: parsed.input,
|
|
6581
|
+
output: parsed.output,
|
|
6582
|
+
properties: parsed.properties
|
|
6583
|
+
};
|
|
6584
|
+
});
|
|
6585
|
+
const version = (_b = (_a = dataset.version) == null ? void 0 : _a.trim()) != null ? _b : (0, import_node_crypto2.createHash)("sha256").update(
|
|
6586
|
+
JSON.stringify(
|
|
6587
|
+
rows.map((row) => ({
|
|
6588
|
+
...row,
|
|
6589
|
+
properties: Object.fromEntries(
|
|
6590
|
+
Object.keys(row.properties).sort().map((key) => [key, row.properties[key]])
|
|
6591
|
+
)
|
|
6592
|
+
}))
|
|
6593
|
+
)
|
|
6594
|
+
).digest("hex");
|
|
6595
|
+
if (!id) throw new Error("Raindrop eval dataset ids cannot be empty");
|
|
6596
|
+
if (!name) throw new Error("Raindrop eval dataset names cannot be empty");
|
|
6597
|
+
if (!version) throw new Error("Raindrop eval dataset versions cannot be empty");
|
|
6598
|
+
if (dataset.rows.length === 0) throw new Error("Raindrop eval datasets require at least one row");
|
|
6599
|
+
const ids = rows.map((entry) => entry.id);
|
|
6600
|
+
if (ids.some((rowId) => !rowId)) throw new Error("Raindrop eval row ids cannot be empty");
|
|
6601
|
+
if (new Set(ids).size !== ids.length) throw new Error("Raindrop eval row ids must be unique");
|
|
6602
|
+
if (dataset.remote) {
|
|
6603
|
+
if (!dataset.remote.reference.trim())
|
|
6604
|
+
throw new Error("Raindrop remote dataset reference cannot be empty");
|
|
6605
|
+
if (!/^[a-f0-9]{64}$/.test(dataset.remote.fingerprint)) {
|
|
6606
|
+
throw new Error("Raindrop remote dataset fingerprint must be a SHA-256 digest");
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
const defined2 = {
|
|
6610
|
+
...dataset,
|
|
6611
|
+
id,
|
|
6612
|
+
name,
|
|
6613
|
+
version,
|
|
6614
|
+
rows,
|
|
6615
|
+
[EVAL_DATASET]: true
|
|
6616
|
+
};
|
|
6617
|
+
Object.defineProperty(defined2, EVAL_DATASET, { enumerable: false });
|
|
6618
|
+
return defined2;
|
|
6619
|
+
}
|
|
6620
|
+
function isEvalDataset(value) {
|
|
6621
|
+
return typeof value === "object" && value !== null && EVAL_DATASET in value && value[EVAL_DATASET] === true;
|
|
6622
|
+
}
|
|
6623
|
+
function defineEvaluatorProgram(program) {
|
|
6624
|
+
var _a, _b, _c, _d;
|
|
6625
|
+
const slug = program.slug.trim();
|
|
6626
|
+
const name = program.name.trim();
|
|
6627
|
+
const source = program.source.trim();
|
|
6628
|
+
const intent = program.intent.trim();
|
|
6629
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug) || slug.length > 64) {
|
|
6630
|
+
throw new Error(
|
|
6631
|
+
"Raindrop evaluator program slugs must use lowercase letters, numbers, and single hyphens"
|
|
6632
|
+
);
|
|
6633
|
+
}
|
|
6634
|
+
if (!name || name.length > 120) {
|
|
6635
|
+
throw new Error("Raindrop evaluator program names must be between 1 and 120 characters");
|
|
6636
|
+
}
|
|
6637
|
+
if (!source) throw new Error(`Raindrop evaluator program ${slug} source cannot be empty`);
|
|
6638
|
+
if (!intent || intent.length > 1e4) {
|
|
6639
|
+
throw new Error(
|
|
6640
|
+
`Raindrop evaluator program ${slug} intent must be between 1 and 10000 characters`
|
|
6641
|
+
);
|
|
6642
|
+
}
|
|
6643
|
+
if (program.description != null && program.description.trim().length > 2e3) {
|
|
6644
|
+
throw new Error(`Raindrop evaluator program ${slug} description exceeds 2000 characters`);
|
|
6645
|
+
}
|
|
6646
|
+
const rules = (_b = (_a = program.rules) == null ? void 0 : _a.map((rule) => rule.trim())) != null ? _b : [];
|
|
6647
|
+
if (rules.length > 12 || rules.some((rule) => !rule || rule.length > 2e3)) {
|
|
6648
|
+
throw new Error(`Raindrop evaluator program ${slug} rules are invalid`);
|
|
6649
|
+
}
|
|
6650
|
+
if (program.expected && (!import_zod4.z.string().uuid().safeParse(program.expected.evalId).success || !Number.isInteger(program.expected.programVersion) || program.expected.programVersion <= 0)) {
|
|
6651
|
+
throw new Error(`Raindrop evaluator program ${slug} expected identity is invalid`);
|
|
6652
|
+
}
|
|
6653
|
+
return {
|
|
6654
|
+
...program,
|
|
6655
|
+
kind: "program",
|
|
6656
|
+
scope: import_zod4.z.literal("batch").parse((_c = program.scope) != null ? _c : "batch"),
|
|
6657
|
+
slug,
|
|
6658
|
+
name,
|
|
6659
|
+
source,
|
|
6660
|
+
intent,
|
|
6661
|
+
description: ((_d = program.description) == null ? void 0 : _d.trim()) || null,
|
|
6662
|
+
rules
|
|
6663
|
+
};
|
|
6664
|
+
}
|
|
6665
|
+
function defineLocalEvaluator(evaluator) {
|
|
6666
|
+
var _a;
|
|
6667
|
+
return { ...evaluator, scope: import_zod4.z.literal("row").parse((_a = evaluator.scope) != null ? _a : "row") };
|
|
6668
|
+
}
|
|
6669
|
+
function defineEvalSuite(definition, binding) {
|
|
6670
|
+
if (binding) return createEvalSuite({ ...EvalSuiteManifestSchema.parse(definition), ...binding });
|
|
6671
|
+
if (!("run" in definition) && !("agent" in definition)) {
|
|
6672
|
+
throw new Error("Bind the eval manifest to your local run function or agent");
|
|
6673
|
+
}
|
|
6674
|
+
return createEvalSuite(definition);
|
|
6675
|
+
}
|
|
6676
|
+
function createEvalSuite(definition) {
|
|
6677
|
+
const name = definition.name.trim();
|
|
6678
|
+
if (name.length === 0) throw new Error("Raindrop eval suite names cannot be empty");
|
|
6679
|
+
const dataset = typeof definition.dataset === "string" ? definition.dataset.trim() : defineDataset(definition.dataset);
|
|
6680
|
+
if (typeof dataset === "string" && dataset.length === 0) {
|
|
6681
|
+
throw new Error("Raindrop eval suite datasets cannot be empty");
|
|
6682
|
+
}
|
|
6683
|
+
if (definition.datasetVersionId !== void 0) {
|
|
6684
|
+
import_zod4.z.string().uuid().parse(definition.datasetVersionId);
|
|
6685
|
+
if (typeof dataset !== "string")
|
|
6686
|
+
throw new Error("A dataset version pin requires a published dataset slug");
|
|
6687
|
+
}
|
|
6688
|
+
if (definition.agent !== void 0 && definition.run !== void 0) {
|
|
6689
|
+
throw new Error("An eval suite accepts either agent or run, not both");
|
|
6690
|
+
}
|
|
6691
|
+
if (definition.agent === void 0 && typeof definition.run !== "function") {
|
|
6692
|
+
throw new Error("Raindrop eval suite run must be a function");
|
|
6693
|
+
}
|
|
6694
|
+
if (!Array.isArray(definition.evaluators) || definition.evaluators.length === 0) {
|
|
6695
|
+
throw new Error("Raindrop eval suites require at least one evaluator");
|
|
6696
|
+
}
|
|
6697
|
+
validateOptionalNumber("concurrency", definition.concurrency, true, false);
|
|
6698
|
+
validateOptionalNumber("traceWaitMs", definition.traceWaitMs, false, true);
|
|
6699
|
+
validateOptionalNumber("evalWaitMs", definition.evalWaitMs, false, true);
|
|
6700
|
+
validateOptionalNumber("evalPollIntervalMs", definition.evalPollIntervalMs, false, false);
|
|
6701
|
+
const evaluators = definition.evaluators.map((evaluator) => validateEvaluator(evaluator));
|
|
6702
|
+
const evaluatorNames = evaluators.map((entry) => evaluatorName(entry));
|
|
6703
|
+
if (new Set(evaluatorNames).size !== evaluatorNames.length) {
|
|
6704
|
+
throw new Error("Raindrop eval suite evaluators must be unique");
|
|
6705
|
+
}
|
|
6706
|
+
const branded = {
|
|
6707
|
+
...definition,
|
|
6708
|
+
[EVAL_DEFINITION]: true,
|
|
6709
|
+
name,
|
|
6710
|
+
dataset,
|
|
6711
|
+
evaluators
|
|
6712
|
+
};
|
|
6713
|
+
Object.defineProperty(branded, EVAL_DEFINITION, { enumerable: false });
|
|
6714
|
+
return branded;
|
|
6715
|
+
}
|
|
6716
|
+
function isEvalSuiteDefinition(value) {
|
|
6717
|
+
return typeof value === "object" && value !== null && EVAL_DEFINITION in value && value[EVAL_DEFINITION] === true;
|
|
6718
|
+
}
|
|
6719
|
+
function isPublishedEvalSuite(definition) {
|
|
6720
|
+
return typeof definition.dataset === "string" && definition.datasetVersionId !== void 0 && definition.evaluators.every(
|
|
6721
|
+
({ evaluator }) => typeof evaluator !== "string" && (!("kind" in evaluator) || evaluator.kind !== "program" || evaluator.expected !== void 0)
|
|
6722
|
+
);
|
|
6723
|
+
}
|
|
6724
|
+
function evaluatorName(evaluator) {
|
|
6725
|
+
return typeof evaluator.evaluator === "string" ? evaluator.evaluator.trim() : evaluator.evaluator.slug.trim();
|
|
6726
|
+
}
|
|
6727
|
+
function evaluatorOutput(evaluator) {
|
|
6728
|
+
return typeof evaluator.evaluator === "string" ? void 0 : evaluator.evaluator.output;
|
|
6729
|
+
}
|
|
6730
|
+
function validateEvaluatorOutput(evaluator, rawOutput) {
|
|
6731
|
+
const name = evaluatorName(evaluator);
|
|
6732
|
+
const output = EvalOutputSchema.parse(rawOutput);
|
|
6733
|
+
const localOutput = evaluatorOutput(evaluator);
|
|
6734
|
+
if (localOutput !== void 0 && localOutput !== output) {
|
|
6735
|
+
throw new Error(`Raindrop local evaluator ${name} expected ${localOutput}, received ${output}`);
|
|
6736
|
+
}
|
|
6737
|
+
switch (output) {
|
|
6738
|
+
case "boolean":
|
|
6739
|
+
parseBooleanThreshold(evaluator.threshold);
|
|
6740
|
+
break;
|
|
6741
|
+
case "score":
|
|
6742
|
+
parseNumericThreshold(name, "score", evaluator.threshold);
|
|
6743
|
+
break;
|
|
6744
|
+
case "number":
|
|
6745
|
+
parseNumericThreshold(name, "number", evaluator.threshold);
|
|
6746
|
+
break;
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
function validateEvaluator(evaluator) {
|
|
6750
|
+
if (typeof evaluator !== "object" || evaluator === null || !("evaluator" in evaluator)) {
|
|
6751
|
+
throw new Error("Raindrop eval evaluator entries must name an evaluator");
|
|
6752
|
+
}
|
|
6753
|
+
if ("output" in evaluator) {
|
|
6754
|
+
throw new Error(
|
|
6755
|
+
"Raindrop eval evaluator entries do not accept output; the evaluator definition owns it"
|
|
6756
|
+
);
|
|
6757
|
+
}
|
|
6758
|
+
if (typeof evaluator.evaluator !== "string" && (typeof evaluator.evaluator !== "object" || evaluator.evaluator === null || typeof evaluator.evaluator.slug !== "string" || typeof evaluator.evaluator.name !== "string")) {
|
|
6759
|
+
throw new Error("Raindrop local eval evaluators require a slug, name, output, and judge");
|
|
6760
|
+
}
|
|
6761
|
+
const name = evaluatorName(evaluator);
|
|
6762
|
+
if (name.length === 0) throw new Error("Raindrop eval evaluator names cannot be empty");
|
|
6763
|
+
if (typeof evaluator.evaluator === "string") {
|
|
6764
|
+
const threshold = evaluator.threshold;
|
|
6765
|
+
if (threshold !== void 0) {
|
|
6766
|
+
const boolean = BooleanThresholdSchema.safeParse(threshold);
|
|
6767
|
+
const numeric = NumericThresholdSchema.safeParse(threshold);
|
|
6768
|
+
if (!boolean.success && !numeric.success) {
|
|
6769
|
+
throw new Error(`Raindrop hosted evaluator ${name} has an invalid threshold`);
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
return { ...evaluator, evaluator: name };
|
|
6773
|
+
}
|
|
6774
|
+
if ("kind" in evaluator.evaluator && evaluator.evaluator.kind === "portable") {
|
|
6775
|
+
validateEvaluatorOutput(evaluator, evaluator.evaluator.output);
|
|
6776
|
+
return evaluator;
|
|
6777
|
+
}
|
|
6778
|
+
if ("kind" in evaluator.evaluator && evaluator.evaluator.kind === "program") {
|
|
6779
|
+
const program = defineEvaluatorProgram(evaluator.evaluator);
|
|
6780
|
+
validateEvaluatorOutput({ ...evaluator, evaluator: program }, program.output);
|
|
6781
|
+
return { ...evaluator, evaluator: program };
|
|
6782
|
+
}
|
|
6783
|
+
if (typeof evaluator.evaluator.judge !== "function") {
|
|
6784
|
+
throw new Error(`Raindrop local evaluator ${name} judge must be a function`);
|
|
6785
|
+
}
|
|
6786
|
+
if (evaluator.evaluator.scope !== "row") {
|
|
6787
|
+
throw new Error(`Raindrop local evaluator ${name} scope must be row`);
|
|
6788
|
+
}
|
|
6789
|
+
const output = EvalOutputSchema.parse(evaluator.evaluator.output);
|
|
6790
|
+
validateEvaluatorOutput(evaluator, output);
|
|
6791
|
+
return evaluator;
|
|
6792
|
+
}
|
|
6793
|
+
function validateOptionalNumber(name, value, integer, allowZero) {
|
|
6794
|
+
if (value === void 0) return;
|
|
6795
|
+
const valid = Number.isFinite(value) && (!integer || Number.isInteger(value)) && (allowZero ? value >= 0 : value > 0);
|
|
6796
|
+
if (!valid) {
|
|
6797
|
+
const kind = integer ? "a positive integer" : allowZero ? "non-negative" : "positive";
|
|
6798
|
+
throw new Error(`Raindrop eval ${name} must be ${kind}`);
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
function parseBooleanThreshold(threshold) {
|
|
6802
|
+
return threshold === void 0 ? void 0 : BooleanThresholdSchema.parse(threshold);
|
|
6803
|
+
}
|
|
6804
|
+
function parseNumericThreshold(name, output, threshold) {
|
|
6805
|
+
const parsed = threshold === void 0 ? void 0 : NumericThresholdSchema.parse(threshold);
|
|
6806
|
+
if (output === "score" && parsed) {
|
|
6807
|
+
const lower = "gte" in parsed ? parsed.gte : void 0;
|
|
6808
|
+
const inRange = (lower === void 0 || lower >= 1 && lower <= 5) && (parsed.lte === void 0 || parsed.lte >= 1 && parsed.lte <= 5);
|
|
6809
|
+
if (!inRange)
|
|
6810
|
+
throw new Error(`Raindrop score evaluator ${name} thresholds must be from 1 to 5`);
|
|
6811
|
+
}
|
|
6812
|
+
return parsed;
|
|
6813
|
+
}
|
|
6814
|
+
var import_node_crypto2, import_zod4, EvalScoreSchema, EVAL_DATASET, DatasetRowInputSchema, EvalOutputSchema, EVAL_DEFINITION;
|
|
6815
|
+
var init_definition = __esm({
|
|
6816
|
+
"src/evals/definition.ts"() {
|
|
6817
|
+
"use strict";
|
|
6818
|
+
import_node_crypto2 = require("crypto");
|
|
6819
|
+
import_zod4 = require("zod");
|
|
6820
|
+
init_manifest();
|
|
6821
|
+
init_trace();
|
|
6822
|
+
init_manifest();
|
|
6823
|
+
EvalScoreSchema = import_zod4.z.union([
|
|
6824
|
+
import_zod4.z.literal(1),
|
|
6825
|
+
import_zod4.z.literal(2),
|
|
6826
|
+
import_zod4.z.literal(3),
|
|
6827
|
+
import_zod4.z.literal(4),
|
|
6828
|
+
import_zod4.z.literal(5)
|
|
6828
6829
|
]);
|
|
6829
|
-
|
|
6830
|
-
|
|
6830
|
+
EVAL_DATASET = /* @__PURE__ */ Symbol.for("raindrop.evalDataset");
|
|
6831
|
+
DatasetRowInputSchema = import_zod4.z.object({
|
|
6832
|
+
id: import_zod4.z.string().trim().min(1),
|
|
6833
|
+
name: import_zod4.z.string().optional(),
|
|
6834
|
+
input: import_zod4.z.string().nullable(),
|
|
6835
|
+
output: JsonValueSchema.default(null),
|
|
6836
|
+
properties: import_zod4.z.record(import_zod4.z.string()).default({})
|
|
6837
|
+
});
|
|
6838
|
+
EvalOutputSchema = import_zod4.z.enum(["boolean", "score", "number"]);
|
|
6839
|
+
EVAL_DEFINITION = /* @__PURE__ */ Symbol.for("raindrop.evalDefinition");
|
|
6831
6840
|
}
|
|
6832
6841
|
});
|
|
6833
6842
|
|
|
@@ -6850,7 +6859,7 @@ async function runPortableEvaluator(evaluator, input) {
|
|
|
6850
6859
|
const timeoutMs = (_h = (_g = evaluator.limits) == null ? void 0 : _g.timeoutMs) != null ? _h : evaluator.artifact.evaluator.executionMode === "judge" ? DEFAULT_JUDGE_TIMEOUT_MS : DEFAULT_TIMEOUT_MS;
|
|
6851
6860
|
const deadline = Date.now() + timeoutMs;
|
|
6852
6861
|
runtime.setInterruptHandler((0, import_quickjs_emscripten_core.shouldInterruptAfterDeadline)(deadline));
|
|
6853
|
-
const
|
|
6862
|
+
const context8 = runtime.newContext();
|
|
6854
6863
|
const deferreds = [];
|
|
6855
6864
|
const hostCalls = /* @__PURE__ */ new Set();
|
|
6856
6865
|
const tracesById = new Map(input.traces.map((trace8) => [trace8.event.id, trace8]));
|
|
@@ -6859,11 +6868,11 @@ async function runPortableEvaluator(evaluator, input) {
|
|
|
6859
6868
|
);
|
|
6860
6869
|
let activeJudgeCalls = 0;
|
|
6861
6870
|
try {
|
|
6862
|
-
const bridge =
|
|
6871
|
+
const bridge = context8.newFunction("__raindrop_eval_judge", (requestHandle) => {
|
|
6863
6872
|
var _a2, _b2;
|
|
6864
|
-
const deferred =
|
|
6873
|
+
const deferred = context8.newPromise();
|
|
6865
6874
|
deferreds.push(deferred);
|
|
6866
|
-
const requestJson =
|
|
6875
|
+
const requestJson = context8.getString(requestHandle);
|
|
6867
6876
|
const judgeConcurrency = (_b2 = (_a2 = evaluator.limits) == null ? void 0 : _a2.judgeConcurrency) != null ? _b2 : DEFAULT_JUDGE_CONCURRENCY;
|
|
6868
6877
|
let acquired = false;
|
|
6869
6878
|
const hostCall = resolveJudge(
|
|
@@ -6879,7 +6888,7 @@ async function runPortableEvaluator(evaluator, input) {
|
|
|
6879
6888
|
return true;
|
|
6880
6889
|
}
|
|
6881
6890
|
).then((responseJson) => {
|
|
6882
|
-
const response =
|
|
6891
|
+
const response = context8.newString(responseJson);
|
|
6883
6892
|
try {
|
|
6884
6893
|
deferred.resolve(response);
|
|
6885
6894
|
} finally {
|
|
@@ -6892,26 +6901,26 @@ async function runPortableEvaluator(evaluator, input) {
|
|
|
6892
6901
|
hostCalls.add(hostCall);
|
|
6893
6902
|
return deferred.handle;
|
|
6894
6903
|
});
|
|
6895
|
-
|
|
6904
|
+
context8.setProp(context8.global, "__raindrop_eval_judge", bridge);
|
|
6896
6905
|
bridge.dispose();
|
|
6897
|
-
const loaded =
|
|
6898
|
-
|
|
6899
|
-
const entrypoint =
|
|
6900
|
-
const inputHandle =
|
|
6906
|
+
const loaded = context8.evalCode(evaluator.artifact.source, "raindrop-evaluator.js");
|
|
6907
|
+
context8.unwrapResult(loaded).dispose();
|
|
6908
|
+
const entrypoint = context8.getProp(context8.global, "__raindrop_eval_run");
|
|
6909
|
+
const inputHandle = context8.newString(inputJson);
|
|
6901
6910
|
let promiseHandle;
|
|
6902
6911
|
try {
|
|
6903
|
-
promiseHandle =
|
|
6904
|
-
|
|
6912
|
+
promiseHandle = context8.unwrapResult(
|
|
6913
|
+
context8.callFunction(entrypoint, context8.global, inputHandle)
|
|
6905
6914
|
);
|
|
6906
6915
|
} finally {
|
|
6907
6916
|
inputHandle.dispose();
|
|
6908
6917
|
entrypoint.dispose();
|
|
6909
6918
|
}
|
|
6910
6919
|
try {
|
|
6911
|
-
const result = await drivePromise(runtime,
|
|
6912
|
-
const outputHandle =
|
|
6920
|
+
const result = await drivePromise(runtime, context8, promiseHandle, deadline);
|
|
6921
|
+
const outputHandle = context8.unwrapResult(result);
|
|
6913
6922
|
try {
|
|
6914
|
-
const outputJson =
|
|
6923
|
+
const outputJson = context8.getString(outputHandle);
|
|
6915
6924
|
const maxOutputBytes = (_j = (_i = evaluator.limits) == null ? void 0 : _i.maxOutputBytes) != null ? _j : DEFAULT_MAX_OUTPUT_BYTES;
|
|
6916
6925
|
if (byteLength(outputJson) > maxOutputBytes) {
|
|
6917
6926
|
throw new Error(`Raindrop portable evaluator output exceeds ${maxOutputBytes} bytes`);
|
|
@@ -6936,14 +6945,14 @@ async function runPortableEvaluator(evaluator, input) {
|
|
|
6936
6945
|
} finally {
|
|
6937
6946
|
await Promise.allSettled([...hostCalls]);
|
|
6938
6947
|
for (const deferred of deferreds) deferred.dispose();
|
|
6939
|
-
|
|
6948
|
+
context8.dispose();
|
|
6940
6949
|
runtime.dispose();
|
|
6941
6950
|
}
|
|
6942
6951
|
}
|
|
6943
|
-
async function drivePromise(runtime,
|
|
6952
|
+
async function drivePromise(runtime, context8, promise, deadline) {
|
|
6944
6953
|
while (true) {
|
|
6945
6954
|
runtime.executePendingJobs(100).unwrap();
|
|
6946
|
-
const state2 =
|
|
6955
|
+
const state2 = context8.getPromiseState(promise);
|
|
6947
6956
|
if (state2.type === "fulfilled") return { value: state2.value };
|
|
6948
6957
|
if (state2.type === "rejected") return { error: state2.error };
|
|
6949
6958
|
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
@@ -7005,13 +7014,13 @@ function rowTracePair(pair) {
|
|
|
7005
7014
|
const { caseId, ...evidence } = pair;
|
|
7006
7015
|
return { ...evidence, rowId: caseId };
|
|
7007
7016
|
}
|
|
7008
|
-
var import_quickjs_singlefile_cjs_release_sync, import_quickjs_emscripten_core,
|
|
7017
|
+
var import_quickjs_singlefile_cjs_release_sync, import_quickjs_emscripten_core, import_zod10, DEFAULT_MEMORY_BYTES, DEFAULT_STACK_BYTES, DEFAULT_TIMEOUT_MS, DEFAULT_JUDGE_TIMEOUT_MS, DEFAULT_JUDGE_REQUEST_TIMEOUT_MS, DEFAULT_JUDGE_CONCURRENCY, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_BYTES, JudgeRequestSchema;
|
|
7009
7018
|
var init_portable_runtime = __esm({
|
|
7010
7019
|
"src/evals/portable-runtime.ts"() {
|
|
7011
7020
|
"use strict";
|
|
7012
7021
|
import_quickjs_singlefile_cjs_release_sync = __toESM(require("@jitl/quickjs-singlefile-cjs-release-sync"));
|
|
7013
7022
|
import_quickjs_emscripten_core = require("quickjs-emscripten-core");
|
|
7014
|
-
|
|
7023
|
+
import_zod10 = require("zod");
|
|
7015
7024
|
init_portable();
|
|
7016
7025
|
DEFAULT_MEMORY_BYTES = 32 * 1024 * 1024;
|
|
7017
7026
|
DEFAULT_STACK_BYTES = 64 * 1024;
|
|
@@ -7021,11 +7030,11 @@ var init_portable_runtime = __esm({
|
|
|
7021
7030
|
DEFAULT_JUDGE_CONCURRENCY = 4;
|
|
7022
7031
|
DEFAULT_MAX_INPUT_BYTES = 4 * 1024 * 1024;
|
|
7023
7032
|
DEFAULT_MAX_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
7024
|
-
JudgeRequestSchema =
|
|
7025
|
-
type:
|
|
7026
|
-
requestId:
|
|
7027
|
-
traceId:
|
|
7028
|
-
rubric:
|
|
7033
|
+
JudgeRequestSchema = import_zod10.z.object({
|
|
7034
|
+
type: import_zod10.z.literal("judge_request"),
|
|
7035
|
+
requestId: import_zod10.z.string(),
|
|
7036
|
+
traceId: import_zod10.z.string(),
|
|
7037
|
+
rubric: import_zod10.z.string()
|
|
7029
7038
|
});
|
|
7030
7039
|
}
|
|
7031
7040
|
});
|
|
@@ -7137,67 +7146,67 @@ function canonicalJson2(value) {
|
|
|
7137
7146
|
if (Array.isArray(value)) return `[${value.map(canonicalJson2).join(",")}]`;
|
|
7138
7147
|
return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson2(entry)}`).join(",")}}`;
|
|
7139
7148
|
}
|
|
7140
|
-
var
|
|
7149
|
+
var import_zod11, PortableEvalArtifactSchema, PortableEvalResultSchema;
|
|
7141
7150
|
var init_portable = __esm({
|
|
7142
7151
|
"src/evals/portable.ts"() {
|
|
7143
7152
|
"use strict";
|
|
7144
|
-
|
|
7153
|
+
import_zod11 = require("zod");
|
|
7145
7154
|
init_definition();
|
|
7146
7155
|
init_trace();
|
|
7147
|
-
PortableEvalArtifactSchema =
|
|
7148
|
-
format:
|
|
7149
|
-
formatVersion:
|
|
7150
|
-
runtimeAbi:
|
|
7151
|
-
evaluator:
|
|
7152
|
-
id:
|
|
7153
|
-
slug:
|
|
7154
|
-
programVersion:
|
|
7155
|
-
executionMode:
|
|
7156
|
-
outputType:
|
|
7157
|
-
scope:
|
|
7156
|
+
PortableEvalArtifactSchema = import_zod11.z.object({
|
|
7157
|
+
format: import_zod11.z.literal("raindrop.eval-program"),
|
|
7158
|
+
formatVersion: import_zod11.z.literal(1),
|
|
7159
|
+
runtimeAbi: import_zod11.z.literal("raindrop-eval-v2"),
|
|
7160
|
+
evaluator: import_zod11.z.object({
|
|
7161
|
+
id: import_zod11.z.string().uuid(),
|
|
7162
|
+
slug: import_zod11.z.string().min(1),
|
|
7163
|
+
programVersion: import_zod11.z.number().int().positive(),
|
|
7164
|
+
executionMode: import_zod11.z.enum(["deterministic", "judge"]),
|
|
7165
|
+
outputType: import_zod11.z.enum(["boolean", "score", "number"]),
|
|
7166
|
+
scope: import_zod11.z.literal("batch")
|
|
7158
7167
|
}).strict(),
|
|
7159
|
-
traceProjectionVersion:
|
|
7160
|
-
traceProjectionSha256:
|
|
7161
|
-
source:
|
|
7162
|
-
sha256:
|
|
7168
|
+
traceProjectionVersion: import_zod11.z.literal(1),
|
|
7169
|
+
traceProjectionSha256: import_zod11.z.string().regex(/^[a-f0-9]{64}$/),
|
|
7170
|
+
source: import_zod11.z.string().min(1),
|
|
7171
|
+
sha256: import_zod11.z.string().regex(/^[a-f0-9]{64}$/)
|
|
7163
7172
|
}).strict();
|
|
7164
|
-
PortableEvalResultSchema =
|
|
7165
|
-
outcomes:
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
state:
|
|
7169
|
-
traceId:
|
|
7170
|
-
pass:
|
|
7171
|
-
note:
|
|
7173
|
+
PortableEvalResultSchema = import_zod11.z.object({
|
|
7174
|
+
outcomes: import_zod11.z.array(
|
|
7175
|
+
import_zod11.z.union([
|
|
7176
|
+
import_zod11.z.object({
|
|
7177
|
+
state: import_zod11.z.literal("graded"),
|
|
7178
|
+
traceId: import_zod11.z.string(),
|
|
7179
|
+
pass: import_zod11.z.boolean(),
|
|
7180
|
+
note: import_zod11.z.string().optional()
|
|
7172
7181
|
}),
|
|
7173
|
-
|
|
7174
|
-
state:
|
|
7175
|
-
traceId:
|
|
7182
|
+
import_zod11.z.object({
|
|
7183
|
+
state: import_zod11.z.literal("graded"),
|
|
7184
|
+
traceId: import_zod11.z.string(),
|
|
7176
7185
|
score: EvalScoreSchema,
|
|
7177
|
-
note:
|
|
7186
|
+
note: import_zod11.z.string().optional()
|
|
7178
7187
|
}),
|
|
7179
|
-
|
|
7180
|
-
state:
|
|
7181
|
-
traceId:
|
|
7182
|
-
value:
|
|
7183
|
-
note:
|
|
7188
|
+
import_zod11.z.object({
|
|
7189
|
+
state: import_zod11.z.literal("graded"),
|
|
7190
|
+
traceId: import_zod11.z.string(),
|
|
7191
|
+
value: import_zod11.z.number().finite(),
|
|
7192
|
+
note: import_zod11.z.string().optional()
|
|
7184
7193
|
}),
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
state:
|
|
7188
|
-
traceId:
|
|
7189
|
-
reason:
|
|
7194
|
+
import_zod11.z.object({ state: import_zod11.z.literal("errored"), traceId: import_zod11.z.string(), message: import_zod11.z.string() }),
|
|
7195
|
+
import_zod11.z.object({
|
|
7196
|
+
state: import_zod11.z.literal("ungraded"),
|
|
7197
|
+
traceId: import_zod11.z.string(),
|
|
7198
|
+
reason: import_zod11.z.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
7190
7199
|
})
|
|
7191
7200
|
])
|
|
7192
7201
|
),
|
|
7193
|
-
failures:
|
|
7194
|
-
stats:
|
|
7195
|
-
traceCount:
|
|
7196
|
-
hydratedCount:
|
|
7197
|
-
judgeCalls:
|
|
7198
|
-
durationMs:
|
|
7199
|
-
skippedRows:
|
|
7200
|
-
skippedReason:
|
|
7202
|
+
failures: import_zod11.z.array(import_zod11.z.string()),
|
|
7203
|
+
stats: import_zod11.z.object({
|
|
7204
|
+
traceCount: import_zod11.z.number().int().nonnegative(),
|
|
7205
|
+
hydratedCount: import_zod11.z.number().int().nonnegative(),
|
|
7206
|
+
judgeCalls: import_zod11.z.number().int().nonnegative(),
|
|
7207
|
+
durationMs: import_zod11.z.number().nonnegative(),
|
|
7208
|
+
skippedRows: import_zod11.z.number().int().nonnegative(),
|
|
7209
|
+
skippedReason: import_zod11.z.literal("no trace").nullable()
|
|
7201
7210
|
})
|
|
7202
7211
|
});
|
|
7203
7212
|
}
|
|
@@ -7216,6 +7225,7 @@ __export(index_exports, {
|
|
|
7216
7225
|
EvalDatasetRowInputSchema: () => EvalDatasetRowInputSchema,
|
|
7217
7226
|
EvalParameterError: () => EvalParameterError,
|
|
7218
7227
|
EvalPublishError: () => EvalPublishError,
|
|
7228
|
+
EvalSuiteManifestSchema: () => EvalSuiteManifestSchema,
|
|
7219
7229
|
LocalBooleanVerdictSchema: () => LocalBooleanVerdictSchema,
|
|
7220
7230
|
LocalNumberVerdictSchema: () => LocalNumberVerdictSchema,
|
|
7221
7231
|
LocalScoreVerdictSchema: () => LocalScoreVerdictSchema,
|
|
@@ -13000,7 +13010,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
13000
13010
|
// package.json
|
|
13001
13011
|
var package_default = {
|
|
13002
13012
|
name: "raindrop-ai",
|
|
13003
|
-
version: "0.
|
|
13013
|
+
version: "0.9.0",
|
|
13004
13014
|
main: "dist/index.js",
|
|
13005
13015
|
module: "dist/index.mjs",
|
|
13006
13016
|
types: "dist/index.d.ts",
|
|
@@ -13246,9 +13256,9 @@ function recordExportedSpan(destination, span) {
|
|
|
13246
13256
|
if (typeof span !== "object" && typeof span !== "function" || span === null) return;
|
|
13247
13257
|
const spanContext = span.spanContext;
|
|
13248
13258
|
if (typeof spanContext !== "function") return;
|
|
13249
|
-
const
|
|
13250
|
-
if (typeof (
|
|
13251
|
-
recordReplayExportedSpan(destination,
|
|
13259
|
+
const context8 = spanContext.call(span);
|
|
13260
|
+
if (typeof (context8 == null ? void 0 : context8.spanId) === "string" && typeof context8.traceId === "string") {
|
|
13261
|
+
recordReplayExportedSpan(destination, context8.spanId, context8.traceId);
|
|
13252
13262
|
}
|
|
13253
13263
|
}
|
|
13254
13264
|
function createReplayExporter(destination) {
|
|
@@ -14845,16 +14855,16 @@ var LiveSubagentRun = class {
|
|
|
14845
14855
|
};
|
|
14846
14856
|
|
|
14847
14857
|
// src/tracing/liveInteraction.ts
|
|
14848
|
-
function getPropertiesFromContext(
|
|
14858
|
+
function getPropertiesFromContext(context8) {
|
|
14849
14859
|
const properties = {
|
|
14850
|
-
...
|
|
14851
|
-
...
|
|
14852
|
-
...
|
|
14853
|
-
...
|
|
14854
|
-
...
|
|
14860
|
+
...context8.userId && { user_id: context8.userId },
|
|
14861
|
+
...context8.convoId && { convo_id: context8.convoId },
|
|
14862
|
+
...context8.eventId && { event_id: context8.eventId },
|
|
14863
|
+
...context8.event && { event_name: context8.event },
|
|
14864
|
+
...context8.properties || {}
|
|
14855
14865
|
};
|
|
14856
|
-
if (
|
|
14857
|
-
properties.attachments = stringifyBounded(
|
|
14866
|
+
if (context8.attachments && context8.attachments.length > 0) {
|
|
14867
|
+
properties.attachments = stringifyBounded(context8.attachments);
|
|
14858
14868
|
}
|
|
14859
14869
|
return properties;
|
|
14860
14870
|
}
|
|
@@ -14874,12 +14884,12 @@ function serializeAssociationProperties(properties) {
|
|
|
14874
14884
|
function serializeSpanValue(value) {
|
|
14875
14885
|
return stringifyBounded(value);
|
|
14876
14886
|
}
|
|
14877
|
-
function getLocalDebuggerMetadata(
|
|
14887
|
+
function getLocalDebuggerMetadata(context8) {
|
|
14878
14888
|
return {
|
|
14879
|
-
...
|
|
14880
|
-
...
|
|
14881
|
-
...
|
|
14882
|
-
...
|
|
14889
|
+
...context8.eventId ? { eventId: context8.eventId } : {},
|
|
14890
|
+
...context8.event ? { eventName: context8.event } : {},
|
|
14891
|
+
...context8.userId ? { userId: context8.userId } : {},
|
|
14892
|
+
...context8.convoId ? { convoId: context8.convoId } : {}
|
|
14883
14893
|
};
|
|
14884
14894
|
}
|
|
14885
14895
|
var LiveToolSpan = class {
|
|
@@ -14980,9 +14990,9 @@ var DirectToolSpan = class {
|
|
|
14980
14990
|
}
|
|
14981
14991
|
};
|
|
14982
14992
|
var LiveInteraction = class {
|
|
14983
|
-
constructor(
|
|
14993
|
+
constructor(context8, traceId, analytics, directShipper, routing) {
|
|
14984
14994
|
this.usageEmitted = false;
|
|
14985
|
-
this.context =
|
|
14995
|
+
this.context = context8;
|
|
14986
14996
|
this.analytics = analytics;
|
|
14987
14997
|
this.tracer = import_api4.trace.getTracer("traceloop.tracer");
|
|
14988
14998
|
this.traceId = traceId;
|
|
@@ -16942,33 +16952,49 @@ var AttachmentTypeSchema = import_zod.z.enum(["code", "text", "image", "iframe"]
|
|
|
16942
16952
|
|
|
16943
16953
|
// src/replay/index.ts
|
|
16944
16954
|
var import_api7 = require("@opentelemetry/api");
|
|
16945
|
-
var
|
|
16955
|
+
var import_zod6 = require("zod");
|
|
16946
16956
|
init_definition();
|
|
16947
16957
|
|
|
16948
16958
|
// src/evals/generated/dataset.ts
|
|
16949
|
-
var
|
|
16959
|
+
var import_zod5 = require("zod");
|
|
16950
16960
|
init_trace();
|
|
16951
16961
|
var EVAL_DATASET_MAX_CASES = 1e3;
|
|
16952
16962
|
var EVAL_DATASET_MAX_REQUEST_BYTES = 4 * 1024 * 1024;
|
|
16953
16963
|
var EVAL_DATASET_MAX_REFERENCE_BYTES = 1024 * 1024;
|
|
16954
|
-
var EvalDatasetSlugSchema =
|
|
16955
|
-
var EvalDatasetFingerprintSchema =
|
|
16956
|
-
var
|
|
16964
|
+
var EvalDatasetSlugSchema = import_zod5.z.string().min(1).max(64).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/);
|
|
16965
|
+
var EvalDatasetFingerprintSchema = import_zod5.z.string().regex(/^[0-9a-f]{64}$/);
|
|
16966
|
+
var EvalDatasetEventSourceSchema = import_zod5.z.object({
|
|
16967
|
+
sourceEventId: import_zod5.z.string().trim().min(1).max(512),
|
|
16968
|
+
sourceEventTimestamp: import_zod5.z.string().datetime({ offset: true }).optional()
|
|
16969
|
+
}).strict();
|
|
16970
|
+
var EvalDatasetCaptureRefSchema = EvalDatasetEventSourceSchema.extend({
|
|
16971
|
+
id: EvalDatasetFingerprintSchema
|
|
16972
|
+
}).strict();
|
|
16973
|
+
var EvalReferenceVerdictSchema = import_zod5.z.union([
|
|
16974
|
+
import_zod5.z.object({ pass: import_zod5.z.boolean() }).strict(),
|
|
16975
|
+
import_zod5.z.object({ score: import_zod5.z.number().int().min(1).max(5) }).strict(),
|
|
16976
|
+
import_zod5.z.object({ value: import_zod5.z.number().finite() }).strict()
|
|
16977
|
+
]);
|
|
16978
|
+
var EvalDatasetCaseInputSchema = import_zod5.z.object({
|
|
16957
16979
|
id: EvalDatasetCaseIdSchema,
|
|
16958
|
-
name:
|
|
16959
|
-
input:
|
|
16960
|
-
|
|
16961
|
-
|
|
16980
|
+
name: import_zod5.z.string().trim().min(1).max(200),
|
|
16981
|
+
input: import_zod5.z.string().nullable(),
|
|
16982
|
+
output: JsonValueSchema.optional(),
|
|
16983
|
+
properties: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.string()),
|
|
16984
|
+
referenceTrace: CapturedTraceSnapshotSchema.optional(),
|
|
16985
|
+
referenceCapture: EvalDatasetCaptureRefSchema.optional(),
|
|
16986
|
+
expectation: EvalCaseExpectationSchema.optional(),
|
|
16987
|
+
expectedVerdict: EvalReferenceVerdictSchema.optional()
|
|
16962
16988
|
}).strict();
|
|
16963
16989
|
var EvalDatasetVersionCaseSchema = EvalDatasetCaseInputSchema.extend({
|
|
16964
16990
|
referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
|
|
16965
16991
|
});
|
|
16966
|
-
var EvalDatasetCaseInputsSchema =
|
|
16992
|
+
var EvalDatasetCaseInputsSchema = import_zod5.z.array(EvalDatasetCaseInputSchema).min(1).max(EVAL_DATASET_MAX_CASES).superRefine((cases, context8) => {
|
|
16967
16993
|
const seen = /* @__PURE__ */ new Set();
|
|
16968
16994
|
for (const [index, entry] of cases.entries()) {
|
|
16969
16995
|
if (seen.has(entry.id)) {
|
|
16970
|
-
|
|
16971
|
-
code:
|
|
16996
|
+
context8.addIssue({
|
|
16997
|
+
code: import_zod5.z.ZodIssueCode.custom,
|
|
16972
16998
|
message: `Duplicate row id ${entry.id}`,
|
|
16973
16999
|
path: [index, "id"]
|
|
16974
17000
|
});
|
|
@@ -16976,37 +17002,56 @@ var EvalDatasetCaseInputsSchema = import_zod4.z.array(EvalDatasetCaseInputSchema
|
|
|
16976
17002
|
seen.add(entry.id);
|
|
16977
17003
|
}
|
|
16978
17004
|
});
|
|
16979
|
-
var PublishEvalDatasetVersionInputSchema =
|
|
16980
|
-
name:
|
|
16981
|
-
requestKey:
|
|
16982
|
-
expectedCurrentVersionId:
|
|
17005
|
+
var PublishEvalDatasetVersionInputSchema = import_zod5.z.object({
|
|
17006
|
+
name: import_zod5.z.string().trim().min(1).max(100),
|
|
17007
|
+
requestKey: import_zod5.z.string().uuid(),
|
|
17008
|
+
expectedCurrentVersionId: import_zod5.z.string().uuid().nullable(),
|
|
16983
17009
|
fingerprint: EvalDatasetFingerprintSchema,
|
|
16984
17010
|
cases: EvalDatasetCaseInputsSchema
|
|
16985
17011
|
}).strict();
|
|
16986
|
-
var
|
|
16987
|
-
id:
|
|
17012
|
+
var CaptureEvalDatasetCaseSchema = EvalDatasetCaseInputSchema.pick({
|
|
17013
|
+
id: true,
|
|
17014
|
+
name: true,
|
|
17015
|
+
properties: true,
|
|
17016
|
+
expectation: true,
|
|
17017
|
+
expectedVerdict: true
|
|
17018
|
+
}).merge(EvalDatasetEventSourceSchema).strict();
|
|
17019
|
+
var CaptureEvalDatasetVersionInputSchema = PublishEvalDatasetVersionInputSchema.omit({
|
|
17020
|
+
cases: true,
|
|
17021
|
+
fingerprint: true
|
|
17022
|
+
}).extend({
|
|
17023
|
+
requestKey: import_zod5.z.string().uuid().optional(),
|
|
17024
|
+
expectedCurrentVersionId: import_zod5.z.string().uuid().nullable().optional(),
|
|
17025
|
+
cases: import_zod5.z.array(CaptureEvalDatasetCaseSchema).min(1).max(EVAL_DATASET_MAX_CASES).refine((cases) => new Set(cases.map((entry) => entry.id)).size === cases.length, "Case IDs must be unique")
|
|
17026
|
+
}).strict();
|
|
17027
|
+
var EvalDatasetIdentitySchema = import_zod5.z.object({
|
|
17028
|
+
id: import_zod5.z.string().uuid(),
|
|
16988
17029
|
slug: EvalDatasetSlugSchema,
|
|
16989
|
-
name:
|
|
16990
|
-
currentVersionId:
|
|
17030
|
+
name: import_zod5.z.string().min(1).max(100),
|
|
17031
|
+
currentVersionId: import_zod5.z.string().uuid().nullable()
|
|
16991
17032
|
});
|
|
16992
|
-
var EvalDatasetVersionSchema =
|
|
16993
|
-
id:
|
|
16994
|
-
datasetId:
|
|
16995
|
-
parentVersionId:
|
|
17033
|
+
var EvalDatasetVersionSchema = import_zod5.z.object({
|
|
17034
|
+
id: import_zod5.z.string().uuid(),
|
|
17035
|
+
datasetId: import_zod5.z.string().uuid(),
|
|
17036
|
+
parentVersionId: import_zod5.z.string().uuid().nullable(),
|
|
16996
17037
|
fingerprint: EvalDatasetFingerprintSchema,
|
|
16997
|
-
cases:
|
|
16998
|
-
createdAt:
|
|
17038
|
+
cases: import_zod5.z.array(EvalDatasetVersionCaseSchema).min(1).max(EVAL_DATASET_MAX_CASES),
|
|
17039
|
+
createdAt: import_zod5.z.string().datetime({ offset: true })
|
|
16999
17040
|
});
|
|
17000
|
-
var EvalDatasetManifestSchema =
|
|
17041
|
+
var EvalDatasetManifestSchema = import_zod5.z.object({
|
|
17001
17042
|
dataset: EvalDatasetIdentitySchema,
|
|
17002
17043
|
version: EvalDatasetVersionSchema.omit({ cases: true }),
|
|
17003
|
-
cases:
|
|
17044
|
+
cases: import_zod5.z.array(EvalDatasetVersionCaseSchema.pick({
|
|
17004
17045
|
id: true,
|
|
17005
17046
|
name: true,
|
|
17006
17047
|
input: true,
|
|
17048
|
+
output: true,
|
|
17007
17049
|
properties: true
|
|
17008
17050
|
}).extend({
|
|
17009
|
-
referenceTraceSha256: EvalDatasetFingerprintSchema.optional()
|
|
17051
|
+
referenceTraceSha256: EvalDatasetFingerprintSchema.optional(),
|
|
17052
|
+
referenceCapture: EvalDatasetCaptureRefSchema.optional(),
|
|
17053
|
+
expectation: EvalCaseExpectationSchema.optional(),
|
|
17054
|
+
expectedVerdict: EvalReferenceVerdictSchema.optional()
|
|
17010
17055
|
}))
|
|
17011
17056
|
});
|
|
17012
17057
|
function compareNanoseconds2(left, right) {
|
|
@@ -17094,115 +17139,116 @@ function retryDelayMs(response, retry) {
|
|
|
17094
17139
|
}
|
|
17095
17140
|
return EVAL_RETRY_BASE_DELAY_MS * 2 ** retry;
|
|
17096
17141
|
}
|
|
17097
|
-
var ReplayRowSchema =
|
|
17098
|
-
id:
|
|
17099
|
-
name:
|
|
17100
|
-
input:
|
|
17101
|
-
output:
|
|
17102
|
-
properties:
|
|
17142
|
+
var ReplayRowSchema = import_zod6.z.object({
|
|
17143
|
+
id: import_zod6.z.string(),
|
|
17144
|
+
name: import_zod6.z.string(),
|
|
17145
|
+
input: import_zod6.z.string().nullable(),
|
|
17146
|
+
output: JsonValueSchema,
|
|
17147
|
+
properties: import_zod6.z.record(import_zod6.z.string())
|
|
17103
17148
|
});
|
|
17104
|
-
var WireEvalManifestSchema =
|
|
17105
|
-
dataset_id:
|
|
17106
|
-
|
|
17107
|
-
|
|
17149
|
+
var WireEvalManifestSchema = import_zod6.z.object({
|
|
17150
|
+
dataset_id: import_zod6.z.string().uuid(),
|
|
17151
|
+
dataset_version_id: import_zod6.z.string().uuid().optional(),
|
|
17152
|
+
fingerprint: import_zod6.z.string().regex(/^[a-f0-9]{64}$/),
|
|
17153
|
+
rows: import_zod6.z.array(ReplayRowSchema.extend({ id: import_zod6.z.string().min(1) }))
|
|
17108
17154
|
});
|
|
17109
|
-
var ReplayCountsSchema =
|
|
17110
|
-
total:
|
|
17111
|
-
pending:
|
|
17112
|
-
done:
|
|
17113
|
-
missing:
|
|
17155
|
+
var ReplayCountsSchema = import_zod6.z.object({
|
|
17156
|
+
total: import_zod6.z.number(),
|
|
17157
|
+
pending: import_zod6.z.number(),
|
|
17158
|
+
done: import_zod6.z.number(),
|
|
17159
|
+
missing: import_zod6.z.number()
|
|
17114
17160
|
});
|
|
17115
|
-
var ReplayEvaluatorCountsSchema =
|
|
17116
|
-
traces:
|
|
17117
|
-
graded:
|
|
17118
|
-
errored:
|
|
17119
|
-
ungraded:
|
|
17120
|
-
pending:
|
|
17161
|
+
var ReplayEvaluatorCountsSchema = import_zod6.z.object({
|
|
17162
|
+
traces: import_zod6.z.number(),
|
|
17163
|
+
graded: import_zod6.z.number(),
|
|
17164
|
+
errored: import_zod6.z.number(),
|
|
17165
|
+
ungraded: import_zod6.z.number(),
|
|
17166
|
+
pending: import_zod6.z.number()
|
|
17121
17167
|
});
|
|
17122
|
-
var ReplayEvaluatorStatsSchema =
|
|
17123
|
-
traceCount:
|
|
17124
|
-
hydratedCount:
|
|
17125
|
-
judgeCalls:
|
|
17126
|
-
durationMs:
|
|
17127
|
-
skippedRows:
|
|
17128
|
-
skippedReason:
|
|
17168
|
+
var ReplayEvaluatorStatsSchema = import_zod6.z.object({
|
|
17169
|
+
traceCount: import_zod6.z.number(),
|
|
17170
|
+
hydratedCount: import_zod6.z.number(),
|
|
17171
|
+
judgeCalls: import_zod6.z.number(),
|
|
17172
|
+
durationMs: import_zod6.z.number(),
|
|
17173
|
+
skippedRows: import_zod6.z.number(),
|
|
17174
|
+
skippedReason: import_zod6.z.literal("no trace").nullable()
|
|
17129
17175
|
});
|
|
17130
|
-
var ReplayEvaluatorSummarySchema =
|
|
17131
|
-
|
|
17132
|
-
outputType:
|
|
17176
|
+
var ReplayEvaluatorSummarySchema = import_zod6.z.discriminatedUnion("outputType", [
|
|
17177
|
+
import_zod6.z.object({
|
|
17178
|
+
outputType: import_zod6.z.literal("boolean"),
|
|
17133
17179
|
counts: ReplayEvaluatorCountsSchema,
|
|
17134
17180
|
stats: ReplayEvaluatorStatsSchema,
|
|
17135
|
-
passed:
|
|
17136
|
-
failed:
|
|
17137
|
-
passRate:
|
|
17181
|
+
passed: import_zod6.z.number(),
|
|
17182
|
+
failed: import_zod6.z.number(),
|
|
17183
|
+
passRate: import_zod6.z.number().nullable()
|
|
17138
17184
|
}),
|
|
17139
|
-
|
|
17140
|
-
outputType:
|
|
17185
|
+
import_zod6.z.object({
|
|
17186
|
+
outputType: import_zod6.z.literal("score"),
|
|
17141
17187
|
counts: ReplayEvaluatorCountsSchema,
|
|
17142
17188
|
stats: ReplayEvaluatorStatsSchema,
|
|
17143
|
-
mean:
|
|
17144
|
-
median:
|
|
17145
|
-
p10:
|
|
17146
|
-
p90:
|
|
17147
|
-
atLeast4Share:
|
|
17148
|
-
histogram:
|
|
17189
|
+
mean: import_zod6.z.number().nullable(),
|
|
17190
|
+
median: import_zod6.z.number().nullable(),
|
|
17191
|
+
p10: import_zod6.z.number().nullable(),
|
|
17192
|
+
p90: import_zod6.z.number().nullable(),
|
|
17193
|
+
atLeast4Share: import_zod6.z.number().nullable(),
|
|
17194
|
+
histogram: import_zod6.z.tuple([import_zod6.z.number(), import_zod6.z.number(), import_zod6.z.number(), import_zod6.z.number(), import_zod6.z.number()])
|
|
17149
17195
|
}),
|
|
17150
|
-
|
|
17151
|
-
outputType:
|
|
17196
|
+
import_zod6.z.object({
|
|
17197
|
+
outputType: import_zod6.z.literal("number"),
|
|
17152
17198
|
counts: ReplayEvaluatorCountsSchema,
|
|
17153
17199
|
stats: ReplayEvaluatorStatsSchema,
|
|
17154
|
-
median:
|
|
17155
|
-
p10:
|
|
17156
|
-
p90:
|
|
17200
|
+
median: import_zod6.z.number().nullable(),
|
|
17201
|
+
p10: import_zod6.z.number().nullable(),
|
|
17202
|
+
p90: import_zod6.z.number().nullable()
|
|
17157
17203
|
})
|
|
17158
17204
|
]);
|
|
17159
|
-
var ReplayVerdictIdentitySchema =
|
|
17160
|
-
evaluator:
|
|
17161
|
-
runId:
|
|
17162
|
-
url:
|
|
17205
|
+
var ReplayVerdictIdentitySchema = import_zod6.z.object({
|
|
17206
|
+
evaluator: import_zod6.z.string(),
|
|
17207
|
+
runId: import_zod6.z.string(),
|
|
17208
|
+
url: import_zod6.z.string()
|
|
17163
17209
|
});
|
|
17164
17210
|
var ReplayVerdictGradedSchema = ReplayVerdictIdentitySchema.extend({
|
|
17165
|
-
state:
|
|
17166
|
-
note:
|
|
17211
|
+
state: import_zod6.z.literal("graded"),
|
|
17212
|
+
note: import_zod6.z.string().optional()
|
|
17167
17213
|
});
|
|
17168
|
-
var ReplayVerdictSchema =
|
|
17169
|
-
ReplayVerdictGradedSchema.extend({ pass:
|
|
17214
|
+
var ReplayVerdictSchema = import_zod6.z.union([
|
|
17215
|
+
ReplayVerdictGradedSchema.extend({ pass: import_zod6.z.boolean() }),
|
|
17170
17216
|
ReplayVerdictGradedSchema.extend({ score: EvalScoreSchema }),
|
|
17171
|
-
ReplayVerdictGradedSchema.extend({ value:
|
|
17217
|
+
ReplayVerdictGradedSchema.extend({ value: import_zod6.z.number().finite() }),
|
|
17172
17218
|
ReplayVerdictIdentitySchema.extend({
|
|
17173
|
-
state:
|
|
17174
|
-
message:
|
|
17219
|
+
state: import_zod6.z.literal("errored"),
|
|
17220
|
+
message: import_zod6.z.string()
|
|
17175
17221
|
}),
|
|
17176
17222
|
ReplayVerdictIdentitySchema.extend({
|
|
17177
|
-
state:
|
|
17178
|
-
reason:
|
|
17223
|
+
state: import_zod6.z.literal("ungraded"),
|
|
17224
|
+
reason: import_zod6.z.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
17179
17225
|
})
|
|
17180
17226
|
]);
|
|
17181
17227
|
var ReplayResultRowSchema = ReplayRowSchema.extend({
|
|
17182
|
-
status:
|
|
17183
|
-
traceId:
|
|
17184
|
-
error:
|
|
17185
|
-
verdicts:
|
|
17228
|
+
status: import_zod6.z.enum(["pending", "done", "missing"]),
|
|
17229
|
+
traceId: import_zod6.z.string().nullable(),
|
|
17230
|
+
error: import_zod6.z.string().nullable(),
|
|
17231
|
+
verdicts: import_zod6.z.array(ReplayVerdictSchema)
|
|
17186
17232
|
});
|
|
17187
|
-
var ReplayTraceEvidenceEntrySchema =
|
|
17188
|
-
rowId:
|
|
17189
|
-
traceId:
|
|
17190
|
-
spanIds:
|
|
17191
|
-
}).superRefine((entry,
|
|
17233
|
+
var ReplayTraceEvidenceEntrySchema = import_zod6.z.object({
|
|
17234
|
+
rowId: import_zod6.z.string().min(1).max(512),
|
|
17235
|
+
traceId: import_zod6.z.string().regex(/^[a-f0-9]{32}$/),
|
|
17236
|
+
spanIds: import_zod6.z.array(import_zod6.z.string().regex(/^[a-f0-9]{16}$/)).min(1).max(500)
|
|
17237
|
+
}).superRefine((entry, context8) => {
|
|
17192
17238
|
if (new Set(entry.spanIds).size !== entry.spanIds.length) {
|
|
17193
|
-
|
|
17194
|
-
code:
|
|
17239
|
+
context8.addIssue({
|
|
17240
|
+
code: import_zod6.z.ZodIssueCode.custom,
|
|
17195
17241
|
message: "Replay trace evidence span ids must be unique",
|
|
17196
17242
|
path: ["spanIds"]
|
|
17197
17243
|
});
|
|
17198
17244
|
}
|
|
17199
17245
|
});
|
|
17200
|
-
var ReplayTraceEvidenceSchema =
|
|
17246
|
+
var ReplayTraceEvidenceSchema = import_zod6.z.array(ReplayTraceEvidenceEntrySchema).superRefine((entries, context8) => {
|
|
17201
17247
|
const seen = /* @__PURE__ */ new Set();
|
|
17202
17248
|
for (const [index, entry] of entries.entries()) {
|
|
17203
17249
|
if (seen.has(entry.rowId)) {
|
|
17204
|
-
|
|
17205
|
-
code:
|
|
17250
|
+
context8.addIssue({
|
|
17251
|
+
code: import_zod6.z.ZodIssueCode.custom,
|
|
17206
17252
|
message: "Replay trace evidence row ids must be unique",
|
|
17207
17253
|
path: [index, "rowId"]
|
|
17208
17254
|
});
|
|
@@ -17210,13 +17256,13 @@ var ReplayTraceEvidenceSchema = import_zod5.z.array(ReplayTraceEvidenceEntrySche
|
|
|
17210
17256
|
seen.add(entry.rowId);
|
|
17211
17257
|
}
|
|
17212
17258
|
});
|
|
17213
|
-
var LocalBooleanVerdictSchema =
|
|
17214
|
-
var LocalScoreVerdictSchema =
|
|
17259
|
+
var LocalBooleanVerdictSchema = import_zod6.z.object({ pass: import_zod6.z.boolean(), note: import_zod6.z.string().trim().min(1).max(600).optional() }).strict();
|
|
17260
|
+
var LocalScoreVerdictSchema = import_zod6.z.object({
|
|
17215
17261
|
score: EvalScoreSchema,
|
|
17216
|
-
note:
|
|
17262
|
+
note: import_zod6.z.string().trim().min(1).max(600).optional()
|
|
17217
17263
|
}).strict();
|
|
17218
|
-
var LocalNumberVerdictSchema =
|
|
17219
|
-
var LocalVerdictSchema =
|
|
17264
|
+
var LocalNumberVerdictSchema = import_zod6.z.object({ value: import_zod6.z.number().finite(), note: import_zod6.z.string().trim().min(1).max(600).optional() }).strict();
|
|
17265
|
+
var LocalVerdictSchema = import_zod6.z.union([
|
|
17220
17266
|
LocalBooleanVerdictSchema,
|
|
17221
17267
|
LocalScoreVerdictSchema,
|
|
17222
17268
|
LocalNumberVerdictSchema
|
|
@@ -17292,50 +17338,50 @@ async function queryApi(request) {
|
|
|
17292
17338
|
return parsed.data;
|
|
17293
17339
|
}
|
|
17294
17340
|
}
|
|
17295
|
-
var ReplayStatusSchema =
|
|
17296
|
-
var ReplayRowStatusSchema =
|
|
17297
|
-
var WireReplaySchema =
|
|
17298
|
-
id:
|
|
17341
|
+
var ReplayStatusSchema = import_zod6.z.enum(["queued", "running", "complete", "failed"]);
|
|
17342
|
+
var ReplayRowStatusSchema = import_zod6.z.enum(["pending", "done", "missing"]);
|
|
17343
|
+
var WireReplaySchema = import_zod6.z.object({
|
|
17344
|
+
id: import_zod6.z.string(),
|
|
17299
17345
|
status: ReplayStatusSchema,
|
|
17300
17346
|
counts: ReplayCountsSchema,
|
|
17301
|
-
traces_expire_at:
|
|
17302
|
-
traces_expired:
|
|
17347
|
+
traces_expire_at: import_zod6.z.string(),
|
|
17348
|
+
traces_expired: import_zod6.z.boolean()
|
|
17303
17349
|
});
|
|
17304
|
-
var WireRowSchema =
|
|
17305
|
-
row_id:
|
|
17306
|
-
attempt:
|
|
17350
|
+
var WireRowSchema = import_zod6.z.object({
|
|
17351
|
+
row_id: import_zod6.z.string(),
|
|
17352
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17307
17353
|
status: ReplayRowStatusSchema,
|
|
17308
|
-
trace_id:
|
|
17309
|
-
error:
|
|
17354
|
+
trace_id: import_zod6.z.string().nullable(),
|
|
17355
|
+
error: import_zod6.z.string().nullable()
|
|
17310
17356
|
});
|
|
17311
|
-
var WirePlanSchema =
|
|
17357
|
+
var WirePlanSchema = import_zod6.z.object({
|
|
17312
17358
|
replay: WireReplaySchema,
|
|
17313
|
-
ingest_url:
|
|
17314
|
-
rows:
|
|
17359
|
+
ingest_url: import_zod6.z.string().min(1).nullable(),
|
|
17360
|
+
rows: import_zod6.z.array(
|
|
17315
17361
|
ReplayRowSchema.omit({ id: true }).extend({
|
|
17316
|
-
row_id:
|
|
17317
|
-
attempt:
|
|
17318
|
-
correlation_id:
|
|
17362
|
+
row_id: import_zod6.z.string(),
|
|
17363
|
+
attempt: import_zod6.z.literal(0),
|
|
17364
|
+
correlation_id: import_zod6.z.string()
|
|
17319
17365
|
})
|
|
17320
17366
|
)
|
|
17321
17367
|
});
|
|
17322
|
-
var WireReplayDetailSchema =
|
|
17368
|
+
var WireReplayDetailSchema = import_zod6.z.object({
|
|
17323
17369
|
replay: WireReplaySchema,
|
|
17324
|
-
rows:
|
|
17370
|
+
rows: import_zod6.z.array(WireRowSchema)
|
|
17325
17371
|
});
|
|
17326
17372
|
var EvalRunDetailSchema = WireReplayDetailSchema.extend({
|
|
17327
17373
|
replay: WireReplaySchema.extend({
|
|
17328
|
-
dataset_id:
|
|
17329
|
-
dataset_version_id:
|
|
17374
|
+
dataset_id: import_zod6.z.string().uuid(),
|
|
17375
|
+
dataset_version_id: import_zod6.z.string().uuid().nullable()
|
|
17330
17376
|
}),
|
|
17331
|
-
eval_runs:
|
|
17332
|
-
|
|
17333
|
-
id:
|
|
17334
|
-
eval_id:
|
|
17335
|
-
program_version:
|
|
17336
|
-
output_type:
|
|
17337
|
-
executed_by:
|
|
17338
|
-
status:
|
|
17377
|
+
eval_runs: import_zod6.z.array(
|
|
17378
|
+
import_zod6.z.object({
|
|
17379
|
+
id: import_zod6.z.string().uuid(),
|
|
17380
|
+
eval_id: import_zod6.z.string().uuid(),
|
|
17381
|
+
program_version: import_zod6.z.number().int().positive(),
|
|
17382
|
+
output_type: import_zod6.z.enum(["boolean", "score", "number"]),
|
|
17383
|
+
executed_by: import_zod6.z.enum(["hosted", "local"]),
|
|
17384
|
+
status: import_zod6.z.enum(["running", "completed", "failed"])
|
|
17339
17385
|
})
|
|
17340
17386
|
)
|
|
17341
17387
|
});
|
|
@@ -17351,118 +17397,118 @@ async function readReplayDetails(client, runId, options = {}) {
|
|
|
17351
17397
|
if (detail.replay.id !== runId) throw new Error("Raindrop returned a different run");
|
|
17352
17398
|
return detail;
|
|
17353
17399
|
}
|
|
17354
|
-
var WireReportSchema =
|
|
17355
|
-
var WireAttemptStartedSchema =
|
|
17356
|
-
status:
|
|
17357
|
-
row:
|
|
17358
|
-
row_id:
|
|
17359
|
-
attempt:
|
|
17360
|
-
correlation_id:
|
|
17400
|
+
var WireReportSchema = import_zod6.z.object({ status: import_zod6.z.string() });
|
|
17401
|
+
var WireAttemptStartedSchema = import_zod6.z.object({
|
|
17402
|
+
status: import_zod6.z.literal("pending"),
|
|
17403
|
+
row: import_zod6.z.object({
|
|
17404
|
+
row_id: import_zod6.z.string().min(1),
|
|
17405
|
+
attempt: import_zod6.z.number().int().positive(),
|
|
17406
|
+
correlation_id: import_zod6.z.string().min(1)
|
|
17361
17407
|
})
|
|
17362
17408
|
});
|
|
17363
|
-
var WireLocalEvaluatorSchema =
|
|
17364
|
-
data:
|
|
17365
|
-
id:
|
|
17366
|
-
slug:
|
|
17367
|
-
name:
|
|
17368
|
-
output:
|
|
17369
|
-
kind:
|
|
17370
|
-
programVersion:
|
|
17409
|
+
var WireLocalEvaluatorSchema = import_zod6.z.object({
|
|
17410
|
+
data: import_zod6.z.object({
|
|
17411
|
+
id: import_zod6.z.string().uuid(),
|
|
17412
|
+
slug: import_zod6.z.string(),
|
|
17413
|
+
name: import_zod6.z.string(),
|
|
17414
|
+
output: import_zod6.z.enum(["boolean", "score", "number"]),
|
|
17415
|
+
kind: import_zod6.z.literal("local"),
|
|
17416
|
+
programVersion: import_zod6.z.number().int().positive()
|
|
17371
17417
|
})
|
|
17372
17418
|
});
|
|
17373
|
-
var WireStartedEvalRunSchema =
|
|
17374
|
-
data:
|
|
17375
|
-
runId:
|
|
17376
|
-
status:
|
|
17377
|
-
url:
|
|
17378
|
-
evalId:
|
|
17379
|
-
programVersion:
|
|
17419
|
+
var WireStartedEvalRunSchema = import_zod6.z.object({
|
|
17420
|
+
data: import_zod6.z.object({
|
|
17421
|
+
runId: import_zod6.z.string(),
|
|
17422
|
+
status: import_zod6.z.literal("running"),
|
|
17423
|
+
url: import_zod6.z.string(),
|
|
17424
|
+
evalId: import_zod6.z.string().uuid().optional(),
|
|
17425
|
+
programVersion: import_zod6.z.number().int().positive().optional()
|
|
17380
17426
|
})
|
|
17381
17427
|
});
|
|
17382
|
-
var WireEvalRunSchema =
|
|
17383
|
-
data:
|
|
17384
|
-
id:
|
|
17385
|
-
evalSlug:
|
|
17386
|
-
status:
|
|
17428
|
+
var WireEvalRunSchema = import_zod6.z.object({
|
|
17429
|
+
data: import_zod6.z.object({
|
|
17430
|
+
id: import_zod6.z.string(),
|
|
17431
|
+
evalSlug: import_zod6.z.string(),
|
|
17432
|
+
status: import_zod6.z.enum(["running", "completed", "failed"]),
|
|
17387
17433
|
summary: ReplayEvaluatorSummarySchema.nullable(),
|
|
17388
|
-
error:
|
|
17389
|
-
traces:
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
state:
|
|
17393
|
-
traceId:
|
|
17394
|
-
pass:
|
|
17395
|
-
note:
|
|
17434
|
+
error: import_zod6.z.string().nullable(),
|
|
17435
|
+
traces: import_zod6.z.array(
|
|
17436
|
+
import_zod6.z.union([
|
|
17437
|
+
import_zod6.z.object({
|
|
17438
|
+
state: import_zod6.z.literal("graded"),
|
|
17439
|
+
traceId: import_zod6.z.string(),
|
|
17440
|
+
pass: import_zod6.z.boolean(),
|
|
17441
|
+
note: import_zod6.z.string().optional()
|
|
17396
17442
|
}),
|
|
17397
|
-
|
|
17398
|
-
state:
|
|
17399
|
-
traceId:
|
|
17443
|
+
import_zod6.z.object({
|
|
17444
|
+
state: import_zod6.z.literal("graded"),
|
|
17445
|
+
traceId: import_zod6.z.string(),
|
|
17400
17446
|
score: EvalScoreSchema,
|
|
17401
|
-
note:
|
|
17447
|
+
note: import_zod6.z.string().optional()
|
|
17402
17448
|
}),
|
|
17403
|
-
|
|
17404
|
-
state:
|
|
17405
|
-
traceId:
|
|
17406
|
-
value:
|
|
17407
|
-
note:
|
|
17449
|
+
import_zod6.z.object({
|
|
17450
|
+
state: import_zod6.z.literal("graded"),
|
|
17451
|
+
traceId: import_zod6.z.string(),
|
|
17452
|
+
value: import_zod6.z.number().finite(),
|
|
17453
|
+
note: import_zod6.z.string().optional()
|
|
17408
17454
|
}),
|
|
17409
|
-
|
|
17410
|
-
|
|
17411
|
-
state:
|
|
17412
|
-
traceId:
|
|
17413
|
-
reason:
|
|
17455
|
+
import_zod6.z.object({ state: import_zod6.z.literal("errored"), traceId: import_zod6.z.string(), message: import_zod6.z.string() }),
|
|
17456
|
+
import_zod6.z.object({
|
|
17457
|
+
state: import_zod6.z.literal("ungraded"),
|
|
17458
|
+
traceId: import_zod6.z.string(),
|
|
17459
|
+
reason: import_zod6.z.enum(["not sampled", "trace unavailable", "content unreadable"])
|
|
17414
17460
|
})
|
|
17415
17461
|
])
|
|
17416
17462
|
)
|
|
17417
17463
|
})
|
|
17418
17464
|
});
|
|
17419
|
-
var WireLocalEvalRunSchema =
|
|
17420
|
-
data: WireEvalRunSchema.shape.data.extend({ status:
|
|
17465
|
+
var WireLocalEvalRunSchema = import_zod6.z.object({
|
|
17466
|
+
data: WireEvalRunSchema.shape.data.extend({ status: import_zod6.z.literal("completed"), url: import_zod6.z.string() })
|
|
17421
17467
|
});
|
|
17422
|
-
var WireLocalEvalRunStartedSchema =
|
|
17423
|
-
data: WireEvalRunSchema.shape.data.omit({ traces: true }).extend({ status:
|
|
17468
|
+
var WireLocalEvalRunStartedSchema = import_zod6.z.object({
|
|
17469
|
+
data: WireEvalRunSchema.shape.data.omit({ traces: true }).extend({ status: import_zod6.z.literal("running"), url: import_zod6.z.string() })
|
|
17424
17470
|
});
|
|
17425
|
-
var WireLocalEvalAttemptSchema =
|
|
17426
|
-
data:
|
|
17427
|
-
runId:
|
|
17428
|
-
requestId:
|
|
17429
|
-
rowId:
|
|
17430
|
-
attempt:
|
|
17431
|
-
traceId:
|
|
17471
|
+
var WireLocalEvalAttemptSchema = import_zod6.z.object({
|
|
17472
|
+
data: import_zod6.z.object({
|
|
17473
|
+
runId: import_zod6.z.string().uuid(),
|
|
17474
|
+
requestId: import_zod6.z.string().uuid(),
|
|
17475
|
+
rowId: import_zod6.z.string().min(1),
|
|
17476
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17477
|
+
traceId: import_zod6.z.string().regex(/^[a-f0-9]{32}$/),
|
|
17432
17478
|
outcome: WireEvalRunSchema.shape.data.shape.traces.element
|
|
17433
17479
|
})
|
|
17434
17480
|
});
|
|
17435
|
-
var WireEvalCaseTracePairReadSchema =
|
|
17481
|
+
var WireEvalCaseTracePairReadSchema = import_zod6.z.discriminatedUnion("state", [
|
|
17436
17482
|
EvalCaseTracePairSchema.extend({
|
|
17437
|
-
state:
|
|
17438
|
-
attempt:
|
|
17439
|
-
datasetVersion:
|
|
17440
|
-
id:
|
|
17483
|
+
state: import_zod6.z.literal("ready"),
|
|
17484
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17485
|
+
datasetVersion: import_zod6.z.object({
|
|
17486
|
+
id: import_zod6.z.string().uuid(),
|
|
17441
17487
|
fingerprint: EvalDatasetFingerprintSchema
|
|
17442
17488
|
})
|
|
17443
17489
|
}),
|
|
17444
|
-
|
|
17445
|
-
state:
|
|
17446
|
-
caseId:
|
|
17447
|
-
attempt:
|
|
17490
|
+
import_zod6.z.object({
|
|
17491
|
+
state: import_zod6.z.literal("pending"),
|
|
17492
|
+
caseId: import_zod6.z.string().min(1),
|
|
17493
|
+
attempt: import_zod6.z.number().int().nonnegative()
|
|
17448
17494
|
}),
|
|
17449
|
-
|
|
17450
|
-
state:
|
|
17451
|
-
caseId:
|
|
17452
|
-
attempt:
|
|
17453
|
-
reason:
|
|
17495
|
+
import_zod6.z.object({
|
|
17496
|
+
state: import_zod6.z.literal("missing"),
|
|
17497
|
+
caseId: import_zod6.z.string().min(1),
|
|
17498
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17499
|
+
reason: import_zod6.z.string()
|
|
17454
17500
|
}),
|
|
17455
|
-
|
|
17456
|
-
state:
|
|
17457
|
-
caseId:
|
|
17458
|
-
attempt:
|
|
17459
|
-
expiredAt:
|
|
17501
|
+
import_zod6.z.object({
|
|
17502
|
+
state: import_zod6.z.literal("expired"),
|
|
17503
|
+
caseId: import_zod6.z.string().min(1),
|
|
17504
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17505
|
+
expiredAt: import_zod6.z.string().datetime({ offset: true })
|
|
17460
17506
|
}),
|
|
17461
|
-
|
|
17462
|
-
state:
|
|
17463
|
-
caseId:
|
|
17464
|
-
attempt:
|
|
17465
|
-
reason:
|
|
17507
|
+
import_zod6.z.object({
|
|
17508
|
+
state: import_zod6.z.literal("errored"),
|
|
17509
|
+
caseId: import_zod6.z.string().min(1),
|
|
17510
|
+
attempt: import_zod6.z.number().int().nonnegative(),
|
|
17511
|
+
reason: import_zod6.z.string()
|
|
17466
17512
|
})
|
|
17467
17513
|
]);
|
|
17468
17514
|
var replayGitSnapshots = /* @__PURE__ */ new WeakMap();
|
|
@@ -17645,6 +17691,7 @@ async function readEvalManifest(client, dataset, options) {
|
|
|
17645
17691
|
}
|
|
17646
17692
|
return {
|
|
17647
17693
|
datasetId: manifest.dataset_id,
|
|
17694
|
+
datasetVersionId: manifest.dataset_version_id,
|
|
17648
17695
|
fingerprint: manifest.fingerprint,
|
|
17649
17696
|
cases: manifest.rows
|
|
17650
17697
|
};
|
|
@@ -17653,7 +17700,7 @@ async function readEvalDataset(client, dataset, options) {
|
|
|
17653
17700
|
var _a;
|
|
17654
17701
|
const slug = EvalDatasetSlugSchema.parse(dataset.trim());
|
|
17655
17702
|
const versionId = options == null ? void 0 : options.versionId;
|
|
17656
|
-
if (versionId !== void 0 && !
|
|
17703
|
+
if (versionId !== void 0 && !import_zod6.z.string().uuid().safeParse(versionId).success) {
|
|
17657
17704
|
throw new Error("Raindrop eval dataset versionId must be a UUID");
|
|
17658
17705
|
}
|
|
17659
17706
|
const path = versionId ? `/v1/eval-datasets/${encodeURIComponent(slug)}/versions/${encodeURIComponent(versionId)}` : `/v1/eval-datasets/${encodeURIComponent(slug)}`;
|
|
@@ -17666,7 +17713,7 @@ async function readEvalDataset(client, dataset, options) {
|
|
|
17666
17713
|
schema: EvalDatasetManifestSchema
|
|
17667
17714
|
})
|
|
17668
17715
|
);
|
|
17669
|
-
if (manifest.dataset.slug !== slug) {
|
|
17716
|
+
if (manifest.dataset.slug !== slug && manifest.dataset.id !== slug) {
|
|
17670
17717
|
throw new Error(`Raindrop eval dataset ${slug} returned mismatched dataset identity`);
|
|
17671
17718
|
}
|
|
17672
17719
|
if (versionId !== void 0 && manifest.version.id !== versionId) {
|
|
@@ -18265,7 +18312,7 @@ async function validateReferenceRequirements(client, dataset, rowIds, evaluators
|
|
|
18265
18312
|
queryUrl,
|
|
18266
18313
|
path: `/v1/evals/${encodeURIComponent(evaluator)}`,
|
|
18267
18314
|
method: "GET",
|
|
18268
|
-
schema:
|
|
18315
|
+
schema: import_zod6.z.object({ data: import_zod6.z.object({ requiresReference: import_zod6.z.boolean() }) })
|
|
18269
18316
|
})).data.requiresReference : evaluator.requiresReference === true;
|
|
18270
18317
|
if (requiresReference) {
|
|
18271
18318
|
const name = typeof evaluator === "string" ? evaluator : evaluator.slug;
|
|
@@ -18734,7 +18781,7 @@ function validateEvaluatorPins(evaluators, raw) {
|
|
|
18734
18781
|
if (!allowed.has(slug)) {
|
|
18735
18782
|
throw new Error(`Raindrop evaluator pin names unknown evaluator ${slug}`);
|
|
18736
18783
|
}
|
|
18737
|
-
if (!
|
|
18784
|
+
if (!import_zod6.z.string().uuid().safeParse(pin.expectedEvalId).success) {
|
|
18738
18785
|
throw new Error(`Raindrop evaluator ${slug} pin has an invalid evaluator id`);
|
|
18739
18786
|
}
|
|
18740
18787
|
if (!Number.isInteger(pin.expectedProgramVersion) || pin.expectedProgramVersion <= 0) {
|
|
@@ -18789,8 +18836,11 @@ function describeError(cause) {
|
|
|
18789
18836
|
return String(cause);
|
|
18790
18837
|
}
|
|
18791
18838
|
|
|
18839
|
+
// src/evals/index.ts
|
|
18840
|
+
init_manifest();
|
|
18841
|
+
|
|
18792
18842
|
// src/evals/agent.ts
|
|
18793
|
-
var
|
|
18843
|
+
var import_zod7 = require("zod");
|
|
18794
18844
|
var EvalParameterError = class extends Error {
|
|
18795
18845
|
constructor(agent, issues) {
|
|
18796
18846
|
super(
|
|
@@ -18799,17 +18849,17 @@ var EvalParameterError = class extends Error {
|
|
|
18799
18849
|
this.name = "EvalParameterError";
|
|
18800
18850
|
}
|
|
18801
18851
|
};
|
|
18802
|
-
var AgentMetadataSchema =
|
|
18803
|
-
slug:
|
|
18804
|
-
name:
|
|
18805
|
-
description:
|
|
18852
|
+
var AgentMetadataSchema = import_zod7.z.object({
|
|
18853
|
+
slug: import_zod7.z.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
18854
|
+
name: import_zod7.z.string().trim().min(1).max(120),
|
|
18855
|
+
description: import_zod7.z.string().max(2e3).optional()
|
|
18806
18856
|
});
|
|
18807
18857
|
var PARAMETER_KEY = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
18808
18858
|
var MAX_PARAMETERS = 50;
|
|
18809
18859
|
function unwrapField(schema) {
|
|
18810
18860
|
let inner = schema;
|
|
18811
18861
|
let description;
|
|
18812
|
-
while (inner instanceof
|
|
18862
|
+
while (inner instanceof import_zod7.z.ZodDefault || inner instanceof import_zod7.z.ZodOptional) {
|
|
18813
18863
|
description != null ? description : description = inner.description;
|
|
18814
18864
|
inner = inner._def.innerType;
|
|
18815
18865
|
}
|
|
@@ -18833,7 +18883,7 @@ function describeParameterField(key, schema) {
|
|
|
18833
18883
|
if (!PARAMETER_KEY.test(key)) throw new Error(`Parameter key ${key} must be an identifier`);
|
|
18834
18884
|
const { inner, required, defaultValue, description } = unwrapField(schema);
|
|
18835
18885
|
const base = { key, required, ...description === void 0 ? {} : { description } };
|
|
18836
|
-
if (inner instanceof
|
|
18886
|
+
if (inner instanceof import_zod7.z.ZodString) {
|
|
18837
18887
|
const max = inner._def.checks.find((check) => check.kind === "max");
|
|
18838
18888
|
return {
|
|
18839
18889
|
...base,
|
|
@@ -18842,7 +18892,7 @@ function describeParameterField(key, schema) {
|
|
|
18842
18892
|
...(max == null ? void 0 : max.kind) === "max" ? { maxLength: max.value } : {}
|
|
18843
18893
|
};
|
|
18844
18894
|
}
|
|
18845
|
-
if (inner instanceof
|
|
18895
|
+
if (inner instanceof import_zod7.z.ZodNumber) {
|
|
18846
18896
|
const { minValue, maxValue } = inner;
|
|
18847
18897
|
return {
|
|
18848
18898
|
...base,
|
|
@@ -18853,10 +18903,10 @@ function describeParameterField(key, schema) {
|
|
|
18853
18903
|
...maxValue === null ? {} : { max: maxValue }
|
|
18854
18904
|
};
|
|
18855
18905
|
}
|
|
18856
|
-
if (inner instanceof
|
|
18906
|
+
if (inner instanceof import_zod7.z.ZodBoolean) {
|
|
18857
18907
|
return { ...base, type: "boolean", default: fieldDefault(key, defaultValue, isBoolean) };
|
|
18858
18908
|
}
|
|
18859
|
-
if (inner instanceof
|
|
18909
|
+
if (inner instanceof import_zod7.z.ZodEnum) {
|
|
18860
18910
|
const options = inner.options;
|
|
18861
18911
|
return { ...base, type: "enum", default: fieldDefault(key, defaultValue, isString), options };
|
|
18862
18912
|
}
|
|
@@ -18877,7 +18927,7 @@ function defineAgent(definition) {
|
|
|
18877
18927
|
if (entries.length > MAX_PARAMETERS)
|
|
18878
18928
|
throw new Error(`Agent ${slug} declares more than ${MAX_PARAMETERS} parameters`);
|
|
18879
18929
|
const parameters = entries.map(([key, schema2]) => describeParameterField(key, schema2));
|
|
18880
|
-
const schema =
|
|
18930
|
+
const schema = import_zod7.z.object(fields).strict();
|
|
18881
18931
|
return {
|
|
18882
18932
|
slug,
|
|
18883
18933
|
name,
|
|
@@ -18943,11 +18993,11 @@ function startAgent(definition, parameters) {
|
|
|
18943
18993
|
}
|
|
18944
18994
|
|
|
18945
18995
|
// src/evals/server.ts
|
|
18946
|
-
var
|
|
18947
|
-
var InvocationSchema =
|
|
18948
|
-
runId:
|
|
18949
|
-
agent:
|
|
18950
|
-
parameters:
|
|
18996
|
+
var import_zod8 = require("zod");
|
|
18997
|
+
var InvocationSchema = import_zod8.z.object({
|
|
18998
|
+
runId: import_zod8.z.string().uuid(),
|
|
18999
|
+
agent: import_zod8.z.string().min(1).max(64),
|
|
19000
|
+
parameters: import_zod8.z.record(import_zod8.z.unknown()).default({})
|
|
18951
19001
|
});
|
|
18952
19002
|
var MAX_BODY_BYTES = 64 * 1024;
|
|
18953
19003
|
async function parseInvocation(request) {
|
|
@@ -19189,7 +19239,7 @@ function sleep2(ms) {
|
|
|
19189
19239
|
}
|
|
19190
19240
|
|
|
19191
19241
|
// src/evals/publish.ts
|
|
19192
|
-
var
|
|
19242
|
+
var import_zod9 = require("zod");
|
|
19193
19243
|
init_definition();
|
|
19194
19244
|
|
|
19195
19245
|
// src/evals/runs.ts
|
|
@@ -19239,19 +19289,19 @@ async function evaluateEvalRun(client, runId, options) {
|
|
|
19239
19289
|
}
|
|
19240
19290
|
|
|
19241
19291
|
// src/evals/publish.ts
|
|
19242
|
-
var EvaluatorIdentitySchema =
|
|
19243
|
-
id:
|
|
19244
|
-
slug:
|
|
19245
|
-
programVersion:
|
|
19246
|
-
outputType:
|
|
19292
|
+
var EvaluatorIdentitySchema = import_zod9.z.object({
|
|
19293
|
+
id: import_zod9.z.string().uuid(),
|
|
19294
|
+
slug: import_zod9.z.string(),
|
|
19295
|
+
programVersion: import_zod9.z.number().int().positive(),
|
|
19296
|
+
outputType: import_zod9.z.enum(["boolean", "score", "number"])
|
|
19247
19297
|
});
|
|
19248
19298
|
var EvaluatorSourceSchema = EvaluatorIdentitySchema.extend({
|
|
19249
|
-
name:
|
|
19250
|
-
description:
|
|
19251
|
-
intent:
|
|
19252
|
-
kind:
|
|
19253
|
-
programSource:
|
|
19254
|
-
rules:
|
|
19299
|
+
name: import_zod9.z.string(),
|
|
19300
|
+
description: import_zod9.z.string().nullable(),
|
|
19301
|
+
intent: import_zod9.z.string(),
|
|
19302
|
+
kind: import_zod9.z.enum(["judge", "deterministic"]),
|
|
19303
|
+
programSource: import_zod9.z.string(),
|
|
19304
|
+
rules: import_zod9.z.array(import_zod9.z.string())
|
|
19255
19305
|
});
|
|
19256
19306
|
var EvalPublishError = class extends Error {
|
|
19257
19307
|
constructor(status, message) {
|
|
@@ -19260,12 +19310,12 @@ var EvalPublishError = class extends Error {
|
|
|
19260
19310
|
this.name = "EvalPublishError";
|
|
19261
19311
|
}
|
|
19262
19312
|
};
|
|
19263
|
-
var ComparisonRunSchema =
|
|
19264
|
-
id:
|
|
19265
|
-
programVersion:
|
|
19313
|
+
var ComparisonRunSchema = import_zod9.z.object({
|
|
19314
|
+
id: import_zod9.z.string().uuid(),
|
|
19315
|
+
programVersion: import_zod9.z.number().int().positive()
|
|
19266
19316
|
});
|
|
19267
|
-
var ComparisonLinkSchema =
|
|
19268
|
-
url:
|
|
19317
|
+
var ComparisonLinkSchema = import_zod9.z.object({
|
|
19318
|
+
url: import_zod9.z.string().url(),
|
|
19269
19319
|
first: ComparisonRunSchema,
|
|
19270
19320
|
second: ComparisonRunSchema
|
|
19271
19321
|
});
|
|
@@ -19293,7 +19343,7 @@ async function compareEvalRuns(client, options) {
|
|
|
19293
19343
|
}
|
|
19294
19344
|
const before = selected.id;
|
|
19295
19345
|
const after = counterpart.id;
|
|
19296
|
-
const { data } =
|
|
19346
|
+
const { data } = import_zod9.z.object({ data: ComparisonLinkSchema }).parse(await evalRequest(client, `/v1/eval-runs/${before}/compare/${after}`, options));
|
|
19297
19347
|
if (data.first.id !== before || data.second.id !== after) {
|
|
19298
19348
|
throw new Error("Raindrop returned a different comparison pair");
|
|
19299
19349
|
}
|
|
@@ -19306,7 +19356,7 @@ async function compareEvalRuns(client, options) {
|
|
|
19306
19356
|
};
|
|
19307
19357
|
}
|
|
19308
19358
|
async function readEvaluator(client, slug, options = {}) {
|
|
19309
|
-
const { data } =
|
|
19359
|
+
const { data } = import_zod9.z.object({ data: EvaluatorSourceSchema }).parse(await evalRequest(client, `/v1/evals/${encodeURIComponent(slug)}`, options));
|
|
19310
19360
|
if (data.slug !== slug) throw new Error("Raindrop returned a different evaluator slug");
|
|
19311
19361
|
return defineEvaluatorProgram({
|
|
19312
19362
|
slug: data.slug,
|
|
@@ -19326,15 +19376,11 @@ async function publishEvalSuite(client, definition, options = {}) {
|
|
|
19326
19376
|
const localDataset = isEvalDataset(suite.dataset) ? suite.dataset : void 0;
|
|
19327
19377
|
const slug = EvalDatasetSlugSchema.parse(localDataset ? localDataset.id : suite.dataset);
|
|
19328
19378
|
const rows = localDataset == null ? void 0 : localDataset.rows.map((row) => {
|
|
19329
|
-
if (row.output !== null) {
|
|
19330
|
-
throw new Error(
|
|
19331
|
-
"Publish reference evidence with publishEvalDataset first; a local row output is not a reference trace"
|
|
19332
|
-
);
|
|
19333
|
-
}
|
|
19334
19379
|
return EvalDatasetCaseInputSchema.parse({
|
|
19335
19380
|
id: row.id,
|
|
19336
19381
|
name: row.name,
|
|
19337
19382
|
input: row.input,
|
|
19383
|
+
output: row.output === null ? void 0 : row.output,
|
|
19338
19384
|
properties: row.properties
|
|
19339
19385
|
});
|
|
19340
19386
|
});
|
|
@@ -19381,7 +19427,7 @@ async function publishEvalSuite(client, definition, options = {}) {
|
|
|
19381
19427
|
});
|
|
19382
19428
|
return defineEvalSuite({
|
|
19383
19429
|
...suite,
|
|
19384
|
-
dataset: slug,
|
|
19430
|
+
dataset: dataset.dataset.slug,
|
|
19385
19431
|
datasetVersionId: dataset.version.id,
|
|
19386
19432
|
evaluators
|
|
19387
19433
|
});
|
|
@@ -19432,34 +19478,35 @@ init_trace();
|
|
|
19432
19478
|
init_portable();
|
|
19433
19479
|
|
|
19434
19480
|
// src/evals/pull.ts
|
|
19435
|
-
var
|
|
19481
|
+
var import_zod12 = require("zod");
|
|
19436
19482
|
init_definition();
|
|
19483
|
+
init_trace();
|
|
19437
19484
|
init_portable();
|
|
19438
19485
|
var SNAPSHOT_VERSION = 1;
|
|
19439
|
-
var PulledEvaluatorSchema =
|
|
19440
|
-
slug:
|
|
19441
|
-
name:
|
|
19442
|
-
expectedSha256:
|
|
19443
|
-
artifact:
|
|
19486
|
+
var PulledEvaluatorSchema = import_zod12.z.object({
|
|
19487
|
+
slug: import_zod12.z.string().min(1),
|
|
19488
|
+
name: import_zod12.z.string().min(1),
|
|
19489
|
+
expectedSha256: import_zod12.z.string().regex(/^[a-f0-9]{64}$/),
|
|
19490
|
+
artifact: import_zod12.z.unknown()
|
|
19444
19491
|
});
|
|
19445
|
-
var EvalSnapshotSchema =
|
|
19446
|
-
schemaVersion:
|
|
19447
|
-
pulledAt:
|
|
19448
|
-
dataset:
|
|
19449
|
-
reference:
|
|
19450
|
-
datasetId:
|
|
19451
|
-
fingerprint:
|
|
19452
|
-
rows:
|
|
19453
|
-
|
|
19454
|
-
id:
|
|
19455
|
-
name:
|
|
19456
|
-
input:
|
|
19457
|
-
output:
|
|
19458
|
-
properties:
|
|
19492
|
+
var EvalSnapshotSchema = import_zod12.z.object({
|
|
19493
|
+
schemaVersion: import_zod12.z.literal(SNAPSHOT_VERSION),
|
|
19494
|
+
pulledAt: import_zod12.z.string().datetime(),
|
|
19495
|
+
dataset: import_zod12.z.object({
|
|
19496
|
+
reference: import_zod12.z.string().min(1),
|
|
19497
|
+
datasetId: import_zod12.z.string().uuid(),
|
|
19498
|
+
fingerprint: import_zod12.z.string().regex(/^[a-f0-9]{64}$/),
|
|
19499
|
+
rows: import_zod12.z.array(
|
|
19500
|
+
import_zod12.z.object({
|
|
19501
|
+
id: import_zod12.z.string(),
|
|
19502
|
+
name: import_zod12.z.string(),
|
|
19503
|
+
input: import_zod12.z.string().nullable(),
|
|
19504
|
+
output: JsonValueSchema,
|
|
19505
|
+
properties: import_zod12.z.record(import_zod12.z.string())
|
|
19459
19506
|
})
|
|
19460
19507
|
)
|
|
19461
19508
|
}),
|
|
19462
|
-
evaluators:
|
|
19509
|
+
evaluators: import_zod12.z.array(PulledEvaluatorSchema)
|
|
19463
19510
|
});
|
|
19464
19511
|
async function pullEval(client, options) {
|
|
19465
19512
|
var _a;
|
|
@@ -19524,11 +19571,11 @@ async function pullEvaluator(client, queryUrl, rawSlug) {
|
|
|
19524
19571
|
`Raindrop evaluator ${rawSlug} pull failed with ${response.status}: ${await response.text()}`
|
|
19525
19572
|
);
|
|
19526
19573
|
}
|
|
19527
|
-
const body =
|
|
19528
|
-
data:
|
|
19529
|
-
slug:
|
|
19530
|
-
name:
|
|
19531
|
-
artifact:
|
|
19574
|
+
const body = import_zod12.z.object({
|
|
19575
|
+
data: import_zod12.z.object({
|
|
19576
|
+
slug: import_zod12.z.string(),
|
|
19577
|
+
name: import_zod12.z.string(),
|
|
19578
|
+
artifact: import_zod12.z.unknown().nullable()
|
|
19532
19579
|
})
|
|
19533
19580
|
}).parse(await response.json());
|
|
19534
19581
|
if (!body.data.artifact)
|
|
@@ -19615,9 +19662,7 @@ async function writeSnapshot(path, value) {
|
|
|
19615
19662
|
}
|
|
19616
19663
|
|
|
19617
19664
|
// src/evals/run.ts
|
|
19618
|
-
var import_api8 = require("@opentelemetry/api");
|
|
19619
19665
|
init_definition();
|
|
19620
|
-
init_trace();
|
|
19621
19666
|
|
|
19622
19667
|
// src/evals/policy.ts
|
|
19623
19668
|
init_definition();
|
|
@@ -19662,134 +19707,9 @@ function outputMismatch(name, output) {
|
|
|
19662
19707
|
}
|
|
19663
19708
|
|
|
19664
19709
|
// src/evals/run.ts
|
|
19665
|
-
init_portable();
|
|
19666
|
-
|
|
19667
|
-
// src/evals/workshop.ts
|
|
19668
|
-
var import_zod12 = require("zod");
|
|
19669
|
-
var WorkshopRunSchema = import_zod12.z.object({
|
|
19670
|
-
id: import_zod12.z.string(),
|
|
19671
|
-
event_id: import_zod12.z.string().nullable(),
|
|
19672
|
-
name: import_zod12.z.string().nullable(),
|
|
19673
|
-
event_name: import_zod12.z.string().nullable(),
|
|
19674
|
-
user_id: import_zod12.z.string().nullable(),
|
|
19675
|
-
convo_id: import_zod12.z.string().nullable(),
|
|
19676
|
-
started_at: import_zod12.z.number().nullable(),
|
|
19677
|
-
last_updated_at: import_zod12.z.number().nullable(),
|
|
19678
|
-
metadata: import_zod12.z.string().nullable(),
|
|
19679
|
-
model: import_zod12.z.string().nullable(),
|
|
19680
|
-
finished: import_zod12.z.number().nullable()
|
|
19681
|
-
});
|
|
19682
|
-
var WorkshopSpanSchema = import_zod12.z.object({
|
|
19683
|
-
id: import_zod12.z.string(),
|
|
19684
|
-
run_id: import_zod12.z.string(),
|
|
19685
|
-
parent_span_id: import_zod12.z.string().nullable(),
|
|
19686
|
-
name: import_zod12.z.string(),
|
|
19687
|
-
span_type: import_zod12.z.string().nullable(),
|
|
19688
|
-
status: import_zod12.z.string().nullable(),
|
|
19689
|
-
input_payload: import_zod12.z.string().nullable(),
|
|
19690
|
-
output_payload: import_zod12.z.string().nullable(),
|
|
19691
|
-
start_time_ms: import_zod12.z.number().nullable(),
|
|
19692
|
-
end_time_ms: import_zod12.z.number().nullable(),
|
|
19693
|
-
duration_ms: import_zod12.z.number().nullable(),
|
|
19694
|
-
model: import_zod12.z.string().nullable(),
|
|
19695
|
-
provider: import_zod12.z.string().nullable(),
|
|
19696
|
-
input_tokens: import_zod12.z.number().nullable(),
|
|
19697
|
-
output_tokens: import_zod12.z.number().nullable(),
|
|
19698
|
-
attributes: import_zod12.z.string().nullable()
|
|
19699
|
-
});
|
|
19700
|
-
var WorkshopTraceEnvelopeSchema = import_zod12.z.object({
|
|
19701
|
-
status: import_zod12.z.literal("complete"),
|
|
19702
|
-
correlationId: import_zod12.z.string(),
|
|
19703
|
-
traceId: import_zod12.z.string(),
|
|
19704
|
-
rootSpanId: import_zod12.z.string(),
|
|
19705
|
-
spanCount: import_zod12.z.number().int().positive(),
|
|
19706
|
-
run: WorkshopRunSchema,
|
|
19707
|
-
spans: import_zod12.z.array(WorkshopSpanSchema).min(1)
|
|
19708
|
-
});
|
|
19709
|
-
async function readWorkshopTrace(input) {
|
|
19710
|
-
if (!Number.isFinite(input.waitMs) || input.waitMs < 0)
|
|
19711
|
-
throw new Error("Workshop waitMs must be finite and non-negative");
|
|
19712
|
-
const deadlineAt = Date.now() + input.waitMs;
|
|
19713
|
-
if (input.expectedSpanIds.length === 0) {
|
|
19714
|
-
throw new Error(`Workshop trace ${input.correlationId} exported no spans`);
|
|
19715
|
-
}
|
|
19716
|
-
const url = new URL(
|
|
19717
|
-
`${credentialEndpoint(input.workshopUrl).href.replace(/\/+$/, "")}/v1/evals/traces/${encodeURIComponent(input.correlationId)}`
|
|
19718
|
-
);
|
|
19719
|
-
for (const spanId of input.expectedSpanIds) url.searchParams.append("expectedSpanId", spanId);
|
|
19720
|
-
while (true) {
|
|
19721
|
-
const response = await runWithTracingSuppressed(
|
|
19722
|
-
() => fetch(url, {
|
|
19723
|
-
redirect: "error",
|
|
19724
|
-
signal: AbortSignal.timeout(
|
|
19725
|
-
Math.min(3e4, Math.max(1, Math.ceil(deadlineAt - Date.now())))
|
|
19726
|
-
)
|
|
19727
|
-
})
|
|
19728
|
-
);
|
|
19729
|
-
if (response.ok) {
|
|
19730
|
-
const parsed = WorkshopTraceEnvelopeSchema.safeParse(await response.json());
|
|
19731
|
-
if (!parsed.success) {
|
|
19732
|
-
throw new Error(`Workshop returned an invalid completed trace: ${parsed.error.message}`);
|
|
19733
|
-
}
|
|
19734
|
-
return parsed.data;
|
|
19735
|
-
}
|
|
19736
|
-
if (response.status !== 404 && response.status !== 409) {
|
|
19737
|
-
throw new Error(
|
|
19738
|
-
`Workshop trace read failed with ${response.status}: ${await response.text()}`
|
|
19739
|
-
);
|
|
19740
|
-
}
|
|
19741
|
-
if (Date.now() >= deadlineAt) {
|
|
19742
|
-
const state2 = response.status === 404 ? "missing" : "incomplete";
|
|
19743
|
-
throw new Error(`Workshop trace ${input.correlationId} remained ${state2}`);
|
|
19744
|
-
}
|
|
19745
|
-
await new Promise(
|
|
19746
|
-
(resolve2) => setTimeout(resolve2, Math.min(50, Math.max(0, deadlineAt - Date.now())))
|
|
19747
|
-
);
|
|
19748
|
-
}
|
|
19749
|
-
}
|
|
19750
|
-
async function writeWorkshopEvalRun(workshopUrl, packet) {
|
|
19751
|
-
const normalized = {
|
|
19752
|
-
...packet,
|
|
19753
|
-
cases: packet.cases.map((entry) => ({
|
|
19754
|
-
...entry,
|
|
19755
|
-
task: entry.task.state === "completed" ? { ...entry.task, output: serializableOutput(entry.task.output) } : entry.task
|
|
19756
|
-
}))
|
|
19757
|
-
};
|
|
19758
|
-
const response = await runWithTracingSuppressed(
|
|
19759
|
-
() => fetch(`${credentialEndpoint(workshopUrl).href.replace(/\/+$/, "")}/v1/evals/runs`, {
|
|
19760
|
-
method: "POST",
|
|
19761
|
-
headers: { "content-type": "application/json" },
|
|
19762
|
-
body: JSON.stringify(normalized),
|
|
19763
|
-
redirect: "error",
|
|
19764
|
-
signal: AbortSignal.timeout(3e4)
|
|
19765
|
-
})
|
|
19766
|
-
);
|
|
19767
|
-
if (!response.ok) {
|
|
19768
|
-
throw new Error(
|
|
19769
|
-
`Workshop eval result write failed with ${response.status}: ${await response.text()}`
|
|
19770
|
-
);
|
|
19771
|
-
}
|
|
19772
|
-
const body = await response.json();
|
|
19773
|
-
if (typeof body !== "object" || body === null || !("id" in body) || typeof body.id !== "string") {
|
|
19774
|
-
throw new Error("Workshop eval result write returned an invalid response");
|
|
19775
|
-
}
|
|
19776
|
-
return { id: body.id };
|
|
19777
|
-
}
|
|
19778
|
-
function serializableOutput(value) {
|
|
19779
|
-
try {
|
|
19780
|
-
const serialized = JSON.stringify(boundedClone(value, 64e3));
|
|
19781
|
-
if (serialized === void 0) return null;
|
|
19782
|
-
if (serialized.length > 64e3) return "[Output exceeds 64000 characters]";
|
|
19783
|
-
return JSON.parse(serialized);
|
|
19784
|
-
} catch (e) {
|
|
19785
|
-
return "[Output could not be serialized]";
|
|
19786
|
-
}
|
|
19787
|
-
}
|
|
19788
|
-
|
|
19789
|
-
// src/evals/run.ts
|
|
19790
|
-
var DEFAULT_WORKSHOP_TRACE_WAIT_MS = 3e4;
|
|
19791
19710
|
function createEvalSuiteRun(client, definition, options) {
|
|
19792
19711
|
var _a;
|
|
19712
|
+
assertRaindropDestination(options.destination);
|
|
19793
19713
|
const validated = validateDefinition(definition);
|
|
19794
19714
|
const execution = bindSuite(validated, (_a = options.parameters) != null ? _a : {});
|
|
19795
19715
|
const session = createSuiteSession(client, validated, execution.run, options);
|
|
@@ -19811,66 +19731,41 @@ function bindSuite(definition, parameters) {
|
|
|
19811
19731
|
return definition.agent.start(parameters);
|
|
19812
19732
|
}
|
|
19813
19733
|
function createSuiteSession(client, validated, run, options) {
|
|
19814
|
-
if (validated.datasetVersionId &&
|
|
19734
|
+
if (validated.datasetVersionId && options.selection.dataset.version.id !== validated.datasetVersionId) {
|
|
19815
19735
|
throw new Error("Selected dataset version does not match the published suite");
|
|
19816
19736
|
}
|
|
19817
|
-
if (
|
|
19818
|
-
|
|
19819
|
-
throw new Error("Raindrop remote eval sessions require selected rows");
|
|
19820
|
-
}
|
|
19821
|
-
if (typeof validated.dataset !== "string") {
|
|
19822
|
-
throw new Error("Raindrop remote eval sessions require a dataset slug");
|
|
19823
|
-
}
|
|
19824
|
-
if (options.selection.dataset.dataset.slug !== validated.dataset) {
|
|
19825
|
-
throw new Error(
|
|
19826
|
-
`Raindrop eval ${validated.name} pinned dataset ${options.selection.dataset.dataset.slug} does not match ${validated.dataset}`
|
|
19827
|
-
);
|
|
19828
|
-
}
|
|
19829
|
-
const localEvaluators = validated.evaluators.flatMap((entry) => {
|
|
19830
|
-
const evaluator = replayEvaluator(entry);
|
|
19831
|
-
return typeof evaluator === "string" ? [] : [evaluator];
|
|
19832
|
-
});
|
|
19833
|
-
if (localEvaluators.length !== validated.evaluators.length) {
|
|
19834
|
-
throw new Error("Raindrop row-scoped eval sessions support local evaluators only");
|
|
19835
|
-
}
|
|
19836
|
-
const selection = validateRemoteSelection(validated.dataset, options.selection);
|
|
19837
|
-
if (!selection) throw new Error("Raindrop remote eval sessions require selected rows");
|
|
19838
|
-
return new RaindropRowEvalRun(
|
|
19839
|
-
client,
|
|
19840
|
-
validated,
|
|
19841
|
-
run,
|
|
19842
|
-
options.destination,
|
|
19843
|
-
options.selection.dataset,
|
|
19844
|
-
selection.rowIds,
|
|
19845
|
-
localEvaluators
|
|
19846
|
-
);
|
|
19847
|
-
}
|
|
19848
|
-
if (!isEvalDataset(validated.dataset)) {
|
|
19849
|
-
throw new Error("Workshop eval execution requires a pulled or local dataset snapshot");
|
|
19737
|
+
if (typeof validated.dataset !== "string") {
|
|
19738
|
+
throw new Error("Raindrop eval sessions require a dataset slug");
|
|
19850
19739
|
}
|
|
19851
|
-
|
|
19852
|
-
const hosted = validated.evaluators.find((entry) => typeof entry.evaluator === "string");
|
|
19853
|
-
if (hosted && typeof hosted.evaluator === "string") {
|
|
19854
|
-
throw new Error(`Workshop evaluator ${hosted.evaluator} must be pulled before local execution`);
|
|
19855
|
-
}
|
|
19856
|
-
if (validated.evaluators.some(
|
|
19857
|
-
(entry) => typeof entry.evaluator !== "string" && "kind" in entry.evaluator && entry.evaluator.kind === "program"
|
|
19858
|
-
)) {
|
|
19740
|
+
if (options.selection.dataset.dataset.id !== validated.dataset && options.selection.dataset.dataset.slug !== validated.dataset) {
|
|
19859
19741
|
throw new Error(
|
|
19860
|
-
|
|
19742
|
+
`Raindrop eval ${validated.name} pinned dataset ${options.selection.dataset.dataset.slug} does not match ${validated.dataset}`
|
|
19861
19743
|
);
|
|
19862
19744
|
}
|
|
19863
|
-
|
|
19745
|
+
const localEvaluators = validated.evaluators.flatMap((entry) => {
|
|
19746
|
+
const evaluator = replayEvaluator(entry);
|
|
19747
|
+
return typeof evaluator === "string" ? [] : [evaluator];
|
|
19748
|
+
});
|
|
19749
|
+
if (localEvaluators.length !== validated.evaluators.length) {
|
|
19750
|
+
throw new Error("Raindrop row-scoped eval sessions support local evaluators only");
|
|
19751
|
+
}
|
|
19752
|
+
const selection = validateRemoteSelection(validated.dataset, options.selection);
|
|
19753
|
+
if (!selection) throw new Error("Raindrop eval sessions require selected rows");
|
|
19754
|
+
return new RaindropRowEvalRun(
|
|
19864
19755
|
client,
|
|
19865
|
-
|
|
19756
|
+
validated,
|
|
19866
19757
|
run,
|
|
19867
|
-
options.destination
|
|
19758
|
+
options.destination,
|
|
19759
|
+
options.selection.dataset,
|
|
19760
|
+
selection.rowIds,
|
|
19761
|
+
localEvaluators
|
|
19868
19762
|
);
|
|
19869
19763
|
}
|
|
19870
19764
|
async function runEvalSuite(client, definition, options = {}) {
|
|
19871
|
-
var _a;
|
|
19765
|
+
var _a, _b;
|
|
19766
|
+
assertRaindropDestination((_a = options.destination) != null ? _a : { kind: "raindrop" });
|
|
19872
19767
|
const validated = validateDefinition(definition);
|
|
19873
|
-
const execution = bindSuite(validated, (
|
|
19768
|
+
const execution = bindSuite(validated, (_b = options.parameters) != null ? _b : {});
|
|
19874
19769
|
return finishWith(execution, () => runSuite(client, validated, execution.run, options));
|
|
19875
19770
|
}
|
|
19876
19771
|
async function runSuite(client, definition, run, options) {
|
|
@@ -19880,12 +19775,6 @@ async function runSuite(client, definition, run, options) {
|
|
|
19880
19775
|
if (validated.datasetVersionId && ((_b = options.selection) == null ? void 0 : _b.dataset) && options.selection.dataset.version.id !== validated.datasetVersionId) {
|
|
19881
19776
|
throw new Error("Selected dataset version does not match the published suite");
|
|
19882
19777
|
}
|
|
19883
|
-
if (destination.kind === "workshop") {
|
|
19884
|
-
if (options.runId !== void 0) throw new Error("Queued runs are only supported in Raindrop");
|
|
19885
|
-
const session = createSuiteSession(client, validated, run, { destination });
|
|
19886
|
-
await session.run({ selection: options.selection, attempt: options.attempt });
|
|
19887
|
-
return session.finish();
|
|
19888
|
-
}
|
|
19889
19778
|
const alreadyPublished = isPublishedEvalSuite(validated);
|
|
19890
19779
|
if (typeof validated.dataset === "string" && ((_c = options.selection) == null ? void 0 : _c.dataset)) {
|
|
19891
19780
|
validateRemoteSelection(validated.dataset, options.selection);
|
|
@@ -20115,328 +20004,6 @@ function replayEvaluatorsFromVerdicts(verdicts) {
|
|
|
20115
20004
|
}
|
|
20116
20005
|
return [...evaluators.values()];
|
|
20117
20006
|
}
|
|
20118
|
-
var WorkshopEvalRun = class {
|
|
20119
|
-
constructor(client, definition, runRow, destination) {
|
|
20120
|
-
this.client = client;
|
|
20121
|
-
this.definition = definition;
|
|
20122
|
-
this.runRow = runRow;
|
|
20123
|
-
this.destination = destination;
|
|
20124
|
-
this.id = randomId();
|
|
20125
|
-
this.startedAt = /* @__PURE__ */ new Date();
|
|
20126
|
-
this.completed = [];
|
|
20127
|
-
this.active = /* @__PURE__ */ new Set();
|
|
20128
|
-
this.state = "open";
|
|
20129
|
-
this.runningRows = 0;
|
|
20130
|
-
this.rowWaiters = [];
|
|
20131
|
-
}
|
|
20132
|
-
async run(options = {}) {
|
|
20133
|
-
if (this.state !== "open") throw new Error(`Raindrop eval run ${this.id} is already finishing`);
|
|
20134
|
-
const operation = this.runOnce(options);
|
|
20135
|
-
this.active.add(operation);
|
|
20136
|
-
try {
|
|
20137
|
-
return await operation;
|
|
20138
|
-
} finally {
|
|
20139
|
-
this.active.delete(operation);
|
|
20140
|
-
}
|
|
20141
|
-
}
|
|
20142
|
-
async runOnce(options) {
|
|
20143
|
-
var _a;
|
|
20144
|
-
const rows = selectLocalRows(this.definition, options.selection);
|
|
20145
|
-
const completed = await Promise.all(
|
|
20146
|
-
rows.map((row) => this.withRowPermit(() => {
|
|
20147
|
-
var _a2;
|
|
20148
|
-
return this.executeRow(row, (_a2 = options.attempt) != null ? _a2 : 0);
|
|
20149
|
-
}))
|
|
20150
|
-
);
|
|
20151
|
-
const graded = await this.applyPortableEvaluators(completed, (_a = options.attempt) != null ? _a : 0);
|
|
20152
|
-
this.completed.push(...graded);
|
|
20153
|
-
return workshopResult(
|
|
20154
|
-
this.id,
|
|
20155
|
-
this.definition.name,
|
|
20156
|
-
graded.map((entry) => entry.result)
|
|
20157
|
-
);
|
|
20158
|
-
}
|
|
20159
|
-
finish() {
|
|
20160
|
-
if (this.finishPromise) return this.finishPromise;
|
|
20161
|
-
this.state = "finishing";
|
|
20162
|
-
this.finishPromise = this.finishOnce();
|
|
20163
|
-
return this.finishPromise;
|
|
20164
|
-
}
|
|
20165
|
-
async finishOnce() {
|
|
20166
|
-
await Promise.allSettled([...this.active]);
|
|
20167
|
-
const result = workshopResult(
|
|
20168
|
-
this.id,
|
|
20169
|
-
this.definition.name,
|
|
20170
|
-
this.completed.map((entry) => entry.result)
|
|
20171
|
-
);
|
|
20172
|
-
if (this.completed.length > 0) {
|
|
20173
|
-
const packet = {
|
|
20174
|
-
schemaVersion: 1,
|
|
20175
|
-
run: {
|
|
20176
|
-
id: this.id,
|
|
20177
|
-
name: this.definition.name,
|
|
20178
|
-
destination: "workshop",
|
|
20179
|
-
startedAt: this.startedAt.toISOString(),
|
|
20180
|
-
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
20181
|
-
dataset: {
|
|
20182
|
-
id: this.definition.dataset.id,
|
|
20183
|
-
name: this.definition.dataset.name,
|
|
20184
|
-
version: this.definition.dataset.version
|
|
20185
|
-
},
|
|
20186
|
-
evaluators: this.definition.evaluators.map((entry) => {
|
|
20187
|
-
if (typeof entry.evaluator === "string") {
|
|
20188
|
-
throw new Error(
|
|
20189
|
-
`Workshop evaluator ${entry.evaluator} must be pulled before local execution`
|
|
20190
|
-
);
|
|
20191
|
-
}
|
|
20192
|
-
if (isPortableEvaluator(entry.evaluator)) {
|
|
20193
|
-
return {
|
|
20194
|
-
slug: entry.evaluator.slug,
|
|
20195
|
-
name: entry.evaluator.name,
|
|
20196
|
-
output: entry.evaluator.output,
|
|
20197
|
-
execution: "portable",
|
|
20198
|
-
version: entry.evaluator.artifact.evaluator.programVersion,
|
|
20199
|
-
artifactSha256: entry.evaluator.artifact.sha256,
|
|
20200
|
-
scope: entry.evaluator.scope,
|
|
20201
|
-
threshold: entry.threshold
|
|
20202
|
-
};
|
|
20203
|
-
}
|
|
20204
|
-
return {
|
|
20205
|
-
slug: entry.evaluator.slug,
|
|
20206
|
-
name: entry.evaluator.name,
|
|
20207
|
-
output: entry.evaluator.output,
|
|
20208
|
-
execution: "local",
|
|
20209
|
-
scope: entry.evaluator.scope === "row" ? "case" : entry.evaluator.scope,
|
|
20210
|
-
threshold: entry.threshold
|
|
20211
|
-
};
|
|
20212
|
-
})
|
|
20213
|
-
},
|
|
20214
|
-
cases: this.completed.map((entry) => entry.packet)
|
|
20215
|
-
};
|
|
20216
|
-
await writeWorkshopEvalRun(this.destination.url, packet);
|
|
20217
|
-
}
|
|
20218
|
-
this.state = "finished";
|
|
20219
|
-
return result;
|
|
20220
|
-
}
|
|
20221
|
-
async executeRow(row, attempt) {
|
|
20222
|
-
var _a, _b, _c;
|
|
20223
|
-
const correlationId = randomId();
|
|
20224
|
-
const exportedSpanIds = /* @__PURE__ */ new Set();
|
|
20225
|
-
const startedAt = Date.now();
|
|
20226
|
-
let completedAgent;
|
|
20227
|
-
let taskError;
|
|
20228
|
-
try {
|
|
20229
|
-
const destination = {
|
|
20230
|
-
kind: "workshop",
|
|
20231
|
-
url: this.destination.url,
|
|
20232
|
-
exportedSpanIds
|
|
20233
|
-
};
|
|
20234
|
-
const value = await withReplayTraceDestination(
|
|
20235
|
-
destination,
|
|
20236
|
-
() => withEvalScope(
|
|
20237
|
-
{ correlationId },
|
|
20238
|
-
() => this.client.tracer().withSpan(
|
|
20239
|
-
{
|
|
20240
|
-
name: "raindrop.eval.case",
|
|
20241
|
-
properties: {
|
|
20242
|
-
"raindrop.eval.run_id": this.id,
|
|
20243
|
-
"raindrop.eval.case_id": row.id,
|
|
20244
|
-
"raindrop.eval.attempt": String(attempt)
|
|
20245
|
-
},
|
|
20246
|
-
inputParameters: [row],
|
|
20247
|
-
traceContent: true
|
|
20248
|
-
},
|
|
20249
|
-
() => {
|
|
20250
|
-
var _a2;
|
|
20251
|
-
const parent = (_a2 = import_api8.trace.getSpan(import_api8.context.active())) == null ? void 0 : _a2.spanContext();
|
|
20252
|
-
if (!parent) return this.runRow(row);
|
|
20253
|
-
return withReplayTraceDestination(
|
|
20254
|
-
{
|
|
20255
|
-
...destination,
|
|
20256
|
-
parentSpanContext: {
|
|
20257
|
-
traceIdB64: Buffer.from(parent.traceId, "hex").toString("base64"),
|
|
20258
|
-
spanIdB64: Buffer.from(parent.spanId, "hex").toString("base64"),
|
|
20259
|
-
eventId: parent.traceId
|
|
20260
|
-
}
|
|
20261
|
-
},
|
|
20262
|
-
() => this.runRow(row)
|
|
20263
|
-
);
|
|
20264
|
-
}
|
|
20265
|
-
)
|
|
20266
|
-
)
|
|
20267
|
-
);
|
|
20268
|
-
completedAgent = { value };
|
|
20269
|
-
} catch (cause) {
|
|
20270
|
-
taskError = describeError2(cause);
|
|
20271
|
-
}
|
|
20272
|
-
const durationMs = Date.now() - startedAt;
|
|
20273
|
-
const taskCompleted = completedAgent !== void 0;
|
|
20274
|
-
let trace8;
|
|
20275
|
-
let traceId = null;
|
|
20276
|
-
let traceError;
|
|
20277
|
-
try {
|
|
20278
|
-
await this.client.forceFlush();
|
|
20279
|
-
const envelope = await readWorkshopTrace({
|
|
20280
|
-
workshopUrl: this.destination.url,
|
|
20281
|
-
correlationId,
|
|
20282
|
-
waitMs: (_a = this.definition.traceWaitMs) != null ? _a : DEFAULT_WORKSHOP_TRACE_WAIT_MS,
|
|
20283
|
-
expectedSpanIds: [...exportedSpanIds]
|
|
20284
|
-
});
|
|
20285
|
-
traceId = envelope.traceId;
|
|
20286
|
-
trace8 = canonicalWorkshopTrace(envelope);
|
|
20287
|
-
} catch (cause) {
|
|
20288
|
-
traceError = describeError2(cause);
|
|
20289
|
-
}
|
|
20290
|
-
const verdicts = [];
|
|
20291
|
-
if (completedAgent && !traceError && trace8) {
|
|
20292
|
-
const agentResult = completedAgent.value;
|
|
20293
|
-
await Promise.all(
|
|
20294
|
-
this.definition.evaluators.map(async (entry) => {
|
|
20295
|
-
if (typeof entry.evaluator === "string") return;
|
|
20296
|
-
if (isPortableEvaluator(entry.evaluator)) return;
|
|
20297
|
-
if ("kind" in entry.evaluator && entry.evaluator.kind === "program") return;
|
|
20298
|
-
try {
|
|
20299
|
-
const verdict = parseLocalVerdict2(
|
|
20300
|
-
entry.evaluator.output,
|
|
20301
|
-
await entry.evaluator.judge({ trace: trace8, row, result: agentResult })
|
|
20302
|
-
);
|
|
20303
|
-
verdicts.push(
|
|
20304
|
-
withVerdictIdentity(entry.evaluator.slug, this.id, this.destination.url, verdict)
|
|
20305
|
-
);
|
|
20306
|
-
} catch (cause) {
|
|
20307
|
-
verdicts.push({
|
|
20308
|
-
evaluator: entry.evaluator.slug,
|
|
20309
|
-
runId: this.id,
|
|
20310
|
-
url: workshopEvalUrl(this.destination.url, this.id),
|
|
20311
|
-
state: "errored",
|
|
20312
|
-
message: describeError2(cause)
|
|
20313
|
-
});
|
|
20314
|
-
}
|
|
20315
|
-
})
|
|
20316
|
-
);
|
|
20317
|
-
}
|
|
20318
|
-
if (taskCompleted && traceError) {
|
|
20319
|
-
for (const entry of this.definition.evaluators) {
|
|
20320
|
-
if (typeof entry.evaluator === "string") continue;
|
|
20321
|
-
verdicts.push({
|
|
20322
|
-
evaluator: entry.evaluator.slug,
|
|
20323
|
-
runId: this.id,
|
|
20324
|
-
url: workshopEvalUrl(this.destination.url, this.id),
|
|
20325
|
-
state: "ungraded",
|
|
20326
|
-
reason: "trace unavailable"
|
|
20327
|
-
});
|
|
20328
|
-
}
|
|
20329
|
-
}
|
|
20330
|
-
const assessments = verdicts.map((verdict) => {
|
|
20331
|
-
const evaluator = this.definition.evaluators.find(
|
|
20332
|
-
(entry) => evaluatorName(entry) === verdict.evaluator
|
|
20333
|
-
);
|
|
20334
|
-
if (!evaluator)
|
|
20335
|
-
throw new Error(`Raindrop eval result included unknown evaluator ${verdict.evaluator}`);
|
|
20336
|
-
return assessEvalVerdict(evaluator, verdict, evaluatorOutput(evaluator));
|
|
20337
|
-
});
|
|
20338
|
-
const error = (_b = taskError != null ? taskError : traceError) != null ? _b : null;
|
|
20339
|
-
const result = {
|
|
20340
|
-
...row,
|
|
20341
|
-
attempt,
|
|
20342
|
-
status: error ? "missing" : "done",
|
|
20343
|
-
traceId,
|
|
20344
|
-
error,
|
|
20345
|
-
verdicts: assessments
|
|
20346
|
-
};
|
|
20347
|
-
const packet = {
|
|
20348
|
-
caseId: row.id,
|
|
20349
|
-
caseName: row.name,
|
|
20350
|
-
input: row.input,
|
|
20351
|
-
...row.output === null ? {} : { expected: row.output },
|
|
20352
|
-
attempt,
|
|
20353
|
-
traceId,
|
|
20354
|
-
...taskCompleted && traceError ? { traceError } : {},
|
|
20355
|
-
task: taskError ? { state: "failed", error: taskError, durationMs } : { state: "completed", output: (_c = completedAgent == null ? void 0 : completedAgent.value) != null ? _c : null, durationMs },
|
|
20356
|
-
verdicts: verdicts.map(workshopVerdict),
|
|
20357
|
-
passed: error === null && assessments.every(
|
|
20358
|
-
(assessment) => assessment.state === "passed" || assessment.state === "measurement"
|
|
20359
|
-
)
|
|
20360
|
-
};
|
|
20361
|
-
return { result, packet, trace: trace8 };
|
|
20362
|
-
}
|
|
20363
|
-
async withRowPermit(run) {
|
|
20364
|
-
var _a;
|
|
20365
|
-
const limit = (_a = this.definition.concurrency) != null ? _a : 4;
|
|
20366
|
-
if (this.runningRows >= limit) {
|
|
20367
|
-
await new Promise((resolve2) => this.rowWaiters.push(resolve2));
|
|
20368
|
-
} else {
|
|
20369
|
-
this.runningRows += 1;
|
|
20370
|
-
}
|
|
20371
|
-
try {
|
|
20372
|
-
return await run();
|
|
20373
|
-
} finally {
|
|
20374
|
-
const next = this.rowWaiters.shift();
|
|
20375
|
-
if (next) next();
|
|
20376
|
-
else this.runningRows -= 1;
|
|
20377
|
-
}
|
|
20378
|
-
}
|
|
20379
|
-
async applyPortableEvaluators(completed, attempt) {
|
|
20380
|
-
let current = completed;
|
|
20381
|
-
for (const entry of this.definition.evaluators) {
|
|
20382
|
-
if (typeof entry.evaluator === "string" || !isPortableEvaluator(entry.evaluator)) continue;
|
|
20383
|
-
const portableEvaluator = entry.evaluator;
|
|
20384
|
-
const traces = current.flatMap(
|
|
20385
|
-
(item) => item.packet.task.state === "completed" && item.trace ? [item.trace] : []
|
|
20386
|
-
);
|
|
20387
|
-
if (traces.length === 0) continue;
|
|
20388
|
-
let outcomes;
|
|
20389
|
-
try {
|
|
20390
|
-
const portable = await evaluatePortableEvaluator(portableEvaluator, {
|
|
20391
|
-
traces,
|
|
20392
|
-
seed: `${this.id}:${attempt}:${portableEvaluator.slug}`
|
|
20393
|
-
});
|
|
20394
|
-
const programFailure = portable.failures.join("; ");
|
|
20395
|
-
outcomes = new Map(
|
|
20396
|
-
portable.outcomes.map((outcome) => [
|
|
20397
|
-
outcome.traceId,
|
|
20398
|
-
programFailure ? {
|
|
20399
|
-
state: "errored",
|
|
20400
|
-
traceId: outcome.traceId,
|
|
20401
|
-
message: programFailure
|
|
20402
|
-
} : outcome
|
|
20403
|
-
])
|
|
20404
|
-
);
|
|
20405
|
-
} catch (cause) {
|
|
20406
|
-
const message = describeError2(cause);
|
|
20407
|
-
outcomes = new Map(
|
|
20408
|
-
traces.map((trace8) => [
|
|
20409
|
-
trace8.event.id,
|
|
20410
|
-
{ state: "errored", traceId: trace8.event.id, message }
|
|
20411
|
-
])
|
|
20412
|
-
);
|
|
20413
|
-
}
|
|
20414
|
-
current = current.map((item) => {
|
|
20415
|
-
if (item.packet.task.state !== "completed" || !item.trace) return item;
|
|
20416
|
-
const outcome = outcomes.get(item.trace.event.id);
|
|
20417
|
-
if (!outcome) return item;
|
|
20418
|
-
const verdict = portableVerdict(
|
|
20419
|
-
portableEvaluator.slug,
|
|
20420
|
-
this.id,
|
|
20421
|
-
this.destination.url,
|
|
20422
|
-
outcome
|
|
20423
|
-
);
|
|
20424
|
-
const assessment = assessEvalVerdict(entry, verdict, portableEvaluator.output);
|
|
20425
|
-
const verdicts = [...item.result.verdicts, assessment];
|
|
20426
|
-
return {
|
|
20427
|
-
...item,
|
|
20428
|
-
result: { ...item.result, verdicts },
|
|
20429
|
-
packet: {
|
|
20430
|
-
...item.packet,
|
|
20431
|
-
verdicts: [...item.packet.verdicts, workshopVerdict(verdict)],
|
|
20432
|
-
passed: item.packet.passed && (assessment.state === "passed" || assessment.state === "measurement")
|
|
20433
|
-
}
|
|
20434
|
-
};
|
|
20435
|
-
});
|
|
20436
|
-
}
|
|
20437
|
-
return current;
|
|
20438
|
-
}
|
|
20439
|
-
};
|
|
20440
20007
|
async function runRaindropEval(client, definition, run, destination, options) {
|
|
20441
20008
|
var _a, _b, _c, _d;
|
|
20442
20009
|
if (typeof definition.dataset !== "string") {
|
|
@@ -20449,7 +20016,7 @@ async function runRaindropEval(client, definition, run, destination, options) {
|
|
|
20449
20016
|
queryUrl: destination.queryUrl,
|
|
20450
20017
|
versionId: definition.datasetVersionId
|
|
20451
20018
|
}) : void 0;
|
|
20452
|
-
if (pinnedDataset && pinnedDataset.dataset.slug !== datasetReference) {
|
|
20019
|
+
if (pinnedDataset && pinnedDataset.dataset.id !== datasetReference && pinnedDataset.dataset.slug !== datasetReference) {
|
|
20453
20020
|
throw new Error(
|
|
20454
20021
|
`Raindrop eval ${definition.name} pinned dataset ${pinnedDataset.dataset.slug} does not match ${datasetReference}`
|
|
20455
20022
|
);
|
|
@@ -20578,20 +20145,6 @@ function validateDefinition(definition) {
|
|
|
20578
20145
|
throw new Error("Raindrop runEvalSuite requires a definition created by defineEvalSuite");
|
|
20579
20146
|
return definition;
|
|
20580
20147
|
}
|
|
20581
|
-
function selectLocalRows(definition, selection) {
|
|
20582
|
-
if (!selection) return definition.dataset.rows;
|
|
20583
|
-
if (selection.rowIds.length === 0)
|
|
20584
|
-
throw new Error(`Raindrop eval ${definition.name} selection cannot be empty`);
|
|
20585
|
-
if (new Set(selection.rowIds).size !== selection.rowIds.length)
|
|
20586
|
-
throw new Error(`Raindrop eval ${definition.name} selection row ids must be unique`);
|
|
20587
|
-
const byId = new Map(definition.dataset.rows.map((row) => [row.id, row]));
|
|
20588
|
-
return selection.rowIds.map((id) => {
|
|
20589
|
-
const row = byId.get(id);
|
|
20590
|
-
if (!row)
|
|
20591
|
-
throw new Error(`Raindrop eval ${definition.name} selection contains unknown row ${id}`);
|
|
20592
|
-
return row;
|
|
20593
|
-
});
|
|
20594
|
-
}
|
|
20595
20148
|
function validateRemoteSelection(dataset, selection) {
|
|
20596
20149
|
var _a;
|
|
20597
20150
|
if (!selection) return void 0;
|
|
@@ -20607,157 +20160,20 @@ function validateRemoteSelection(dataset, selection) {
|
|
|
20607
20160
|
throw new Error(`Raindrop eval ${dataset} selection contains unknown row ${unknown}`);
|
|
20608
20161
|
return { rowIds: selection.rowIds };
|
|
20609
20162
|
}
|
|
20610
|
-
function canonicalWorkshopTrace(envelope) {
|
|
20611
|
-
var _a, _b, _c, _d, _e, _f;
|
|
20612
|
-
const spans = envelope.spans.map(rawTraceSpan);
|
|
20613
|
-
const timestamp = new Date((_a = envelope.run.started_at) != null ? _a : Date.now()).toISOString();
|
|
20614
|
-
const event = projectCapturedEvent({
|
|
20615
|
-
eventId: (_b = envelope.run.event_id) != null ? _b : envelope.traceId,
|
|
20616
|
-
internalEventId: envelope.run.id,
|
|
20617
|
-
name: (_d = (_c = envelope.run.event_name) != null ? _c : envelope.run.name) != null ? _d : "ai_generation",
|
|
20618
|
-
timestamp,
|
|
20619
|
-
receivedAt: new Date((_e = envelope.run.last_updated_at) != null ? _e : Date.now()).toISOString(),
|
|
20620
|
-
userId: (_f = envelope.run.user_id) != null ? _f : "local-eval",
|
|
20621
|
-
convoId: envelope.run.convo_id,
|
|
20622
|
-
properties: parseAttributes(envelope.run.metadata),
|
|
20623
|
-
spans
|
|
20624
|
-
});
|
|
20625
|
-
return projectWorkshopTrace({ origin: "replay", event, spans });
|
|
20626
|
-
}
|
|
20627
|
-
function rawTraceSpan(span) {
|
|
20628
|
-
var _a, _b, _c, _d, _e, _f;
|
|
20629
|
-
const attributes = parseAttributes(span.attributes);
|
|
20630
|
-
return {
|
|
20631
|
-
span_id: span.id,
|
|
20632
|
-
parent_span_id: (_a = span.parent_span_id) != null ? _a : void 0,
|
|
20633
|
-
span_name: span.name,
|
|
20634
|
-
span_type: (_b = span.span_type) != null ? _b : void 0,
|
|
20635
|
-
status: (_c = span.status) != null ? _c : void 0,
|
|
20636
|
-
duration_ns: span.duration_ms === null ? void 0 : span.duration_ms * 1e6,
|
|
20637
|
-
start_unix_ns: span.start_time_ms === null ? void 0 : span.start_time_ms * 1e6,
|
|
20638
|
-
model: (_d = span.model) != null ? _d : void 0,
|
|
20639
|
-
input_tokens: (_e = span.input_tokens) != null ? _e : void 0,
|
|
20640
|
-
output_tokens: (_f = span.output_tokens) != null ? _f : void 0,
|
|
20641
|
-
input_payload: span.input_payload,
|
|
20642
|
-
output_payload: span.output_payload,
|
|
20643
|
-
attributes_string: Object.fromEntries(
|
|
20644
|
-
Object.entries(attributes).filter(
|
|
20645
|
-
(entry) => typeof entry[1] === "string"
|
|
20646
|
-
)
|
|
20647
|
-
),
|
|
20648
|
-
attributes_num: Object.fromEntries(
|
|
20649
|
-
Object.entries(attributes).filter(
|
|
20650
|
-
(entry) => typeof entry[1] === "number"
|
|
20651
|
-
)
|
|
20652
|
-
)
|
|
20653
|
-
};
|
|
20654
|
-
}
|
|
20655
|
-
function parseAttributes(raw) {
|
|
20656
|
-
if (!raw) return {};
|
|
20657
|
-
try {
|
|
20658
|
-
const value = JSON.parse(raw);
|
|
20659
|
-
return isAttributeRecord(value) ? value : {};
|
|
20660
|
-
} catch (e) {
|
|
20661
|
-
return {};
|
|
20662
|
-
}
|
|
20663
|
-
}
|
|
20664
|
-
function isAttributeRecord(value) {
|
|
20665
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20666
|
-
}
|
|
20667
|
-
function parseLocalVerdict2(output, value) {
|
|
20668
|
-
if (output === "boolean") return { state: "graded", ...LocalBooleanVerdictSchema.parse(value) };
|
|
20669
|
-
if (output === "score") return { state: "graded", ...LocalScoreVerdictSchema.parse(value) };
|
|
20670
|
-
return { state: "graded", ...LocalNumberVerdictSchema.parse(value) };
|
|
20671
|
-
}
|
|
20672
|
-
function withVerdictIdentity(evaluator, runId, workshopUrl, verdict) {
|
|
20673
|
-
return {
|
|
20674
|
-
evaluator,
|
|
20675
|
-
runId,
|
|
20676
|
-
url: workshopEvalUrl(workshopUrl, runId),
|
|
20677
|
-
...verdict
|
|
20678
|
-
};
|
|
20679
|
-
}
|
|
20680
|
-
function workshopVerdict(assessment) {
|
|
20681
|
-
const { evaluator, state: state2 } = assessment;
|
|
20682
|
-
if (state2 === "errored") return { evaluator, state: state2, message: assessment.message };
|
|
20683
|
-
if (state2 === "ungraded") return { evaluator, state: state2, reason: assessment.reason };
|
|
20684
|
-
if ("pass" in assessment)
|
|
20685
|
-
return {
|
|
20686
|
-
evaluator,
|
|
20687
|
-
state: state2,
|
|
20688
|
-
pass: assessment.pass,
|
|
20689
|
-
...assessment.note ? { note: assessment.note } : {}
|
|
20690
|
-
};
|
|
20691
|
-
if ("score" in assessment)
|
|
20692
|
-
return {
|
|
20693
|
-
evaluator,
|
|
20694
|
-
state: state2,
|
|
20695
|
-
score: assessment.score,
|
|
20696
|
-
...assessment.note ? { note: assessment.note } : {}
|
|
20697
|
-
};
|
|
20698
|
-
return {
|
|
20699
|
-
evaluator,
|
|
20700
|
-
state: state2,
|
|
20701
|
-
value: assessment.value,
|
|
20702
|
-
...assessment.note ? { note: assessment.note } : {}
|
|
20703
|
-
};
|
|
20704
|
-
}
|
|
20705
|
-
function portableVerdict(evaluator, runId, workshopUrl, outcome) {
|
|
20706
|
-
const identity = { evaluator, runId, url: workshopEvalUrl(workshopUrl, runId) };
|
|
20707
|
-
if (outcome.state === "errored") {
|
|
20708
|
-
return { ...identity, state: outcome.state, message: outcome.message };
|
|
20709
|
-
}
|
|
20710
|
-
if (outcome.state === "ungraded") {
|
|
20711
|
-
return { ...identity, state: outcome.state, reason: outcome.reason };
|
|
20712
|
-
}
|
|
20713
|
-
if ("pass" in outcome)
|
|
20714
|
-
return {
|
|
20715
|
-
...identity,
|
|
20716
|
-
state: outcome.state,
|
|
20717
|
-
pass: outcome.pass,
|
|
20718
|
-
...outcome.note ? { note: outcome.note } : {}
|
|
20719
|
-
};
|
|
20720
|
-
if ("score" in outcome)
|
|
20721
|
-
return {
|
|
20722
|
-
...identity,
|
|
20723
|
-
state: outcome.state,
|
|
20724
|
-
score: outcome.score,
|
|
20725
|
-
...outcome.note ? { note: outcome.note } : {}
|
|
20726
|
-
};
|
|
20727
|
-
return {
|
|
20728
|
-
...identity,
|
|
20729
|
-
state: outcome.state,
|
|
20730
|
-
value: outcome.value,
|
|
20731
|
-
...outcome.note ? { note: outcome.note } : {}
|
|
20732
|
-
};
|
|
20733
|
-
}
|
|
20734
|
-
function workshopResult(id, name, rows) {
|
|
20735
|
-
const done = rows.filter((entry) => entry.status === "done").length;
|
|
20736
|
-
const missing = rows.filter((entry) => entry.status === "missing").length;
|
|
20737
|
-
return {
|
|
20738
|
-
runId: id,
|
|
20739
|
-
name,
|
|
20740
|
-
status: missing > 0 ? "failed" : "complete",
|
|
20741
|
-
counts: { total: rows.length, pending: 0, done, missing },
|
|
20742
|
-
tracesExpireAt: null,
|
|
20743
|
-
tracesExpired: false,
|
|
20744
|
-
evaluators: [],
|
|
20745
|
-
rows
|
|
20746
|
-
};
|
|
20747
|
-
}
|
|
20748
|
-
function workshopEvalUrl(baseUrl, id) {
|
|
20749
|
-
return `${baseUrl.replace(/\/+$/, "")}/evals/${encodeURIComponent(id)}`;
|
|
20750
|
-
}
|
|
20751
20163
|
function randomId() {
|
|
20752
20164
|
var _a, _b, _c;
|
|
20753
20165
|
return (_c = (_b = (_a = globalThis.crypto) == null ? void 0 : _a.randomUUID) == null ? void 0 : _b.call(_a)) != null ? _c : `eval-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
20754
20166
|
}
|
|
20755
|
-
function describeError2(cause) {
|
|
20756
|
-
return cause instanceof Error ? cause.message : String(cause);
|
|
20757
|
-
}
|
|
20758
20167
|
function isPortableEvaluator(value) {
|
|
20759
20168
|
return "kind" in value && value.kind === "portable";
|
|
20760
20169
|
}
|
|
20170
|
+
function assertRaindropDestination(destination) {
|
|
20171
|
+
if (destination.kind !== "raindrop") {
|
|
20172
|
+
throw new Error(
|
|
20173
|
+
"Eval runs store results in Raindrop; Workshop is no longer an eval destination"
|
|
20174
|
+
);
|
|
20175
|
+
}
|
|
20176
|
+
}
|
|
20761
20177
|
|
|
20762
20178
|
// src/index.ts
|
|
20763
20179
|
function rawAppGitProperties(properties) {
|
|
@@ -21225,14 +20641,14 @@ var Raindrop = class {
|
|
|
21225
20641
|
const description = buildSelfDiagnosticsDescription(signals, options.guidance);
|
|
21226
20642
|
const inputSchema = buildSelfDiagnosticsInputSchema(signalKeys);
|
|
21227
20643
|
const onMissingEventId = (_b = options.onMissingEventId) != null ? _b : "warn";
|
|
21228
|
-
const execute = async (rawInput,
|
|
20644
|
+
const execute = async (rawInput, context8) => {
|
|
21229
20645
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
21230
20646
|
const input = isRecord(rawInput) ? rawInput : void 0;
|
|
21231
20647
|
const fallbackCategory = (_a2 = signalKeys[0]) != null ? _a2 : "unknown";
|
|
21232
20648
|
const categoryCandidate = normalizeEventId(input == null ? void 0 : input["category"]);
|
|
21233
20649
|
const category = categoryCandidate && signalKeySet.has(categoryCandidate) ? categoryCandidate : fallbackCategory;
|
|
21234
20650
|
const detail = (_b2 = normalizeEventId(input == null ? void 0 : input["detail"])) != null ? _b2 : "";
|
|
21235
|
-
const eventId = (_l = (_k = (_i = (_g = (_f = (_e = (_d = normalizeEventId(
|
|
20651
|
+
const eventId = (_l = (_k = (_i = (_g = (_f = (_e = (_d = normalizeEventId(context8 == null ? void 0 : context8.eventId)) != null ? _d : (_c = context8 == null ? void 0 : context8.interaction) == null ? void 0 : _c.getEventId()) != null ? _e : resolveEventIdFromMetadata(context8 == null ? void 0 : context8.metadata)) != null ? _f : normalizeEventId(input == null ? void 0 : input["event_id"])) != null ? _g : normalizeEventId(input == null ? void 0 : input["eventId"])) != null ? _i : (_h = options.interaction) == null ? void 0 : _h.getEventId()) != null ? _k : (_j = options.getEventId) == null ? void 0 : _j.call(options)) != null ? _l : normalizeEventId(options.eventId);
|
|
21236
20652
|
if (!eventId) {
|
|
21237
20653
|
const message = "self diagnostics signal skipped: missing eventId. Pass eventId, interaction, or getEventId when creating or executing the tool.";
|
|
21238
20654
|
if (onMissingEventId === "throw") {
|
|
@@ -21250,11 +20666,11 @@ var Raindrop = class {
|
|
|
21250
20666
|
type: "agent",
|
|
21251
20667
|
sentiment: signalDefinition == null ? void 0 : signalDefinition.sentiment,
|
|
21252
20668
|
properties: {
|
|
21253
|
-
source: (
|
|
20669
|
+
source: (context8 == null ? void 0 : context8.source) || options.source || SELF_DIAGNOSTICS_SOURCE_DEFAULT,
|
|
21254
20670
|
category,
|
|
21255
20671
|
signal_description: signalDefinition == null ? void 0 : signalDefinition.description,
|
|
21256
20672
|
...detail ? { detail } : {},
|
|
21257
|
-
...(_m =
|
|
20673
|
+
...(_m = context8 == null ? void 0 : context8.properties) != null ? _m : {}
|
|
21258
20674
|
}
|
|
21259
20675
|
});
|
|
21260
20676
|
return { acknowledged: true, category, eventId };
|
|
@@ -21660,7 +21076,7 @@ var Raindrop = class {
|
|
|
21660
21076
|
}
|
|
21661
21077
|
getContext() {
|
|
21662
21078
|
const runtime = detectRuntime();
|
|
21663
|
-
const
|
|
21079
|
+
const context8 = {
|
|
21664
21080
|
library: {
|
|
21665
21081
|
name: package_default.name,
|
|
21666
21082
|
version: package_default.version
|
|
@@ -21670,9 +21086,9 @@ var Raindrop = class {
|
|
|
21670
21086
|
}
|
|
21671
21087
|
};
|
|
21672
21088
|
if (runtime === "node") {
|
|
21673
|
-
|
|
21089
|
+
context8.metadata.nodeVersion = process.version;
|
|
21674
21090
|
}
|
|
21675
|
-
return
|
|
21091
|
+
return context8;
|
|
21676
21092
|
}
|
|
21677
21093
|
formatZodError(error) {
|
|
21678
21094
|
return error.issues.map((issue) => `(path: ${issue.path.join(".")}): ${issue.message}`).join(", ");
|
|
@@ -22126,6 +21542,7 @@ var withEvalScope2 = withEvalScope;
|
|
|
22126
21542
|
EvalDatasetRowInputSchema,
|
|
22127
21543
|
EvalParameterError,
|
|
22128
21544
|
EvalPublishError,
|
|
21545
|
+
EvalSuiteManifestSchema,
|
|
22129
21546
|
LocalBooleanVerdictSchema,
|
|
22130
21547
|
LocalNumberVerdictSchema,
|
|
22131
21548
|
LocalScoreVerdictSchema,
|