@tangle-network/agent-eval 0.119.0 → 0.120.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/CHANGELOG.md +25 -3
- package/README.md +0 -26
- package/dist/analyst/index.d.ts +30 -39
- package/dist/analyst/index.js +9 -5
- package/dist/analyst/index.js.map +1 -1
- package/dist/benchmarks/index.d.ts +11 -5
- package/dist/benchmarks/index.js +7 -7
- package/dist/campaign/index.d.ts +121 -66
- package/dist/campaign/index.js +26 -10
- package/dist/{chunk-RLCJQ6VZ.js → chunk-32BZXMSO.js} +385 -120
- package/dist/chunk-32BZXMSO.js.map +1 -0
- package/dist/{chunk-XJ7JVCHB.js → chunk-3A246TSA.js} +2 -2
- package/dist/{chunk-LMJ2TGWJ.js → chunk-JM2SKQMS.js} +2 -2
- package/dist/{chunk-F6YUH3L4.js → chunk-JN2FCO5W.js} +14 -168
- package/dist/chunk-JN2FCO5W.js.map +1 -0
- package/dist/{chunk-D7AEXSM5.js → chunk-PICTDURQ.js} +2 -2
- package/dist/{chunk-6QIM2EAP.js → chunk-PXD6ZFNY.js} +99 -1
- package/dist/chunk-PXD6ZFNY.js.map +1 -0
- package/dist/{chunk-GERDAIAL.js → chunk-QWMPPZ3X.js} +3 -3
- package/dist/{chunk-7A4LIMMY.js → chunk-S5TT5R3L.js} +229 -97
- package/dist/chunk-S5TT5R3L.js.map +1 -0
- package/dist/{chunk-ZYHJNKI3.js → chunk-ULOKLHIQ.js} +42 -5
- package/dist/chunk-ULOKLHIQ.js.map +1 -0
- package/dist/{chunk-FIUFRXP3.js → chunk-WW2A73HW.js} +49 -91
- package/dist/chunk-WW2A73HW.js.map +1 -0
- package/dist/{chunk-PAHNGS65.js → chunk-XDIRG3TO.js} +175 -11
- package/dist/chunk-XDIRG3TO.js.map +1 -0
- package/dist/contract/index.d.ts +76 -43
- package/dist/contract/index.js +596 -32
- package/dist/contract/index.js.map +1 -1
- package/dist/index.d.ts +92 -75
- package/dist/index.js +38 -35
- package/dist/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/rl.d.ts +11 -5
- package/dist/{run-campaign-OBXSN5WK.js → run-campaign-HNFPJET4.js} +2 -2
- package/dist/traces.d.ts +39 -25
- package/dist/traces.js +3 -5
- package/docs/trace-analysis.md +6 -2
- package/package.json +2 -7
- package/dist/chunk-6QIM2EAP.js.map +0 -1
- package/dist/chunk-7A4LIMMY.js.map +0 -1
- package/dist/chunk-F6YUH3L4.js.map +0 -1
- package/dist/chunk-FIUFRXP3.js.map +0 -1
- package/dist/chunk-PAHNGS65.js.map +0 -1
- package/dist/chunk-RLCJQ6VZ.js.map +0 -1
- package/dist/chunk-ZYHJNKI3.js.map +0 -1
- package/dist/primeintellect/index.d.ts +0 -311
- package/dist/primeintellect/index.js +0 -348
- package/dist/primeintellect/index.js.map +0 -1
- /package/dist/{chunk-XJ7JVCHB.js.map → chunk-3A246TSA.js.map} +0 -0
- /package/dist/{chunk-LMJ2TGWJ.js.map → chunk-JM2SKQMS.js.map} +0 -0
- /package/dist/{chunk-D7AEXSM5.js.map → chunk-PICTDURQ.js.map} +0 -0
- /package/dist/{chunk-GERDAIAL.js.map → chunk-QWMPPZ3X.js.map} +0 -0
- /package/dist/{run-campaign-OBXSN5WK.js.map → run-campaign-HNFPJET4.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
summarizeBackendIntegrity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XDIRG3TO.js";
|
|
4
4
|
import {
|
|
5
5
|
paretoChart
|
|
6
6
|
} from "./chunk-DPZAEKA6.js";
|
|
@@ -995,4 +995,4 @@ export {
|
|
|
995
995
|
summarizeExecution,
|
|
996
996
|
analyzeRuns
|
|
997
997
|
};
|
|
998
|
-
//# sourceMappingURL=chunk-
|
|
998
|
+
//# sourceMappingURL=chunk-3A246TSA.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
aggregateRunScore,
|
|
6
6
|
clamp01,
|
|
7
7
|
computeFindingId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-S5TT5R3L.js";
|
|
9
9
|
import {
|
|
10
10
|
callLlmJson,
|
|
11
11
|
costReceiptFromLlm,
|
|
@@ -747,4 +747,4 @@ export {
|
|
|
747
747
|
runSemanticConceptJudge,
|
|
748
748
|
createSemanticConceptJudge
|
|
749
749
|
};
|
|
750
|
-
//# sourceMappingURL=chunk-
|
|
750
|
+
//# sourceMappingURL=chunk-JM2SKQMS.js.map
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
assertCodeSurfaceIdentity,
|
|
4
4
|
campaignBreakdown,
|
|
5
5
|
campaignMeanComposite,
|
|
6
|
+
comparePairedArms,
|
|
6
7
|
costReceiptFromTCloud,
|
|
7
8
|
defaultProductionGate,
|
|
8
9
|
gepaProposer,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
runImprovementLoop,
|
|
16
17
|
surfaceContentHash,
|
|
17
18
|
surfaceHash
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-32BZXMSO.js";
|
|
19
20
|
import {
|
|
20
21
|
SearchLedgerConflictError,
|
|
21
22
|
SearchLedgerError,
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
runCampaign,
|
|
31
32
|
summarizeBackendIntegrity,
|
|
32
33
|
withSearchLedgerFileLock
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XDIRG3TO.js";
|
|
34
35
|
import {
|
|
35
36
|
Mutex
|
|
36
37
|
} from "./chunk-3YYRZDON.js";
|
|
@@ -42,13 +43,14 @@ import {
|
|
|
42
43
|
admitPolicyEdit,
|
|
43
44
|
applyPolicyEditToSurface,
|
|
44
45
|
assertNoJudgeVerdict,
|
|
46
|
+
createAnalystAi,
|
|
45
47
|
createTraceAnalystKind,
|
|
46
48
|
isPolicyEdit,
|
|
47
49
|
makePolicyEdit,
|
|
48
50
|
makePolicyEditCandidateRecord,
|
|
49
51
|
policyEditsFromFindings,
|
|
50
52
|
validatePolicyEditCandidateRecord
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-S5TT5R3L.js";
|
|
52
54
|
import {
|
|
53
55
|
callLlm,
|
|
54
56
|
callLlmJson,
|
|
@@ -58,11 +60,8 @@ import {
|
|
|
58
60
|
} from "./chunk-NJC7U437.js";
|
|
59
61
|
import {
|
|
60
62
|
eProcess,
|
|
61
|
-
mcnemar,
|
|
62
63
|
mulberry32,
|
|
63
|
-
pairedBootstrap
|
|
64
|
-
pairedRiskDifference,
|
|
65
|
-
wilcoxonSignedRank
|
|
64
|
+
pairedBootstrap
|
|
66
65
|
} from "./chunk-PJQFMIOX.js";
|
|
67
66
|
import {
|
|
68
67
|
CostAccountingIncompleteError,
|
|
@@ -70,10 +69,10 @@ import {
|
|
|
70
69
|
} from "./chunk-JHOJHHU7.js";
|
|
71
70
|
import {
|
|
72
71
|
analyzeTraces
|
|
73
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-WW2A73HW.js";
|
|
74
73
|
import {
|
|
75
74
|
OtlpFileTraceStore
|
|
76
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-PXD6ZFNY.js";
|
|
77
76
|
import {
|
|
78
77
|
modelHasSnapshot,
|
|
79
78
|
validateRunRecord
|
|
@@ -569,155 +568,6 @@ function failureModeRecallJudge(opts = {}) {
|
|
|
569
568
|
};
|
|
570
569
|
}
|
|
571
570
|
|
|
572
|
-
// src/paired-arms.ts
|
|
573
|
-
function pairArms(rows, opts) {
|
|
574
|
-
const { baselineArm, treatmentArm } = opts;
|
|
575
|
-
if (baselineArm === treatmentArm) {
|
|
576
|
-
throw new ValidationError(
|
|
577
|
-
`pairArms: baselineArm and treatmentArm are both '${baselineArm}' \u2014 an arm cannot be compared to itself`
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
const byArm = /* @__PURE__ */ new Map();
|
|
581
|
-
const armsSeen = /* @__PURE__ */ new Set();
|
|
582
|
-
for (const row of rows) {
|
|
583
|
-
armsSeen.add(row.arm);
|
|
584
|
-
if (row.arm !== baselineArm && row.arm !== treatmentArm) continue;
|
|
585
|
-
const byKey = byArm.get(row.arm) ?? /* @__PURE__ */ new Map();
|
|
586
|
-
const group = byKey.get(row.pairKey) ?? [];
|
|
587
|
-
group.push(row);
|
|
588
|
-
byKey.set(row.pairKey, group);
|
|
589
|
-
byArm.set(row.arm, byKey);
|
|
590
|
-
}
|
|
591
|
-
for (const arm of [baselineArm, treatmentArm]) {
|
|
592
|
-
if (!byArm.has(arm)) {
|
|
593
|
-
const seen = [...armsSeen].sort().join(", ") || "<none>";
|
|
594
|
-
throw new ValidationError(`pairArms: no rows for arm '${arm}' (arms present: ${seen})`);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
const baselineByKey = byArm.get(baselineArm);
|
|
598
|
-
const treatmentByKey = byArm.get(treatmentArm);
|
|
599
|
-
const allKeys = [.../* @__PURE__ */ new Set([...baselineByKey.keys(), ...treatmentByKey.keys()])].sort();
|
|
600
|
-
const pairs = [];
|
|
601
|
-
const unpairedBaseline = [];
|
|
602
|
-
const unpairedTreatment = [];
|
|
603
|
-
for (const pairKey of allKeys) {
|
|
604
|
-
const b = baselineByKey.get(pairKey) ?? [];
|
|
605
|
-
const t = treatmentByKey.get(pairKey) ?? [];
|
|
606
|
-
if (b.length <= 1 && t.length <= 1) {
|
|
607
|
-
if (b.length === 1 && t.length === 1) {
|
|
608
|
-
pairs.push({ pairKey, repIndex: 0, baseline: b[0], treatment: t[0] });
|
|
609
|
-
} else {
|
|
610
|
-
unpairedBaseline.push(...b);
|
|
611
|
-
unpairedTreatment.push(...t);
|
|
612
|
-
}
|
|
613
|
-
continue;
|
|
614
|
-
}
|
|
615
|
-
const bByRep = indexByRepKey(b, pairKey, baselineArm);
|
|
616
|
-
const tByRep = indexByRepKey(t, pairKey, treatmentArm);
|
|
617
|
-
const repKeys = [.../* @__PURE__ */ new Set([...bByRep.keys(), ...tByRep.keys()])].sort();
|
|
618
|
-
let repIndex = 0;
|
|
619
|
-
for (const repKey of repKeys) {
|
|
620
|
-
const baseline = bByRep.get(repKey);
|
|
621
|
-
const treatment = tByRep.get(repKey);
|
|
622
|
-
if (baseline !== void 0 && treatment !== void 0) {
|
|
623
|
-
pairs.push({ pairKey, repIndex: repIndex++, baseline, treatment });
|
|
624
|
-
} else if (baseline !== void 0) {
|
|
625
|
-
unpairedBaseline.push(baseline);
|
|
626
|
-
} else if (treatment !== void 0) {
|
|
627
|
-
unpairedTreatment.push(treatment);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
return { pairs, unpairedBaseline, unpairedTreatment };
|
|
632
|
-
}
|
|
633
|
-
function indexByRepKey(group, pairKey, arm) {
|
|
634
|
-
const byRep = /* @__PURE__ */ new Map();
|
|
635
|
-
for (const row of group) {
|
|
636
|
-
if (row.repKey === void 0) {
|
|
637
|
-
throw new ValidationError(
|
|
638
|
-
`pairArms: pairKey '${pairKey}' has multiple reps in an arm, but a row in arm '${arm}' is missing repKey \u2014 multi-rep items require an explicit repKey on every row so reps pair by identity (pairing reps by outcome or by index would bias the paired statistics)`
|
|
639
|
-
);
|
|
640
|
-
}
|
|
641
|
-
if (byRep.has(row.repKey)) {
|
|
642
|
-
throw new ValidationError(
|
|
643
|
-
`pairArms: duplicate repKey '${row.repKey}' for pairKey '${pairKey}' in arm '${arm}' \u2014 (pairKey, repKey) must uniquely identify a rep within an arm`
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
byRep.set(row.repKey, row);
|
|
647
|
-
}
|
|
648
|
-
return byRep;
|
|
649
|
-
}
|
|
650
|
-
function comparePairedArms(rows, opts) {
|
|
651
|
-
const { pairs, unpairedBaseline, unpairedTreatment } = pairArms(rows, opts);
|
|
652
|
-
let correctness = null;
|
|
653
|
-
const baselinePass = [];
|
|
654
|
-
const treatmentPass = [];
|
|
655
|
-
for (const pair of pairs) {
|
|
656
|
-
if (pair.baseline.pass === void 0 || pair.treatment.pass === void 0) continue;
|
|
657
|
-
baselinePass.push(pair.baseline.pass ? 1 : 0);
|
|
658
|
-
treatmentPass.push(pair.treatment.pass ? 1 : 0);
|
|
659
|
-
}
|
|
660
|
-
if (baselinePass.length > 0) {
|
|
661
|
-
const mc = mcnemar(baselinePass, treatmentPass);
|
|
662
|
-
correctness = {
|
|
663
|
-
b10: mc.b,
|
|
664
|
-
b01: mc.c,
|
|
665
|
-
mcnemar: mc,
|
|
666
|
-
riskDifference: pairedRiskDifference(baselinePass, treatmentPass)
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
const metricNames = opts.metricNames ?? [
|
|
670
|
-
...new Set(
|
|
671
|
-
pairs.flatMap((p) => [
|
|
672
|
-
...Object.keys(p.baseline.metrics ?? {}),
|
|
673
|
-
...Object.keys(p.treatment.metrics ?? {})
|
|
674
|
-
])
|
|
675
|
-
)
|
|
676
|
-
].sort();
|
|
677
|
-
const metricDeltas = metricNames.map((name) => {
|
|
678
|
-
const before = [];
|
|
679
|
-
const after = [];
|
|
680
|
-
let nMissing = 0;
|
|
681
|
-
for (const pair of pairs) {
|
|
682
|
-
const b = metricValue(pair.baseline, name);
|
|
683
|
-
const t = metricValue(pair.treatment, name);
|
|
684
|
-
if (b === void 0 || t === void 0) {
|
|
685
|
-
nMissing++;
|
|
686
|
-
continue;
|
|
687
|
-
}
|
|
688
|
-
before.push(b);
|
|
689
|
-
after.push(t);
|
|
690
|
-
}
|
|
691
|
-
const bootstrapCi = before.length === 0 ? null : pairedBootstrap(before, after, opts.bootstrap);
|
|
692
|
-
return {
|
|
693
|
-
name,
|
|
694
|
-
n: before.length,
|
|
695
|
-
nMissing,
|
|
696
|
-
medianDelta: bootstrapCi === null ? Number.NaN : bootstrapCi.median,
|
|
697
|
-
meanDelta: bootstrapCi === null ? Number.NaN : bootstrapCi.mean,
|
|
698
|
-
bootstrapCi,
|
|
699
|
-
wilcoxon: before.length === 0 ? null : wilcoxonSignedRank(before, after)
|
|
700
|
-
};
|
|
701
|
-
});
|
|
702
|
-
return {
|
|
703
|
-
nPairs: pairs.length,
|
|
704
|
-
nUnpairedBaseline: unpairedBaseline.length,
|
|
705
|
-
nUnpairedTreatment: unpairedTreatment.length,
|
|
706
|
-
correctness,
|
|
707
|
-
metricDeltas
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
function metricValue(row, name) {
|
|
711
|
-
const v = row.metrics?.[name];
|
|
712
|
-
if (v === void 0) return void 0;
|
|
713
|
-
if (!Number.isFinite(v)) {
|
|
714
|
-
throw new ValidationError(
|
|
715
|
-
`comparePairedArms: non-finite value for metric '${name}' on pairKey '${row.pairKey}' (arm '${row.arm}'): ${v}`
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
return v;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
571
|
// src/campaign/cross-surface-context.ts
|
|
722
572
|
function validateCrossSurfaceInput(input) {
|
|
723
573
|
assertNonEmptyUnique(input.taskOrder, "taskOrder");
|
|
@@ -2204,8 +2054,7 @@ function sequentialPairedGate(options) {
|
|
|
2204
2054
|
direction: cfg.direction,
|
|
2205
2055
|
minEffect: cfg.minEffect,
|
|
2206
2056
|
pairedN: deltas.length,
|
|
2207
|
-
preRegisteredId: manifest
|
|
2208
|
-
metric: manifest?.metric
|
|
2057
|
+
...manifest ? { preRegisteredId: manifest.id, metric: manifest.metric } : {}
|
|
2209
2058
|
};
|
|
2210
2059
|
const meanDelta = deltas.length === 0 ? void 0 : deltas.reduce((s, d) => s + d, 0) / deltas.length;
|
|
2211
2060
|
if (last === void 0) {
|
|
@@ -6294,7 +6143,6 @@ ${block}
|
|
|
6294
6143
|
}
|
|
6295
6144
|
|
|
6296
6145
|
// src/campaign/proposers/trace-analyst.ts
|
|
6297
|
-
import { ai } from "@ax-llm/ax";
|
|
6298
6146
|
function renderFindings(findings) {
|
|
6299
6147
|
return findings.map((f, i) => {
|
|
6300
6148
|
const action = f.recommended_action ? `
|
|
@@ -6308,11 +6156,11 @@ function traceAnalystProposer(opts) {
|
|
|
6308
6156
|
if (!opts.model) throw new Error("traceAnalystProposer: model is required");
|
|
6309
6157
|
const kinds = opts.kinds ?? DEFAULT_TRACE_ANALYST_KINDS;
|
|
6310
6158
|
const produceFindings = opts.analyze ?? (async (path, c) => {
|
|
6311
|
-
const aiService =
|
|
6312
|
-
|
|
6159
|
+
const aiService = createAnalystAi({
|
|
6160
|
+
provider: opts.provider ?? "openai",
|
|
6313
6161
|
apiKey: opts.apiKey,
|
|
6314
|
-
|
|
6315
|
-
|
|
6162
|
+
baseUrl: opts.baseUrl,
|
|
6163
|
+
model: opts.model
|
|
6316
6164
|
});
|
|
6317
6165
|
const registry = new AnalystRegistry();
|
|
6318
6166
|
for (const spec of kinds) {
|
|
@@ -8026,8 +7874,6 @@ function resolveWorktreePath(surface, worktreeDir) {
|
|
|
8026
7874
|
}
|
|
8027
7875
|
|
|
8028
7876
|
export {
|
|
8029
|
-
pairArms,
|
|
8030
|
-
comparePairedArms,
|
|
8031
7877
|
completionVerdict,
|
|
8032
7878
|
verifyCompletion,
|
|
8033
7879
|
parseCorrectnessResponse,
|
|
@@ -8109,4 +7955,4 @@ export {
|
|
|
8109
7955
|
verifyCodeSurface,
|
|
8110
7956
|
resolveWorktreePath
|
|
8111
7957
|
};
|
|
8112
|
-
//# sourceMappingURL=chunk-
|
|
7958
|
+
//# sourceMappingURL=chunk-JN2FCO5W.js.map
|