@tangle-network/agent-eval 1.0.37 → 1.0.39

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 (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/adapters/http.d.ts +2 -2
  3. package/dist/analyst/index.d.ts +3 -3
  4. package/dist/analyst/index.js +2 -2
  5. package/dist/app-grade/index.d.ts +2 -2
  6. package/dist/{benchmark-command-08LitQTo.js → benchmark-command-BpmrrgzA.js} +2 -2
  7. package/dist/{benchmark-command-08LitQTo.js.map → benchmark-command-BpmrrgzA.js.map} +1 -1
  8. package/dist/benchmarks/index.d.ts +4 -4
  9. package/dist/benchmarks/index.js +2 -2
  10. package/dist/campaign/index.d.ts +4 -4
  11. package/dist/campaign/index.js +3 -3
  12. package/dist/{campaign-DJciOYZ6.js → campaign-UzOUBIwA.js} +4 -27
  13. package/dist/campaign-UzOUBIwA.js.map +1 -0
  14. package/dist/cli.js +1 -1
  15. package/dist/contract/index.d.ts +7 -7
  16. package/dist/contract/index.js +4 -4
  17. package/dist/{default-registry-BzCIR-YP.d.ts → default-registry-C5x2jyD6.d.ts} +2 -2
  18. package/dist/{default-registry-BzCIR-YP.d.ts.map → default-registry-C5x2jyD6.d.ts.map} +1 -1
  19. package/dist/{default-registry-CpGvgSYQ.js → default-registry-DSo3tnsW.js} +7 -31
  20. package/dist/default-registry-DSo3tnsW.js.map +1 -0
  21. package/dist/{define-agent-eval-DOB58LaZ.d.ts → define-agent-eval-4KGwzIVt.d.ts} +5 -5
  22. package/dist/{define-agent-eval-DOB58LaZ.d.ts.map → define-agent-eval-4KGwzIVt.d.ts.map} +1 -1
  23. package/dist/{define-agent-eval-Db2cZJjC.js → define-agent-eval-C6zFzxp7.js} +2 -2
  24. package/dist/{define-agent-eval-Db2cZJjC.js.map → define-agent-eval-C6zFzxp7.js.map} +1 -1
  25. package/dist/{evaluation-DJqWiVkb.d.ts → evaluation-CQ-uAbqF.d.ts} +2 -2
  26. package/dist/{evaluation-DJqWiVkb.d.ts.map → evaluation-CQ-uAbqF.d.ts.map} +1 -1
  27. package/dist/evaluation.d.ts +1 -1
  28. package/dist/experiment/index.d.ts +1 -1
  29. package/dist/{index-BEAzBo4U.d.ts → index-Bhc7H9e0.d.ts} +2 -2
  30. package/dist/{index-BEAzBo4U.d.ts.map → index-Bhc7H9e0.d.ts.map} +1 -1
  31. package/dist/{index-D5_Srjot.d.ts → index-BsTGJf2M.d.ts} +10 -10
  32. package/dist/{index-D5_Srjot.d.ts.map → index-BsTGJf2M.d.ts.map} +1 -1
  33. package/dist/{index-BOm81bra.d.ts → index-CzEGCOWM.d.ts} +6 -6
  34. package/dist/{index-BOm81bra.d.ts.map → index-CzEGCOWM.d.ts.map} +1 -1
  35. package/dist/{index-DX0t5hA_.d.ts → index-OvU1UXKC.d.ts} +4 -4
  36. package/dist/{index-DX0t5hA_.d.ts.map → index-OvU1UXKC.d.ts.map} +1 -1
  37. package/dist/{index-CDEe3TyM.d.ts → index-RBV2Y-7X.d.ts} +2 -2
  38. package/dist/{index-CDEe3TyM.d.ts.map → index-RBV2Y-7X.d.ts.map} +1 -1
  39. package/dist/index.d.ts +10 -10
  40. package/dist/index.js +3 -3
  41. package/dist/{llm-judge-C5pZ7DSS.js → llm-judge-lUQCBY1e.js} +45 -19
  42. package/dist/llm-judge-lUQCBY1e.js.map +1 -0
  43. package/dist/{matrix-C5hfz5wA.d.ts → matrix-BKzNwIWb.d.ts} +2 -2
  44. package/dist/{matrix-C5hfz5wA.d.ts.map → matrix-BKzNwIWb.d.ts.map} +1 -1
  45. package/dist/multishot/golden/index.d.ts +1 -1
  46. package/dist/multishot/index.d.ts +2 -2
  47. package/dist/openapi.json +1 -1
  48. package/dist/rl.d.ts +1 -1
  49. package/dist/rollout/index.d.ts +2 -2
  50. package/dist/search/index.d.ts +2 -2
  51. package/dist/{search-kernel-VeoTiwiJ.d.ts → search-kernel-DRHWY35J.d.ts} +2 -2
  52. package/dist/{search-kernel-VeoTiwiJ.d.ts.map → search-kernel-DRHWY35J.d.ts.map} +1 -1
  53. package/dist/{skillopt-optimization-method-CH9roCBs.js → skillopt-optimization-method-Dch9LiNR.js} +2 -2
  54. package/dist/{skillopt-optimization-method-CH9roCBs.js.map → skillopt-optimization-method-Dch9LiNR.js.map} +1 -1
  55. package/dist/{statistical-heldout-Bk9mrEoz.d.ts → statistical-heldout-RmdXoz2e.d.ts} +2 -2
  56. package/dist/{statistical-heldout-Bk9mrEoz.d.ts.map → statistical-heldout-RmdXoz2e.d.ts.map} +1 -1
  57. package/dist/{systemone-BCtHGtds.d.ts → systemone-B_3Vd395.d.ts} +3 -3
  58. package/dist/{systemone-BCtHGtds.d.ts.map → systemone-B_3Vd395.d.ts.map} +1 -1
  59. package/dist/systemone.d.ts +2 -2
  60. package/dist/{types-D7X941FU.d.ts → types-ClDpBoLt.d.ts} +2 -2
  61. package/dist/{types-D7X941FU.d.ts.map → types-ClDpBoLt.d.ts.map} +1 -1
  62. package/dist/{types-Bq8xZKCQ.d.ts → types-DGqGbNY4.d.ts} +3 -2
  63. package/dist/{types-Bq8xZKCQ.d.ts.map → types-DGqGbNY4.d.ts.map} +1 -1
  64. package/docs/concepts.md +3 -0
  65. package/package.json +1 -1
  66. package/dist/campaign-DJciOYZ6.js.map +0 -1
  67. package/dist/default-registry-CpGvgSYQ.js.map +0 -1
  68. package/dist/llm-judge-C5pZ7DSS.js.map +0 -1
@@ -104,7 +104,7 @@ function computeAggregates(cells, judges, seed, cost) {
104
104
  return {
105
105
  byJudge,
106
106
  byScenario,
107
- cost,
107
+ cost: withUncapturedAgentCells(cost, cells),
108
108
  cellsExecuted: cells.filter((cell) => !cell.error?.startsWith("skipped:") && cell.errorStage !== "dispatch" && !(cell.error && cell.errorStage === void 0)).length,
109
109
  cellsSkipped: cells.filter((c) => c.error?.startsWith("skipped:")).length,
110
110
  cellsCached: cells.filter((c) => c.cached).length,
@@ -118,6 +118,25 @@ function computeAggregates(cells, judges, seed, cost) {
118
118
  cellsUnclassifiedFailed: unclassifiedFailures.length
119
119
  };
120
120
  }
121
+ /**
122
+ * The run's ledger summary, made incomplete by each cell whose agent spend the ledger did not
123
+ * capture. A judge receipt elsewhere in the run says nothing about an agent that paid outside the
124
+ * ledger, so the run claims complete accounting only when every executed cell's agent spend is known.
125
+ */
126
+ function withUncapturedAgentCells(cost, cells) {
127
+ const uncaptured = cells.filter((cell) => !cell.error?.startsWith("skipped:") && cell.costProvenance.kind === "uncaptured");
128
+ if (uncaptured.length === 0) return cost;
129
+ return {
130
+ ...cost,
131
+ costProvenance: {
132
+ kind: "uncaptured",
133
+ usd: null
134
+ },
135
+ usageComplete: cost.usageComplete && uncaptured.every((cell) => cell.tokenUsage.tokensKnown !== false),
136
+ accountingComplete: false,
137
+ incompleteReasons: [.../* @__PURE__ */ new Set([...cost.incompleteReasons, ...uncaptured.map((cell) => `agent spend for cell '${cell.cellId}' was not captured by the cost ledger`)])]
138
+ };
139
+ }
121
140
  function aggregate(samples, seed) {
122
141
  const distribution = summarizeNumberSeries(samples);
123
142
  if (distribution === null) throw new Error("aggregate requires at least one finite score");
@@ -234,19 +253,32 @@ function cellReceiptModels(cell) {
234
253
  const reported = cell.resolvedModels ?? (cell.resolvedModel ? [cell.resolvedModel] : []);
235
254
  return [...new Set(reported.map((model) => model.trim()).filter(Boolean))];
236
255
  }
237
- function withCurrentAgentModelEvidence(cached, costLedger, stableCostTags) {
238
- const cachedCallIds = new Set(cached.costCallIds ?? []);
256
+ /** Reconcile a live or resumed cell with its agent receipts. Model identity and accounting
257
+ * completeness are independent: a failed call may report complete usage without a served model. */
258
+ function withCurrentAgentEvidence(source, costLedger, stableCostTags) {
259
+ const callIds = new Set(source.costCallIds ?? []);
239
260
  const receipts = costLedger.list({
240
261
  channel: "agent",
241
262
  tags: stableCostTags
242
- }).filter((receipt) => cachedCallIds.has(receipt.callId));
243
- const cell = { ...cached };
263
+ }).filter((receipt) => callIds.has(receipt.callId));
264
+ const cell = { ...source };
244
265
  delete cell.resolvedModel;
245
266
  delete cell.resolvedModels;
267
+ if (receipts.length === 0) {
268
+ cell.tokenUsage = {
269
+ ...cell.tokenUsage,
270
+ tokensKnown: false
271
+ };
272
+ if (cell.costProvenance.kind === "observed" && cell.costUsd === 0) cell.costProvenance = {
273
+ kind: "uncaptured",
274
+ usd: null
275
+ };
276
+ }
246
277
  return Object.assign(cell, modelEvidenceFromReceipts(receipts));
247
278
  }
248
279
  function cachedCellReceiptProblem(cached, costLedger, stableCostTags) {
249
- const reportsPaidActivity = cached.costProvenance.kind !== "observed" || cached.costUsd > 0 || cached.tokenUsage.input > 0 || cached.tokenUsage.output > 0;
280
+ const unmetered = cached.costCallIds?.length === 0 && cached.costProvenance.kind === "uncaptured" && cached.tokenUsage.tokensKnown === false && cached.costUsd === 0 && cached.tokenUsage.input === 0 && cached.tokenUsage.output === 0;
281
+ const reportsPaidActivity = cached.costProvenance.kind !== "observed" && !unmetered || cached.costUsd > 0 || cached.tokenUsage.input > 0 || cached.tokenUsage.output > 0;
250
282
  if (cached.costCallIds === void 0) {
251
283
  if (reportsPaidActivity || Object.keys(cached.judgeScores).length > 0) return "does not identify its ledger receipts";
252
284
  return;
@@ -357,7 +389,7 @@ function reuseCachedCell(args, cachePath, stableCostTags) {
357
389
  if (cached.status === "hit" && (!cached.cell.error || args.opts.reuseFailedCells)) {
358
390
  const receiptProblem = cachedCellReceiptProblem(cached.cell, args.costLedger, stableCostTags);
359
391
  if (receiptProblem === void 0) {
360
- const cell = withCurrentAgentModelEvidence(cached.cell, args.costLedger, stableCostTags);
392
+ const cell = withCurrentAgentEvidence(cached.cell, args.costLedger, stableCostTags);
361
393
  enforceDispatchUsage(cell, args.opts.expectUsage ?? "warn");
362
394
  return {
363
395
  cell: {
@@ -540,12 +572,8 @@ async function awaitCellShutdown(args, run, dispatched, costTags) {
540
572
  throw new CostAccountingIncompleteError(`paid calls for cell '${args.slot.cellId}' did not settle within ${args.dispatchShutdownTimeoutMs}ms; no campaign result was produced`);
541
573
  }
542
574
  }
543
- /** The agent spend of this attempt: cost, token usage and the models that served it. */
575
+ /** The agent spend of this attempt, as reported by the canonical ledger summary. */
544
576
  function measureAgentUsage(args, costTags) {
545
- const agentReceipts = args.costLedger.list({
546
- channel: "agent",
547
- tags: costTags
548
- });
549
577
  const agentCost = args.costLedger.summary({
550
578
  channel: "agent",
551
579
  tags: costTags
@@ -559,8 +587,7 @@ function measureAgentUsage(args, costTags) {
559
587
  ...agentCost.reasoningTokens !== void 0 && agentCost.reasoningTokens > 0 ? { reasoning: agentCost.reasoningTokens } : {},
560
588
  ...agentCost.cachedTokens > 0 ? { cached: agentCost.cachedTokens } : {},
561
589
  ...agentCost.cacheWriteTokens !== void 0 && agentCost.cacheWriteTokens > 0 ? { cacheWrite: agentCost.cacheWriteTokens } : {}
562
- },
563
- agentModelEvidence: modelEvidenceFromReceipts(agentReceipts)
590
+ }
564
591
  };
565
592
  }
566
593
  /**
@@ -652,7 +679,7 @@ async function executeCell(args) {
652
679
  const dispatch = await dispatchCell(args, run);
653
680
  await awaitCellShutdown(args, run, dispatch.dispatched, costTags);
654
681
  const { artifact } = dispatch;
655
- const { agentCost, tokenUsage, agentModelEvidence } = measureAgentUsage(args, costTags);
682
+ const { agentCost, tokenUsage } = measureAgentUsage(args, costTags);
656
683
  try {
657
684
  enforceDispatchUsage({
658
685
  cellId: args.slot.cellId,
@@ -677,7 +704,7 @@ async function executeCell(args) {
677
704
  timeoutMs: args.dispatchShutdownTimeoutMs
678
705
  });
679
706
  const costCallIds = args.costLedger.list({ tags: costTags }).map((receipt) => receipt.callId).sort();
680
- const cell = {
707
+ const cell = withCurrentAgentEvidence({
681
708
  manifestHash: args.manifestHash,
682
709
  attempt,
683
710
  cellId: args.slot.cellId,
@@ -690,7 +717,6 @@ async function executeCell(args) {
690
717
  costProvenance: agentCost.costProvenance,
691
718
  costCallIds,
692
719
  tokenUsage,
693
- ...agentModelEvidence,
694
720
  durationMs: Date.now() - startMs,
695
721
  seed: args.slot.cellSeed,
696
722
  cached: false,
@@ -698,7 +724,7 @@ async function executeCell(args) {
698
724
  ...failure ? { errorStage: failure.stage } : {},
699
725
  ...failure?.judge ? { errorJudge: failure.judge } : {},
700
726
  error: errorMessage
701
- };
727
+ }, args.costLedger, costTags);
702
728
  let retry = failure ? recordCellFailure(args, run, failure, cell, costTags, fatalCellError) : false;
703
729
  await trace.flush();
704
730
  const resultPath = join(attemptDir, "result.json");
@@ -6017,4 +6043,4 @@ function firstString(value) {
6017
6043
  }
6018
6044
  export { runEval as $, campaignCellSearchResult as A, DEFAULT_RED_TEAM_CORPUS as B, surfaceDiff as C, createSearchHistoryReceipt as D, assertSearchHistoryMatchesState as E, uniform as F, runCanaries as G, redTeamReport as H, runFinalComparison as I, evaluationUnitMap as J, assertIndependentEvaluationSplit as K, openAutoPr as L, searchProposalExecution as M, searchReceiptAccounting as N, verifySearchHistoryArtifact as O, asha as P, withFinalEvidenceSources as Q, captureJudge as R, searchEdgeId as S, assertSearchHistoryAdmissionOptions as T, scoreRedTeamOutput as U, redTeamDataset as V, Dataset as W, prepareSearchFinalEvidence as X, exposeFinalEvidence as Y, reserveFinalEvidence as Z, crowdedFrontierParent as _, clamp01 as a, cellCachePath as at, SearchRecorder as b, readGepaCandidatePopulationArtifact as c, optimizationTokenUsageFromSummary as d, runCampaign as et, runImprovementLoop as f, beam as g, aide as h, aggregateRunScore as i, buildCellSchedule as it, searchModelIdentity as j, verifySearchHistoryReceipt as k, combineComparisonCosts as l, isProposedCandidate as m, isTransientTransportFailure as n, resolveRunDir as nt, executeOptimizationMethod as o, computeManifestHash as ot, runOptimization as p, captureFinalEvidencePolicy as q, transientDispatchFailure as r, cellReceiptModels as rt, assertGepaCandidatePopulationSummary as s, llmJudge as t, planCampaignRun as tt, costFromLedgerSummary as u, incumbent as v, surfaceNode as w, developmentClaim as x, incumbentWithOperatorBandit as y, defaultProductionGate as z };
6019
6045
 
6020
- //# sourceMappingURL=llm-judge-C5pZ7DSS.js.map
6046
+ //# sourceMappingURL=llm-judge-lUQCBY1e.js.map