@tangle-network/agent-eval 0.142.1 → 0.143.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +21 -0
  3. package/dist/analyst/index.d.ts +5 -5
  4. package/dist/analyst/index.js +2 -2
  5. package/dist/{benchmark-command-DTyVFMUV.js → benchmark-command-CSddvlq7.js} +5 -5
  6. package/dist/{benchmark-command-DTyVFMUV.js.map → benchmark-command-CSddvlq7.js.map} +1 -1
  7. package/dist/benchmarks/index.d.ts +1 -1
  8. package/dist/benchmarks/index.js +1 -1
  9. package/dist/{benchmarks-Ce8GdJbc.js → benchmarks-Dg0B56tK.js} +4 -4
  10. package/dist/{benchmarks-Ce8GdJbc.js.map → benchmarks-Dg0B56tK.js.map} +1 -1
  11. package/dist/campaign/index.d.ts +3 -3
  12. package/dist/campaign/index.js +3 -3
  13. package/dist/{campaign-COFTVy3Q.js → campaign-C7ZGiZYG.js} +7 -5
  14. package/dist/campaign-C7ZGiZYG.js.map +1 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/{client-BoqGxEqx.d.ts → client-Cgl6KasJ.d.ts} +2 -2
  17. package/dist/{client-BoqGxEqx.d.ts.map → client-Cgl6KasJ.d.ts.map} +1 -1
  18. package/dist/contract/index.d.ts +5 -5
  19. package/dist/contract/index.js +3 -3
  20. package/dist/{default-registry-Ci7wAAR8.d.ts → default-registry-D3uqKbo6.d.ts} +2 -2
  21. package/dist/{default-registry-Ci7wAAR8.d.ts.map → default-registry-D3uqKbo6.d.ts.map} +1 -1
  22. package/dist/{dspy-rlm-engine-Bw8Zz9CX.js → dspy-rlm-engine-CJ4sN8Wx.js} +2 -2
  23. package/dist/{dspy-rlm-engine-Bw8Zz9CX.js.map → dspy-rlm-engine-CJ4sN8Wx.js.map} +1 -1
  24. package/dist/hosted/index.d.ts +2 -2
  25. package/dist/{index-CKI1CXTL.d.ts → index-CaOjqCli.d.ts} +4 -4
  26. package/dist/{index-CKI1CXTL.d.ts.map → index-CaOjqCli.d.ts.map} +1 -1
  27. package/dist/{index-DCP4I2Qx.d.ts → index-DY83M1WL.d.ts} +7 -5
  28. package/dist/{index-DCP4I2Qx.d.ts.map → index-DY83M1WL.d.ts.map} +1 -1
  29. package/dist/index.d.ts +8 -8
  30. package/dist/index.js +4 -4
  31. package/dist/multishot/index.d.ts +1 -1
  32. package/dist/openapi.json +1 -1
  33. package/dist/{replay-BqTgoioO.d.ts → replay-BuJM6kLh.d.ts} +2 -2
  34. package/dist/{replay-BqTgoioO.d.ts.map → replay-BuJM6kLh.d.ts.map} +1 -1
  35. package/dist/{reward-hacking-GyN0kMd8.js → reward-hacking-DjTi9HLb.js} +34 -14
  36. package/dist/reward-hacking-DjTi9HLb.js.map +1 -0
  37. package/dist/rl.d.ts +263 -2
  38. package/dist/rl.d.ts.map +1 -1
  39. package/dist/rl.js +332 -3
  40. package/dist/rl.js.map +1 -1
  41. package/dist/{single-run-lock-BcvPQY57.js → single-run-lock-Do-8vBIJ.js} +2 -2
  42. package/dist/{single-run-lock-BcvPQY57.js.map → single-run-lock-Do-8vBIJ.js.map} +1 -1
  43. package/dist/{skill-usage-CNZTk_LT.d.ts → skill-usage-CRqaHi0R.d.ts} +3 -3
  44. package/dist/{skill-usage-CNZTk_LT.d.ts.map → skill-usage-CRqaHi0R.d.ts.map} +1 -1
  45. package/dist/{skillopt-optimization-method-D1dqGzzH.d.ts → skillopt-optimization-method-CwRvi-rL.d.ts} +21 -5
  46. package/dist/skillopt-optimization-method-CwRvi-rL.d.ts.map +1 -0
  47. package/dist/{skillopt-optimization-method-DV6c4ooy.js → skillopt-optimization-method-Di8Xkalt.js} +153 -50
  48. package/dist/skillopt-optimization-method-Di8Xkalt.js.map +1 -0
  49. package/dist/{tool-groups-DVQTy9lq.d.ts → tool-groups-Bqy4A3QB.d.ts} +2 -2
  50. package/dist/{tool-groups-DVQTy9lq.d.ts.map → tool-groups-Bqy4A3QB.d.ts.map} +1 -1
  51. package/dist/traces.d.ts +2 -2
  52. package/dist/{types-Dk7PB7vh.d.ts → types-KEqL1pZc.d.ts} +6 -4
  53. package/dist/{types-Dk7PB7vh.d.ts.map → types-KEqL1pZc.d.ts.map} +1 -1
  54. package/docs/verified-labels-flywheel.md +46 -0
  55. package/package.json +3 -3
  56. package/dist/campaign-COFTVy3Q.js.map +0 -1
  57. package/dist/reward-hacking-GyN0kMd8.js.map +0 -1
  58. package/dist/skillopt-optimization-method-D1dqGzzH.d.ts.map +0 -1
  59. package/dist/skillopt-optimization-method-DV6c4ooy.js.map +0 -1
package/dist/rl.js CHANGED
@@ -6,14 +6,15 @@ import { o as runTaskScore } from "./run-record-vRgqWmJw.js";
6
6
  import { t as isSplitEligible } from "./exporters-q9iL-2Jf.js";
7
7
  import { t as mintRolloutRows } from "./mint-Ctwk079K.js";
8
8
  import { a as InMemoryTraceStore } from "./integrity-fdt8XPAv.js";
9
- import { c as campaignCellToRunRecord, i as filterDeterministicallyRewarded, n as extractVerifiableReward, r as extractVerifiableRewardsFromRecords, t as detectRewardHacking } from "./reward-hacking-GyN0kMd8.js";
9
+ import { i as filterDeterministicallyRewarded, l as campaignCellToRunRecord, n as extractVerifiableReward, r as extractVerifiableRewardsFromRecords, t as detectRewardHacking } from "./reward-hacking-DjTi9HLb.js";
10
10
  import { t as runEvalCampaign } from "./eval-campaign-YdkpWWoT.js";
11
11
  import { t as evaluateInterimReleaseConfidence } from "./sequential-Br0mAPHA.js";
12
12
  import { t as rubricPredictiveValidity } from "./rubric-predictive-validity-BRR632r1.js";
13
13
  import { n as thompsonCurriculum, r as varianceBasedCurriculum, t as observationsFromRunRecords } from "./active-curriculum-C4mk67HP.js";
14
14
  import { n as InMemoryOutcomeStore, t as FileSystemOutcomeStore } from "./outcome-store-ChBKlTd_.js";
15
15
  import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
16
- import { dirname } from "node:path";
16
+ import { dirname, join } from "node:path";
17
+ import { createHash } from "node:crypto";
17
18
  //#region src/rl/adaptation-eval.ts
18
19
  async function runAdaptationCurve(opts) {
19
20
  const ks = opts.ks ?? [
@@ -2753,6 +2754,334 @@ function buildPairwiseFromCampaign(input) {
2753
2754
  return outcomes;
2754
2755
  }
2755
2756
  //#endregion
2756
- export { ABSENT_CATEGORY, DEFAULT_MIN_N_PER_FEATURE, DEFAULT_QUANTILE_BUCKETS, DPO_CONTEXT_REQUIREMENT, FileSystemOutcomeStore, InMemoryOutcomeStore, PRM_CONTEXT_REQUIREMENT, PredictiveValidityResearcher, REPRESENTATIVE_MIN_FIDELITY, STEP_REWARD_CONTEXT_REQUIREMENT, appendToCorpus, applyEloUpdate, assertPrmTrainableLine, bestOfN, bucketLabel, buildDatasetFromCorpus, buildPairwiseFromCampaign, buildRlDataset, campaignToRunRecords, compareAdaptationCurves, datasheetToMarkdown, defaultBehaviorFeatures, detectRewardHacking, doublyRobust, easyModeCheck, extractPreferences, extractStepRewards, extractVerifiableReward, extractVerifiableRewardsFromRecords, filterDeterministicallyRewarded, firstPassK, fitBradleyTerry, injectIrrelevantClause, inverseProbabilityWeighting, jsDivergence, observationsFromRunRecords, offPolicyEstimateAll, paretoFrontier, prmTrainingPairs, quantileEdges, readCorpus, renameVariables, runAdaptationCurve, runComputeCurve, runContaminationProbe, runEvalCampaign, runRLCampaign, runwiseStepRewardSummary, selfConsistency, selfNormalizedImportanceWeighting, shuffleOrder, simFidelityReport, stepRewardsToJsonl, thompsonCurriculum, toAnthropicFormat, toDpoJsonl, toDpoRows, toGrpoJsonl, toGrpoRows, toPrmJsonl, toPrmRows, toSftJsonl, toSftRows, toTRLFormat, validateDatasetFormats, varianceBasedCurriculum, verificationReportToRunRecord };
2757
+ //#region src/rl/verified-findings-dataset.ts
2758
+ /**
2759
+ * Verified-findings dataset — execution-verified gold labels as RL-ready rows.
2760
+ *
2761
+ * A replay-verify batch re-executes a labeled trajectory prefix inside the
2762
+ * original docker image and checks, at the gold "incorrect" step k, whether
2763
+ * the recorded failure reproduces (arm A) and whether a generated fix makes
2764
+ * it vanish (arm B). That turns an annotation into an *executed* label: the
2765
+ * verdict is a returncode/signature comparison, not a rater's opinion.
2766
+ *
2767
+ * This module joins three artifact families into one row per replayed case:
2768
+ *
2769
+ * 1. the batch report (`batch-report.json` — per-case verdicts, fix arms),
2770
+ * 2. the gold label corpus (`*-labels.json` — incorrect step annotations),
2771
+ * 3. the normalized trajectory (`normalized/<trajId>/steps.json` — the
2772
+ * action/observation sequence the agent actually took).
2773
+ *
2774
+ * The emitted `VerifiedFindingRow` carries the trajectory prefix up to k,
2775
+ * the gold label, the execution verdict with its evidence (exit codes,
2776
+ * failure signature, prefix divergences), the fix arm when present, and
2777
+ * per-row provenance (label/steps/report sha256s, docker images, run ids).
2778
+ * Rows are trainer input for step-level localizer/critic models; the reward
2779
+ * is deterministic because execution decided it.
2780
+ *
2781
+ * Join discipline: every missing or inconsistent join throws — a dataset
2782
+ * built from partially joined artifacts would silently train on wrong
2783
+ * labels. The batch report is authoritative for fix outcomes (per-case
2784
+ * `replay-verdict.json` files are written before the fix arm completes);
2785
+ * per-case files contribute prefix-divergence detail and run ids only, and
2786
+ * are cross-checked against the report where they overlap.
2787
+ */
2788
+ const VERIFIED_FINDING_SCHEMA = "agent-eval/verified-finding@0";
2789
+ const DEFAULT_MAX_OBSERVATION_CHARS = 4e3;
2790
+ function fail(caseId, message) {
2791
+ throw new Error(`verified-findings: ${caseId}: ${message}`);
2792
+ }
2793
+ function deriveFixOutcome(caseId, batchCase) {
2794
+ const fix = batchCase.fix;
2795
+ if (fix === null) {
2796
+ if (batchCase.replayed) fail(caseId, "replayed case has no fix record — the batch always records the fix arm for replayed cases");
2797
+ return {
2798
+ outcome: "not-attempted",
2799
+ command: null,
2800
+ llmError: null,
2801
+ armBExit: null,
2802
+ failureVanished: null
2803
+ };
2804
+ }
2805
+ const base = {
2806
+ command: fix.command,
2807
+ llmError: fix.llmError,
2808
+ armBExit: fix.armBExit,
2809
+ failureVanished: fix.failureVanished
2810
+ };
2811
+ if (fix.command !== null) {
2812
+ if (fix.failureVanished === null) fail(caseId, "fix command present but failureVanished missing — arm B verdict was never recorded");
2813
+ return {
2814
+ outcome: fix.failureVanished ? "flipped" : "not-flipped",
2815
+ ...base
2816
+ };
2817
+ }
2818
+ if (fix.llmError !== null) return {
2819
+ outcome: "generation-failed",
2820
+ ...base
2821
+ };
2822
+ if (!fix.attempted || fix.sampledOut) return {
2823
+ outcome: "not-attempted",
2824
+ ...base
2825
+ };
2826
+ fail(caseId, "unrecognized fix record state (attempted, no command, no llmError)");
2827
+ }
2828
+ function truncateObservation(observation, maxChars) {
2829
+ if (observation === null || observation === void 0) return {
2830
+ observation: null,
2831
+ observationTruncated: false,
2832
+ observationChars: 0
2833
+ };
2834
+ if (observation.length <= maxChars) return {
2835
+ observation,
2836
+ observationTruncated: false,
2837
+ observationChars: observation.length
2838
+ };
2839
+ return {
2840
+ observation: observation.slice(0, maxChars),
2841
+ observationTruncated: true,
2842
+ observationChars: observation.length
2843
+ };
2844
+ }
2845
+ /**
2846
+ * Join one batch case with its gold label and trajectory into a row.
2847
+ * Throws on any join inconsistency — never emits a partially joined row.
2848
+ */
2849
+ function buildVerifiedFindingRow(args) {
2850
+ const { batchCase, label, steps, detail } = args;
2851
+ const caseId = `${args.runId}/${batchCase.corpus}/${batchCase.trajId}`;
2852
+ const maxObservationChars = args.maxObservationChars ?? DEFAULT_MAX_OBSERVATION_CHARS;
2853
+ if (batchCase.status !== "ok") fail(caseId, `case status is '${batchCase.status}' (error: ${batchCase.error ?? "none"}) — only ok cases join`);
2854
+ if (label.traj_id !== batchCase.trajId) fail(caseId, `label traj_id '${label.traj_id}' does not match the case`);
2855
+ if (label.step_count !== batchCase.stepCount) fail(caseId, `label step_count ${label.step_count} != case stepCount ${batchCase.stepCount}`);
2856
+ if (steps.length !== batchCase.stepCount) fail(caseId, `steps.json has ${steps.length} steps, case expects ${batchCase.stepCount}`);
2857
+ for (let i = 0; i < steps.length; i++) {
2858
+ const step = steps[i];
2859
+ if (step.step_id !== i + 1) fail(caseId, `steps.json is not contiguous 1..n: index ${i} has step_id ${step.step_id}`);
2860
+ }
2861
+ const k = batchCase.k;
2862
+ if (k < 1 || k > batchCase.stepCount) fail(caseId, `gold step k=${k} is outside 1..${batchCase.stepCount}`);
2863
+ if (!batchCase.goldIncorrectSteps.includes(k)) fail(caseId, `gold step k=${k} is not in goldIncorrectSteps [${batchCase.goldIncorrectSteps.join(", ")}]`);
2864
+ const labelIncorrectSteps = [...new Set(label.incorrect_stages.flatMap((s) => s.incorrect_step_ids))].sort((a, b) => a - b);
2865
+ for (const goldStep of batchCase.goldIncorrectSteps) if (!labelIncorrectSteps.includes(goldStep)) fail(caseId, `case gold step ${goldStep} is absent from the label's incorrect steps — label/report mismatch`);
2866
+ if (detail !== void 0) {
2867
+ if (detail.k !== k) fail(caseId, `per-case verdict k=${detail.k} != report k=${k}`);
2868
+ if (detail.prefixExecuted !== batchCase.prefixExecuted) fail(caseId, `per-case verdict prefixExecuted=${detail.prefixExecuted} != report ${batchCase.prefixExecuted}`);
2869
+ if (detail.recordedReturncode !== batchCase.recordedReturncodeAtK) fail(caseId, `per-case verdict recordedReturncode=${detail.recordedReturncode} != report ${batchCase.recordedReturncodeAtK}`);
2870
+ }
2871
+ const stepAtK = steps[k - 1];
2872
+ const trajectorySteps = steps.slice(0, k).map((step) => ({
2873
+ stepId: step.step_id,
2874
+ action: step.action,
2875
+ ...truncateObservation(step.observation, maxObservationChars)
2876
+ }));
2877
+ return {
2878
+ schema: VERIFIED_FINDING_SCHEMA,
2879
+ caseId,
2880
+ corpus: batchCase.corpus,
2881
+ trajId: batchCase.trajId,
2882
+ task: {
2883
+ agent: label.agent ?? null,
2884
+ model: label.model ?? null,
2885
+ taskName: label.task_name ?? null,
2886
+ difficulty: label.difficulty ?? null,
2887
+ solved: label.solved,
2888
+ stepCount: batchCase.stepCount
2889
+ },
2890
+ gold: {
2891
+ stepK: k,
2892
+ actionAtK: stepAtK.action,
2893
+ goldIncorrectSteps: [...batchCase.goldIncorrectSteps].sort((a, b) => a - b),
2894
+ labelIncorrectSteps,
2895
+ recordedReturncodeAtK: batchCase.recordedReturncodeAtK
2896
+ },
2897
+ trajectory: {
2898
+ window: {
2899
+ start: 1,
2900
+ end: k
2901
+ },
2902
+ steps: trajectorySteps
2903
+ },
2904
+ verification: {
2905
+ reproduced: batchCase.replayed,
2906
+ signatureStrict: batchCase.armASignatureMatch,
2907
+ signatureBasis: detail?.signatureBasis ?? null,
2908
+ signature: batchCase.signature,
2909
+ prefixExecuted: batchCase.prefixExecuted,
2910
+ prefixDivergences: batchCase.prefixDivergences,
2911
+ prefixDivergencePct: batchCase.prefixDivergencePct,
2912
+ prefixDivergenceDetail: detail?.prefixDivergences ?? null,
2913
+ armAExit: batchCase.armAExit,
2914
+ armAReturncodeMatch: batchCase.armAReturncodeMatch,
2915
+ armACommand: detail?.armACommand ?? null,
2916
+ wallMs: batchCase.wallMs
2917
+ },
2918
+ fix: deriveFixOutcome(caseId, batchCase),
2919
+ provenance: {
2920
+ runId: args.runId,
2921
+ batchGeneratedAt: args.batchGeneratedAt,
2922
+ batchReportSha256: args.batchReportSha256,
2923
+ labelsPath: args.labelsPath,
2924
+ labelsSha256: args.labelsSha256,
2925
+ stepsPath: args.stepsPath,
2926
+ stepsSha256: args.stepsSha256,
2927
+ image: batchCase.image,
2928
+ derivedImage: batchCase.derivedImage,
2929
+ cwd: batchCase.cwd,
2930
+ cwdSource: batchCase.cwdSource,
2931
+ originalRunId: detail?.runIds.original ?? null,
2932
+ armARunId: detail?.runIds.armA ?? null
2933
+ }
2934
+ };
2935
+ }
2936
+ function summarizeVerifiedFindings(rows) {
2937
+ const summary = {
2938
+ rows: rows.length,
2939
+ reproduced: 0,
2940
+ signatureStrict: 0,
2941
+ fix: {
2942
+ flipped: 0,
2943
+ "not-flipped": 0,
2944
+ "generation-failed": 0,
2945
+ "not-attempted": 0
2946
+ },
2947
+ byCorpus: {}
2948
+ };
2949
+ for (const row of rows) {
2950
+ if (row.verification.reproduced) summary.reproduced++;
2951
+ if (row.verification.reproduced && row.verification.signatureStrict) summary.signatureStrict++;
2952
+ summary.fix[row.fix.outcome]++;
2953
+ let corpus = summary.byCorpus[row.corpus];
2954
+ if (corpus === void 0) {
2955
+ corpus = {
2956
+ rows: 0,
2957
+ reproduced: 0,
2958
+ fixFlipped: 0
2959
+ };
2960
+ summary.byCorpus[row.corpus] = corpus;
2961
+ }
2962
+ corpus.rows++;
2963
+ if (row.verification.reproduced) corpus.reproduced++;
2964
+ if (row.fix.outcome === "flipped") corpus.fixFlipped++;
2965
+ }
2966
+ return summary;
2967
+ }
2968
+ function verifiedFindingsToJsonl(rows) {
2969
+ return rows.map((row) => JSON.stringify(row)).join("\n") + (rows.length > 0 ? "\n" : "");
2970
+ }
2971
+ function sha256(buffer) {
2972
+ return createHash("sha256").update(buffer).digest("hex");
2973
+ }
2974
+ function readJson(path, what) {
2975
+ let buffer;
2976
+ try {
2977
+ buffer = readFileSync(path);
2978
+ } catch (error) {
2979
+ throw new Error(`verified-findings: cannot read ${what} at ${path}: ${error.message}`);
2980
+ }
2981
+ try {
2982
+ return {
2983
+ value: JSON.parse(buffer.toString("utf8")),
2984
+ sha256: sha256(buffer)
2985
+ };
2986
+ } catch (error) {
2987
+ throw new Error(`verified-findings: ${what} at ${path} is not valid JSON: ${error.message}`);
2988
+ }
2989
+ }
2990
+ function loadCaseVerdictDetail(runDir, batchCase) {
2991
+ const parsed = readJson(join(runDir, `${batchCase.corpus}--${batchCase.trajId}`, "replay-verdict.json"), `per-case verdict for ${batchCase.trajId}`).value;
2992
+ return {
2993
+ k: parsed.k,
2994
+ prefixExecuted: parsed.prefixExecuted,
2995
+ recordedReturncode: parsed.recordedReturncode,
2996
+ signatureBasis: parsed.signatureBasis ?? null,
2997
+ prefixDivergences: parsed.prefixDivergences ?? [],
2998
+ armACommand: parsed.armA?.command ?? null,
2999
+ runIds: {
3000
+ original: parsed.runIds?.original ?? null,
3001
+ armA: parsed.runIds?.armA ?? null
3002
+ }
3003
+ };
3004
+ }
3005
+ /**
3006
+ * Load a replay-verify batch and join it into verified-finding rows.
3007
+ * Every case in the report must join: an unresolvable corpus, a missing
3008
+ * label entry, or a missing trajectory throws instead of dropping the row.
3009
+ */
3010
+ function loadVerifiedFindingsDataset(source) {
3011
+ const report = readJson(source.batchReportPath, "batch report");
3012
+ const parsedReport = report.value;
3013
+ if (!Array.isArray(parsedReport.cases) || parsedReport.cases.length === 0) throw new Error(`verified-findings: batch report at ${source.batchReportPath} has no cases`);
3014
+ if (typeof parsedReport.generatedAt !== "string" || parsedReport.generatedAt.length === 0) throw new Error(`verified-findings: batch report at ${source.batchReportPath} has no generatedAt`);
3015
+ const labelCache = /* @__PURE__ */ new Map();
3016
+ const corporaProvenance = {};
3017
+ const resolveCorpus = (corpus) => {
3018
+ const config = source.corpora[corpus];
3019
+ if (config === void 0) throw new Error(`verified-findings: batch report references corpus '${corpus}' but no labels/preparedDir was configured for it`);
3020
+ let cached = labelCache.get(corpus);
3021
+ if (cached === void 0) {
3022
+ const labels = readJson(config.labelsPath, `labels for corpus '${corpus}'`);
3023
+ const entries = labels.value;
3024
+ if (!Array.isArray(entries)) throw new Error(`verified-findings: labels for corpus '${corpus}' at ${config.labelsPath} are not an array`);
3025
+ const byTrajId = /* @__PURE__ */ new Map();
3026
+ for (const entry of entries) {
3027
+ if (byTrajId.has(entry.traj_id)) throw new Error(`verified-findings: labels for corpus '${corpus}' contain duplicate traj_id '${entry.traj_id}'`);
3028
+ byTrajId.set(entry.traj_id, entry);
3029
+ }
3030
+ cached = {
3031
+ sha256: labels.sha256,
3032
+ byTrajId
3033
+ };
3034
+ labelCache.set(corpus, cached);
3035
+ corporaProvenance[corpus] = {
3036
+ labelsPath: config.labelsPath,
3037
+ labelsSha256: labels.sha256,
3038
+ preparedDir: config.preparedDir
3039
+ };
3040
+ }
3041
+ return {
3042
+ config,
3043
+ ...cached
3044
+ };
3045
+ };
3046
+ const rows = [];
3047
+ for (const batchCase of parsedReport.cases) {
3048
+ const { config, sha256: labelsSha256, byTrajId } = resolveCorpus(batchCase.corpus);
3049
+ const label = byTrajId.get(batchCase.trajId);
3050
+ if (label === void 0) throw new Error(`verified-findings: ${source.runId}/${batchCase.corpus}/${batchCase.trajId}: no label entry in ${config.labelsPath}`);
3051
+ const stepsPath = join(config.preparedDir, "normalized", batchCase.trajId, "steps.json");
3052
+ const stepsFile = readJson(stepsPath, `trajectory steps for ${batchCase.trajId}`);
3053
+ const steps = stepsFile.value;
3054
+ if (!Array.isArray(steps)) throw new Error(`verified-findings: trajectory steps at ${stepsPath} are not an array`);
3055
+ const detail = source.runDir === void 0 ? void 0 : loadCaseVerdictDetail(source.runDir, batchCase);
3056
+ rows.push(buildVerifiedFindingRow({
3057
+ batchCase,
3058
+ label,
3059
+ steps,
3060
+ runId: source.runId,
3061
+ batchGeneratedAt: parsedReport.generatedAt,
3062
+ batchReportSha256: report.sha256,
3063
+ labelsPath: config.labelsPath,
3064
+ labelsSha256,
3065
+ stepsPath,
3066
+ stepsSha256: stepsFile.sha256,
3067
+ detail,
3068
+ maxObservationChars: source.maxObservationChars
3069
+ }));
3070
+ }
3071
+ rows.sort((a, b) => a.caseId.localeCompare(b.caseId));
3072
+ return {
3073
+ rows,
3074
+ summary: summarizeVerifiedFindings(rows),
3075
+ provenance: {
3076
+ runId: source.runId,
3077
+ batchReportPath: source.batchReportPath,
3078
+ batchReportSha256: report.sha256,
3079
+ batchGeneratedAt: parsedReport.generatedAt,
3080
+ corpora: corporaProvenance
3081
+ }
3082
+ };
3083
+ }
3084
+ //#endregion
3085
+ export { ABSENT_CATEGORY, DEFAULT_MIN_N_PER_FEATURE, DEFAULT_QUANTILE_BUCKETS, DPO_CONTEXT_REQUIREMENT, FileSystemOutcomeStore, InMemoryOutcomeStore, PRM_CONTEXT_REQUIREMENT, PredictiveValidityResearcher, REPRESENTATIVE_MIN_FIDELITY, STEP_REWARD_CONTEXT_REQUIREMENT, VERIFIED_FINDING_SCHEMA, appendToCorpus, applyEloUpdate, assertPrmTrainableLine, bestOfN, bucketLabel, buildDatasetFromCorpus, buildPairwiseFromCampaign, buildRlDataset, buildVerifiedFindingRow, campaignToRunRecords, compareAdaptationCurves, datasheetToMarkdown, defaultBehaviorFeatures, detectRewardHacking, doublyRobust, easyModeCheck, extractPreferences, extractStepRewards, extractVerifiableReward, extractVerifiableRewardsFromRecords, filterDeterministicallyRewarded, firstPassK, fitBradleyTerry, injectIrrelevantClause, inverseProbabilityWeighting, jsDivergence, loadVerifiedFindingsDataset, observationsFromRunRecords, offPolicyEstimateAll, paretoFrontier, prmTrainingPairs, quantileEdges, readCorpus, renameVariables, runAdaptationCurve, runComputeCurve, runContaminationProbe, runEvalCampaign, runRLCampaign, runwiseStepRewardSummary, selfConsistency, selfNormalizedImportanceWeighting, shuffleOrder, simFidelityReport, stepRewardsToJsonl, summarizeVerifiedFindings, thompsonCurriculum, toAnthropicFormat, toDpoJsonl, toDpoRows, toGrpoJsonl, toGrpoRows, toPrmJsonl, toPrmRows, toSftJsonl, toSftRows, toTRLFormat, validateDatasetFormats, varianceBasedCurriculum, verificationReportToRunRecord, verifiedFindingsToJsonl };
2757
3086
 
2758
3087
  //# sourceMappingURL=rl.js.map