@tangle-network/agent-eval 0.190.1 → 0.192.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 +69 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-DNV_U6QR.d.ts → agent-profile-DDfIjdyS.d.ts} +3 -3
- package/dist/{agent-profile-DNV_U6QR.d.ts.map → agent-profile-DDfIjdyS.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +11 -11
- package/dist/analyst/index.js +5 -5
- package/dist/{insight-report-CvPkEIcC.d.ts → analyze-runs-CPiKLJFs.d.ts} +73 -3
- package/dist/analyze-runs-CPiKLJFs.d.ts.map +1 -0
- package/dist/{attribute-vocabulary-DLJ6303h.d.ts → attribute-vocabulary-CcXqHODT.d.ts} +23 -12
- package/dist/attribute-vocabulary-CcXqHODT.d.ts.map +1 -0
- package/dist/{benchmark-command-BXIr_k8D.js → benchmark-command-C458yEFK.js} +9 -9
- package/dist/{benchmark-command-BXIr_k8D.js.map → benchmark-command-C458yEFK.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +3 -3
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +8 -7
- package/dist/{campaign-B7q74uIh.js → campaign-BVQVBEfH.js} +13 -325
- package/dist/campaign-BVQVBEfH.js.map +1 -0
- package/dist/{campaign-evidence-D40-LHIL.js → campaign-evidence-DcQiYhJI.js} +18 -154
- package/dist/campaign-evidence-DcQiYhJI.js.map +1 -0
- package/dist/claim-V9Zqbq0J.js +54 -0
- package/dist/claim-V9Zqbq0J.js.map +1 -0
- package/dist/cli.js +99 -2
- package/dist/cli.js.map +1 -1
- package/dist/client-wFyDisxi.d.ts +236 -0
- package/dist/client-wFyDisxi.d.ts.map +1 -0
- package/dist/contract/index.d.ts +10 -11
- package/dist/contract/index.js +10 -140
- package/dist/contract/index.js.map +1 -1
- package/dist/{default-registry-B5HrwrPM.d.ts → default-registry-DdqA_-_o.d.ts} +6 -6
- package/dist/{default-registry-B5HrwrPM.d.ts.map → default-registry-DdqA_-_o.d.ts.map} +1 -1
- package/dist/{default-registry-16I-Bxlf.js → default-registry-xMLX160E.js} +3 -3
- package/dist/{default-registry-16I-Bxlf.js.map → default-registry-xMLX160E.js.map} +1 -1
- package/dist/{define-agent-eval-DPizhHfy.js → define-agent-eval-DQuos3Aw.js} +30 -113
- package/dist/define-agent-eval-DQuos3Aw.js.map +1 -0
- package/dist/{define-agent-eval-DblGedQk.d.ts → define-agent-eval-DcludNJS.d.ts} +25 -38
- package/dist/define-agent-eval-DcludNJS.d.ts.map +1 -0
- package/dist/diagnosis/index.d.ts +2 -2
- package/dist/diagnosis/index.js +1 -1
- package/dist/{dspy-rlm-engine-Cs5LzJ-f.js → dspy-rlm-engine-BX34vPVY.js} +3 -3
- package/dist/{dspy-rlm-engine-Cs5LzJ-f.js.map → dspy-rlm-engine-BX34vPVY.js.map} +1 -1
- package/dist/{engine-BkLCnZQX.d.ts → engine-C1DIAEpn.d.ts} +4 -4
- package/dist/{engine-BkLCnZQX.d.ts.map → engine-C1DIAEpn.d.ts.map} +1 -1
- package/dist/evaluation.d.ts +2 -2
- package/dist/{exact-types-CfpP2A4Z.d.ts → exact-types-KGxBWH4b.d.ts} +2 -2
- package/dist/{exact-types-CfpP2A4Z.d.ts.map → exact-types-KGxBWH4b.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/experiment/index.js +2 -1
- package/dist/experiment/index.js.map +1 -1
- package/dist/{external-optimizer-process-BnSmrkgL.js → external-optimizer-process-D-Sab4v3.js} +3 -62
- package/dist/external-optimizer-process-D-Sab4v3.js.map +1 -0
- package/dist/{external-optimizer-subprocess-kbcPu5po.js → external-optimizer-subprocess-kbqC-iWf.js} +65 -27
- package/dist/external-optimizer-subprocess-kbqC-iWf.js.map +1 -0
- package/dist/{extract-usage-BrQ8mCLX.js → extract-usage-DFATEuWW.js} +2 -2
- package/dist/{extract-usage-BrQ8mCLX.js.map → extract-usage-DFATEuWW.js.map} +1 -1
- package/dist/{feedback-trajectory-BYjh7NEM.d.ts → feedback-trajectory-BXCGTRkz.d.ts} +3 -3
- package/dist/{feedback-trajectory-BYjh7NEM.d.ts.map → feedback-trajectory-BXCGTRkz.d.ts.map} +1 -1
- package/dist/hosted/index.d.ts +66 -6
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +2 -2
- package/dist/{index-I4UJGRno.d.ts → index-Bj96W0jZ.d.ts} +28 -2
- package/dist/{index-I4UJGRno.d.ts.map → index-Bj96W0jZ.d.ts.map} +1 -1
- package/dist/{index-2e_MTznj.d.ts → index-DBoXFaz0.d.ts} +6 -6
- package/dist/{index-2e_MTznj.d.ts.map → index-DBoXFaz0.d.ts.map} +1 -1
- package/dist/{index-CWoIJHmy.d.ts → index-DNVzu9Vv.d.ts} +10 -104
- package/dist/index-DNVzu9Vv.d.ts.map +1 -0
- package/dist/{index-CJv56rhX.d.ts → index-DwQxdWve.d.ts} +351 -135
- package/dist/index-DwQxdWve.d.ts.map +1 -0
- package/dist/index.d.ts +16 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/jev.d.ts +2 -2
- package/dist/{journal-c3qY0SDP.js → journal-DvKCvjty.js} +94 -2
- package/dist/{journal-c3qY0SDP.js.map → journal-DvKCvjty.js.map} +1 -1
- package/dist/{kind-factory-ByZeXDqF.js → kind-factory-CdPPHtGZ.js} +10 -26
- package/dist/kind-factory-CdPPHtGZ.js.map +1 -0
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +2 -2
- package/dist/{llm-judge-BnxAv7ed.js → llm-judge-Z6MkTkd0.js} +1805 -2012
- package/dist/llm-judge-Z6MkTkd0.js.map +1 -0
- package/dist/{matrix-CNypzP-v.d.ts → matrix-CQMMrEQ5.d.ts} +2 -2
- package/dist/{matrix-CNypzP-v.d.ts.map → matrix-CQMMrEQ5.d.ts.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{otel-spans-CQY1pNiN.js → otel-spans-DS7t1t1J.js} +8 -19
- package/dist/otel-spans-DS7t1t1J.js.map +1 -0
- package/dist/otlp-attributes-D9ptWaIJ.js +53 -0
- package/dist/otlp-attributes-D9ptWaIJ.js.map +1 -0
- package/dist/{prime-protocol-Fwvctmhm.d.ts → prime-protocol-T0i6xcAs.d.ts} +2 -2
- package/dist/{prime-protocol-Fwvctmhm.d.ts.map → prime-protocol-T0i6xcAs.d.ts.map} +1 -1
- package/dist/{produced-state-BXjXJHJT.js → produced-state-CVmCPQDJ.js} +3 -3
- package/dist/{produced-state-BXjXJHJT.js.map → produced-state-CVmCPQDJ.js.map} +1 -1
- package/dist/{registry-mAQVtuLx.d.ts → registry-Bu3lNole.d.ts} +3 -3
- package/dist/{registry-mAQVtuLx.d.ts.map → registry-Bu3lNole.d.ts.map} +1 -1
- package/dist/rl.d.ts +1 -1
- package/dist/rl.js +1 -1
- package/dist/{run-record-DnMFyg_g.js → run-record-tNnlQIrD.js} +2 -10
- package/dist/{run-record-DnMFyg_g.js.map → run-record-tNnlQIrD.js.map} +1 -1
- package/dist/search-ledger-Ck7tok0h.js +1517 -0
- package/dist/search-ledger-Ck7tok0h.js.map +1 -0
- package/dist/search-ledger-file-DY0AXX3W.js +27 -0
- package/dist/search-ledger-file-DY0AXX3W.js.map +1 -0
- package/dist/search-shipper-BG182p-U.js +781 -0
- package/dist/search-shipper-BG182p-U.js.map +1 -0
- package/dist/{semantic-concept-judge-ClB73cei.js → semantic-concept-judge-Bg-560H0.js} +4 -4
- package/dist/{semantic-concept-judge-ClB73cei.js.map → semantic-concept-judge-Bg-560H0.js.map} +1 -1
- package/dist/{skillopt-optimization-method-l2vDBtKp.js → skillopt-optimization-method-DoayuM6D.js} +6 -5
- package/dist/{skillopt-optimization-method-l2vDBtKp.js.map → skillopt-optimization-method-DoayuM6D.js.map} +1 -1
- package/dist/{statistical-heldout-CLpjYffJ.d.ts → statistical-heldout-C1Ej5Ce8.d.ts} +2 -2
- package/dist/{statistical-heldout-CLpjYffJ.d.ts.map → statistical-heldout-C1Ej5Ce8.d.ts.map} +1 -1
- package/dist/{store-otlp-84DH0OEH.js → store-otlp-BPowgPm6.js} +2 -2
- package/dist/{store-otlp-84DH0OEH.js.map → store-otlp-BPowgPm6.js.map} +1 -1
- package/dist/{store-tool-spans-DUiqyHvR.js → store-tool-spans-BcC_5ef-.js} +5 -5
- package/dist/{store-tool-spans-DUiqyHvR.js.map → store-tool-spans-BcC_5ef-.js.map} +1 -1
- package/dist/{store-tool-spans-BBXs8hDP.d.ts → store-tool-spans-ByLdU26j.d.ts} +5 -9
- package/dist/store-tool-spans-ByLdU26j.d.ts.map +1 -0
- package/dist/{task-failure-attributes-B34TiMBe.js → task-failure-attributes-CEqEfuIY.js} +17 -9
- package/dist/task-failure-attributes-CEqEfuIY.js.map +1 -0
- package/dist/{tool-groups-W7MJobX_.d.ts → tool-groups-DiBi16ns.d.ts} +3 -3
- package/dist/tool-groups-DiBi16ns.d.ts.map +1 -0
- package/dist/trace-attributes.d.ts +1 -1
- package/dist/trace-attributes.js +23 -75
- package/dist/trace-attributes.js.map +1 -1
- package/dist/trace-repair/index.d.ts +1 -1
- package/dist/traces.d.ts +11 -18
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +16 -16
- package/dist/traces.js.map +1 -1
- package/dist/{types-Cvqy7asY.d.ts → types-ByZslIlr.d.ts} +2 -2
- package/dist/{types-Cvqy7asY.d.ts.map → types-ByZslIlr.d.ts.map} +1 -1
- package/dist/{types-BvmWNjjs.d.ts → types-C1CAD70_.d.ts} +15 -16
- package/dist/types-C1CAD70_.d.ts.map +1 -0
- package/dist/{types-Bay1dh2o.d.ts → types-CeDfCRXp.d.ts} +11 -16
- package/dist/types-CeDfCRXp.d.ts.map +1 -0
- package/dist/wire/index.d.ts +1 -1
- package/docs/campaign-proposers.md +14 -16
- package/docs/hosted-ingest-spec.md +92 -133
- package/docs/public-api.md +46 -35
- package/docs/search-ledger.md +79 -1
- package/package.json +2 -2
- package/dist/analyze-runs-BvK4-wSs.d.ts +0 -75
- package/dist/analyze-runs-BvK4-wSs.d.ts.map +0 -1
- package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +0 -1
- package/dist/campaign-B7q74uIh.js.map +0 -1
- package/dist/campaign-evidence-D40-LHIL.js.map +0 -1
- package/dist/client-BhEyAdfe.d.ts +0 -202
- package/dist/client-BhEyAdfe.d.ts.map +0 -1
- package/dist/client-QwJpsNYU.js +0 -655
- package/dist/client-QwJpsNYU.js.map +0 -1
- package/dist/define-agent-eval-DPizhHfy.js.map +0 -1
- package/dist/define-agent-eval-DblGedQk.d.ts.map +0 -1
- package/dist/external-optimizer-process-BnSmrkgL.js.map +0 -1
- package/dist/external-optimizer-subprocess-kbcPu5po.js.map +0 -1
- package/dist/index-CJv56rhX.d.ts.map +0 -1
- package/dist/index-CWoIJHmy.d.ts.map +0 -1
- package/dist/insight-report-CvPkEIcC.d.ts.map +0 -1
- package/dist/kind-factory-ByZeXDqF.js.map +0 -1
- package/dist/llm-judge-BnxAv7ed.js.map +0 -1
- package/dist/otel-spans-CQY1pNiN.js.map +0 -1
- package/dist/otlp-attributes-BpC_blLF.js +0 -83
- package/dist/otlp-attributes-BpC_blLF.js.map +0 -1
- package/dist/store-tool-spans-BBXs8hDP.d.ts.map +0 -1
- package/dist/task-failure-attributes-B34TiMBe.js.map +0 -1
- package/dist/tool-groups-W7MJobX_.d.ts.map +0 -1
- package/dist/types-Bay1dh2o.d.ts.map +0 -1
- package/dist/types-BvmWNjjs.d.ts.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as AgentEvalError } from "./errors-Dngq5h35.js";
|
|
2
2
|
import { a as hashCanonical, i as compareCodeUnits, r as canonicalString } from "./canonical-BsZVgBhW.js";
|
|
3
3
|
import { n as aggregatePairedHoldout, o as pairHoldout } from "./statistical-heldout-GcLIPxk4.js";
|
|
4
4
|
import { n as contentHash } from "./verdict-cache-BQEsVy9n.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as FileLedgerJournal } from "./journal-
|
|
7
|
-
import {
|
|
5
|
+
import { r as projectCampaignCellQuality } from "./run-record-tNnlQIrD.js";
|
|
6
|
+
import { t as FileLedgerJournal } from "./journal-DvKCvjty.js";
|
|
7
|
+
import { t as defineEvaluationClaim } from "./claim-V9Zqbq0J.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { join } from "node:path";
|
|
@@ -403,53 +403,6 @@ function surfaceDispatchRef(surface, executionRef = "anonymous") {
|
|
|
403
403
|
return `surface:${executionRef}:${surfaceContentHash(surface)}`;
|
|
404
404
|
}
|
|
405
405
|
//#endregion
|
|
406
|
-
//#region src/experiment/claim.ts
|
|
407
|
-
const nonEmpty = z.string().min(1).refine((value) => value.trim() === value);
|
|
408
|
-
/** The claim's schema, shared by every record that binds a claim. */
|
|
409
|
-
const evaluationClaimSchema = z.object({
|
|
410
|
-
use: z.enum([
|
|
411
|
-
"development",
|
|
412
|
-
"comparison",
|
|
413
|
-
"certification"
|
|
414
|
-
]),
|
|
415
|
-
population: z.object({
|
|
416
|
-
id: nonEmpty,
|
|
417
|
-
description: nonEmpty
|
|
418
|
-
}).strict(),
|
|
419
|
-
samplingFrame: nonEmpty,
|
|
420
|
-
independentUnit: nonEmpty,
|
|
421
|
-
generalization: z.enum(["fixed-roster", "new-units"]),
|
|
422
|
-
minimumEffect: z.number().finite().positive().optional()
|
|
423
|
-
}).strict();
|
|
424
|
-
/** Validate a claim before binding it to a sealed experiment or final evidence. */
|
|
425
|
-
function defineEvaluationClaim(input) {
|
|
426
|
-
const parsed = evaluationClaimSchema.safeParse(input);
|
|
427
|
-
if (!parsed.success) throw new ValidationError(`invalid evaluation claim: ${parsed.error.message}`);
|
|
428
|
-
return Object.freeze({
|
|
429
|
-
...parsed.data,
|
|
430
|
-
population: Object.freeze(parsed.data.population)
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
/** Repetitions retain their denominator without becoming additional independent units. */
|
|
434
|
-
function summarizeEvaluationUnits(claim, rows) {
|
|
435
|
-
const validated = defineEvaluationClaim(claim);
|
|
436
|
-
const counts = /* @__PURE__ */ new Map();
|
|
437
|
-
for (const [index, row] of rows.entries()) {
|
|
438
|
-
if (row === null || typeof row !== "object" || Array.isArray(row)) throw new ValidationError(`evaluation claim: row ${index} must be an object`);
|
|
439
|
-
const value = readField(row, validated.independentUnit);
|
|
440
|
-
if (typeof value !== "string" || !value.trim() || value.trim() !== value) throw new ValidationError(`evaluation claim: row ${index} needs a nonempty string at '${validated.independentUnit}'`);
|
|
441
|
-
counts.set(value, (counts.get(value) ?? 0) + 1);
|
|
442
|
-
}
|
|
443
|
-
return {
|
|
444
|
-
observations: rows.length,
|
|
445
|
-
independentUnits: counts.size,
|
|
446
|
-
units: [...counts].sort(([left], [right]) => compareCodeUnits(left, right)).map(([id, observations]) => ({
|
|
447
|
-
id,
|
|
448
|
-
observations
|
|
449
|
-
}))
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
//#endregion
|
|
453
406
|
//#region src/experiment/final-evidence.ts
|
|
454
407
|
const identity = z.string().min(1).refine((value) => value.trim() === value);
|
|
455
408
|
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
@@ -1017,25 +970,6 @@ function campaignMeanCompositeOrNull(campaign) {
|
|
|
1017
970
|
});
|
|
1018
971
|
return scores.length === 0 ? null : scores.reduce((sum, score) => sum + score, 0) / scores.length;
|
|
1019
972
|
}
|
|
1020
|
-
/** Reject rank keys that cannot produce deterministic lexicographic ordering. */
|
|
1021
|
-
function assertFiniteRankKey(key, label, expectedLength) {
|
|
1022
|
-
if (!Array.isArray(key) || key.length === 0) throw new Error(`${label} must return a non-empty array`);
|
|
1023
|
-
if (expectedLength !== void 0 && key.length !== expectedLength) throw new Error(`${label} returned ${key.length} elements; expected ${expectedLength}`);
|
|
1024
|
-
for (let index = 0; index < key.length; index++) if (!Number.isFinite(key[index])) throw new Error(`${label}[${index}] must be finite`);
|
|
1025
|
-
}
|
|
1026
|
-
/** Compare fixed-length lexicographic rank keys where each element is higher-is-better.
|
|
1027
|
-
* Returns a positive number when `a` ranks above `b`, negative when below, and
|
|
1028
|
-
* zero when equal. */
|
|
1029
|
-
function compareRankKeys(a, b) {
|
|
1030
|
-
assertFiniteRankKey(a, "rank key a");
|
|
1031
|
-
assertFiniteRankKey(b, "rank key b", a.length);
|
|
1032
|
-
for (let i = 0; i < a.length; i++) {
|
|
1033
|
-
const av = a[i];
|
|
1034
|
-
const bv = b[i];
|
|
1035
|
-
if (av !== bv) return av - bv;
|
|
1036
|
-
}
|
|
1037
|
-
return 0;
|
|
1038
|
-
}
|
|
1039
973
|
/** Per-candidate evidence a reflective/patch proposer grounds its next proposal
|
|
1040
974
|
* on: mean score per judge dimension + per-scenario composite. */
|
|
1041
975
|
function campaignBreakdown(campaign) {
|
|
@@ -1182,7 +1116,7 @@ function buildLoopProvenanceRecord(args) {
|
|
|
1182
1116
|
if (surfaceByHash.size !== candidateByHash.size) throw new Error("buildLoopProvenanceRecord: every measured candidate requires exactly one surface");
|
|
1183
1117
|
for (const promotedHash of promotedSet) if (!candidateByHash.has(promotedHash)) throw new Error("buildLoopProvenanceRecord: promoted hash has no measured candidate");
|
|
1184
1118
|
for (const c of gen.candidates) {
|
|
1185
|
-
validateCandidateMeasurement(c,
|
|
1119
|
+
validateCandidateMeasurement(c, incumbentComposite, promotedSet.has(c.surfaceHash));
|
|
1186
1120
|
const measured = surfaceByHash.get(c.surfaceHash);
|
|
1187
1121
|
if (measured === void 0) throw new Error("buildLoopProvenanceRecord: measured candidate is missing its surface");
|
|
1188
1122
|
const { surface, campaign } = measured;
|
|
@@ -1193,8 +1127,6 @@ function buildLoopProvenanceRecord(args) {
|
|
|
1193
1127
|
surfaceHash: c.surfaceHash,
|
|
1194
1128
|
contentHash: surfaceContentHash(surface),
|
|
1195
1129
|
campaignDigest: campaignMeasurementDigest(campaign),
|
|
1196
|
-
parentSurfaceHash: c.parentSurfaceHash,
|
|
1197
|
-
parentComposite: c.parentComposite,
|
|
1198
1130
|
eligibleForPromotion: c.eligibleForPromotion,
|
|
1199
1131
|
coverage: {
|
|
1200
1132
|
expectedCells: c.coverage.expectedCells,
|
|
@@ -1207,7 +1139,6 @@ function buildLoopProvenanceRecord(args) {
|
|
|
1207
1139
|
if (c.label) entry.label = c.label;
|
|
1208
1140
|
if (c.rationale) entry.rationale = c.rationale;
|
|
1209
1141
|
if (c.attribution) entry.attribution = c.attribution;
|
|
1210
|
-
if (c.observedDeltaFromParent !== void 0) entry.observedDeltaFromParent = c.observedDeltaFromParent;
|
|
1211
1142
|
candidates.push(entry);
|
|
1212
1143
|
}
|
|
1213
1144
|
const promotedHash = gen.promoted[0];
|
|
@@ -1377,14 +1308,10 @@ function assertGateContributions(value, source) {
|
|
|
1377
1308
|
if ("passed" in item) throw new Error(`${source}: gate contribution '${item.name}' uses obsolete passed; use status instead`);
|
|
1378
1309
|
}
|
|
1379
1310
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
if (candidate.observedDeltaFromParent !== void 0) {
|
|
1385
|
-
if (!Number.isFinite(candidate.observedDeltaFromParent)) throw new Error("buildLoopProvenanceRecord: observedDeltaFromParent must be finite");
|
|
1386
|
-
if (candidate.eligibleForPromotion !== true) throw new Error("buildLoopProvenanceRecord: observedDeltaFromParent requires a complete eligible candidate and parentSurfaceHash");
|
|
1387
|
-
}
|
|
1311
|
+
/** A candidate's coverage receipt and composite agree, and a promoted
|
|
1312
|
+
* candidate is complete and beats the incumbent it replaced. Its lineage is
|
|
1313
|
+
* the search ledger's to prove, not this record's. */
|
|
1314
|
+
function validateCandidateMeasurement(candidate, incumbentComposite, promoted) {
|
|
1388
1315
|
const coverage = candidate.coverage;
|
|
1389
1316
|
if (!Number.isSafeInteger(coverage.expectedCells) || coverage.expectedCells <= 0 || !Number.isSafeInteger(coverage.scorableCells) || coverage.scorableCells < 0 || coverage.scorableCells > coverage.expectedCells) throw new Error("buildLoopProvenanceRecord: invalid candidate coverage denominator");
|
|
1390
1317
|
const unscorableIds = /* @__PURE__ */ new Set();
|
|
@@ -1397,14 +1324,8 @@ function validateCandidateMeasurement(candidate, expectedParentHash, expectedPar
|
|
|
1397
1324
|
if (candidate.eligibleForPromotion !== complete) throw new Error("buildLoopProvenanceRecord: candidate eligibility contradicts its coverage receipt");
|
|
1398
1325
|
if (complete) {
|
|
1399
1326
|
if (candidate.composite === null || !Number.isFinite(candidate.composite)) throw new Error("buildLoopProvenanceRecord: complete candidate composite must be finite");
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
if (Math.abs(candidate.observedDeltaFromParent - recomputed) > 1e-12) throw new Error("buildLoopProvenanceRecord: observed delta does not match measured scores");
|
|
1403
|
-
} else {
|
|
1404
|
-
if (candidate.composite !== null && !Number.isFinite(candidate.composite)) throw new Error("buildLoopProvenanceRecord: candidate composite must be finite or null");
|
|
1405
|
-
if (candidate.observedDeltaFromParent !== void 0) throw new Error("buildLoopProvenanceRecord: incomplete candidate cannot carry observed delta");
|
|
1406
|
-
}
|
|
1407
|
-
if (promoted && (!complete || (candidate.observedDeltaFromParent ?? 0) <= 0)) throw new Error("buildLoopProvenanceRecord: promoted candidate must improve the incumbent");
|
|
1327
|
+
} else if (candidate.composite !== null && !Number.isFinite(candidate.composite)) throw new Error("buildLoopProvenanceRecord: candidate composite must be finite or null");
|
|
1328
|
+
if (promoted && (!complete || (candidate.composite ?? Number.NEGATIVE_INFINITY) <= incumbentComposite)) throw new Error("buildLoopProvenanceRecord: promoted candidate must improve the incumbent");
|
|
1408
1329
|
}
|
|
1409
1330
|
function hashId(parts) {
|
|
1410
1331
|
return createHash("sha256").update(parts.join(":")).digest("hex");
|
|
@@ -1496,8 +1417,6 @@ function loopProvenanceSpans(record, opts = {}) {
|
|
|
1496
1417
|
"tangle.generation": generation,
|
|
1497
1418
|
"tangle.surfaceHash": c.surfaceHash,
|
|
1498
1419
|
"tangle.contentHash": c.contentHash,
|
|
1499
|
-
"tangle.parentSurfaceHash": c.parentSurfaceHash,
|
|
1500
|
-
"tangle.parentComposite": c.parentComposite,
|
|
1501
1420
|
"tangle.eligibleForPromotion": c.eligibleForPromotion,
|
|
1502
1421
|
"tangle.expectedCells": c.coverage.expectedCells,
|
|
1503
1422
|
"tangle.scorableCells": c.coverage.scorableCells,
|
|
@@ -1505,7 +1424,6 @@ function loopProvenanceSpans(record, opts = {}) {
|
|
|
1505
1424
|
"tangle.promoted": c.promoted
|
|
1506
1425
|
};
|
|
1507
1426
|
if (c.composite !== null) attributes["tangle.composite"] = c.composite;
|
|
1508
|
-
if (c.observedDeltaFromParent !== void 0) attributes["tangle.observedDeltaFromParent"] = c.observedDeltaFromParent;
|
|
1509
1427
|
if (c.label) attributes["tangle.candidateLabel"] = c.label;
|
|
1510
1428
|
if (c.rationale) attributes["tangle.candidateRationale"] = c.rationale;
|
|
1511
1429
|
spans.push({
|
|
@@ -1556,52 +1474,6 @@ function provenanceRecordPath(runDir) {
|
|
|
1556
1474
|
function provenanceSpansPath(runDir) {
|
|
1557
1475
|
return join(runDir, "loop-provenance-spans.jsonl");
|
|
1558
1476
|
}
|
|
1559
|
-
/** Snapshot a held-out campaign into the hosted `EvalRunGenerationSnapshot`
|
|
1560
|
-
* shape — per-cell composite + per-judge dimensions, aggregate mean, cost,
|
|
1561
|
-
* duration. The dashboard renders these as the baseline → winner comparison. */
|
|
1562
|
-
function snapshotFromHoldout(index, surfaceHash, surface, campaign) {
|
|
1563
|
-
return {
|
|
1564
|
-
index,
|
|
1565
|
-
surfaceHash,
|
|
1566
|
-
surface,
|
|
1567
|
-
cells: campaign.cells.map((cell) => {
|
|
1568
|
-
const execution = campaignCellExecutionEvidence(cell);
|
|
1569
|
-
const quality = projectCampaignCellQuality(cell);
|
|
1570
|
-
const score = {
|
|
1571
|
-
scenarioId: cell.scenarioId,
|
|
1572
|
-
rep: cell.rep,
|
|
1573
|
-
compositeMean: quality.score ?? null,
|
|
1574
|
-
dimensions: quality.judgeScores?.perJudge ?? {},
|
|
1575
|
-
terminalOutcome: execution.terminalOutcome,
|
|
1576
|
-
executionErrorCount: execution.executionErrorCount ?? null
|
|
1577
|
-
};
|
|
1578
|
-
if (cell.error) score.errorMessage = cell.error;
|
|
1579
|
-
return score;
|
|
1580
|
-
}),
|
|
1581
|
-
compositeMean: campaignMeanCompositeOrNull(campaign),
|
|
1582
|
-
costUsd: campaign.aggregates.cost.totalCostUsd,
|
|
1583
|
-
durationMs: campaign.durationMs
|
|
1584
|
-
};
|
|
1585
|
-
}
|
|
1586
|
-
/** Build the hosted `EvalRunEvent` from the loop args + record — baseline +
|
|
1587
|
-
* winner snapshots, gate decision, held-out lift, cost, duration. Shipped to
|
|
1588
|
-
* `/v1/ingest/eval-runs` so the run appears in the dashboard's run list (the
|
|
1589
|
-
* trace spans, shipped separately, back the per-candidate drill-down). */
|
|
1590
|
-
function buildEvalRunEvent(args, record) {
|
|
1591
|
-
return {
|
|
1592
|
-
runId: args.runId,
|
|
1593
|
-
runDir: args.runDir,
|
|
1594
|
-
timestamp: args.timestamp,
|
|
1595
|
-
status: "finished",
|
|
1596
|
-
labels: {},
|
|
1597
|
-
baseline: snapshotFromHoldout(0, record.baselineContentHash, args.baselineSurface, args.baselineOnHoldout),
|
|
1598
|
-
generations: [snapshotFromHoldout(1, record.winnerContentHash, args.winnerSurface, args.winnerOnHoldout)],
|
|
1599
|
-
gateDecision: args.gate.decision,
|
|
1600
|
-
...record.heldOutLift !== void 0 ? { holdoutLift: record.heldOutLift } : {},
|
|
1601
|
-
totalCostUsd: args.totalCostUsd,
|
|
1602
|
-
totalDurationMs: args.totalDurationMs
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
1477
|
/**
|
|
1606
1478
|
* Build the provenance record + OTel spans and persist them durably under the
|
|
1607
1479
|
* run dir (and ship spans to a hosted collector when one is wired). Returns
|
|
@@ -1620,19 +1492,11 @@ async function emitLoopProvenance(args) {
|
|
|
1620
1492
|
const spansPath = provenanceSpansPath(args.runDir);
|
|
1621
1493
|
args.storage.write(recordPath, JSON.stringify(record, null, 2));
|
|
1622
1494
|
args.storage.write(spansPath, spans.map((s) => JSON.stringify(s)).join("\n"));
|
|
1623
|
-
if (args.hostedClient) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
console.warn(`[agent-eval] hosted eval-run ingest failed (continuing): ${msg}`);
|
|
1629
|
-
}
|
|
1630
|
-
try {
|
|
1631
|
-
await args.hostedClient.ingestTraces(spans);
|
|
1632
|
-
} catch (err) {
|
|
1633
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
1634
|
-
console.warn(`[agent-eval] provenance span ingest failed (continuing): ${msg}`);
|
|
1635
|
-
}
|
|
1495
|
+
if (args.hostedClient) try {
|
|
1496
|
+
await args.hostedClient.ingestTraces(spans);
|
|
1497
|
+
} catch (err) {
|
|
1498
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1499
|
+
console.warn(`[agent-eval] provenance span ingest failed (continuing): ${msg}`);
|
|
1636
1500
|
}
|
|
1637
1501
|
return {
|
|
1638
1502
|
record,
|
|
@@ -1872,6 +1736,6 @@ function createCampaignEvidenceReceipt(input) {
|
|
|
1872
1736
|
});
|
|
1873
1737
|
}
|
|
1874
1738
|
//#endregion
|
|
1875
|
-
export {
|
|
1739
|
+
export { openFinalEvidenceLedger as A, assertRealBackend as B, pairedCampaignComposites as C, powerPreflight as D, recoverTruncatedJson as E, surfaceContentHash as F, campaignCoverage as G, assertCampaignDesign as H, surfaceDispatchRef as I, campaignSplitDigestFromIdentities as J, campaignScenarioIdentity as K, surfaceHash as L, codeSurfaceIdentityMaterial as M, componentSurfaceIdentityMaterial as N, FinalEvidenceConflictError as O, renderSurfaceDiff as P, surfaceHashMatches as R, campaignMeanCompositeOrNull as S, parseReflectionResponse as T, assertCampaignSplitIdentity as U, summarizeBackendIntegrity as V, assertCompleteCampaign as W, formatCoverageFailures as Y, provenanceRecordPath as _, createEvidenceReceipt as a, campaignBreakdown as b, ATTESTATION_ALGORITHM as c, buildLoopProvenanceRecord as d, campaignMeasurementDigest as f, loopProvenanceSpans as g, loopProvenanceArgsFromResult as h, INDEPENDENT_EVIDENCE_AUTHORITY_KINDS as i, assertCodeSurfaceIdentity as j, FinalEvidenceError as k, attest as l, emitLoopProvenance as m, EVIDENCE_AUTHORITY_KINDS as n, isIndependentEvidence as o, canonicalDigest as p, campaignSplitDigest as q, EVIDENCE_RECEIPT_VERSION as r, verifyEvidenceReceipt as s, createCampaignEvidenceReceipt as t, verifyAttestation as u, provenanceSpansPath as v, buildReflectionPrompt as w, campaignMeanComposite as x, verifyLoopProvenanceRecord as y, BackendIntegrityError as z };
|
|
1876
1740
|
|
|
1877
|
-
//# sourceMappingURL=campaign-evidence-
|
|
1741
|
+
//# sourceMappingURL=campaign-evidence-DcQiYhJI.js.map
|