@tangle-network/agent-eval 1.0.37 → 1.0.38

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 (65) hide show
  1. package/CHANGELOG.md +9 -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 +1 -1
  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-BU6bJNvu.js} +4 -27
  13. package/dist/campaign-BU6bJNvu.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 +3 -3
  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/{define-agent-eval-DOB58LaZ.d.ts → define-agent-eval-4KGwzIVt.d.ts} +5 -5
  20. package/dist/{define-agent-eval-DOB58LaZ.d.ts.map → define-agent-eval-4KGwzIVt.d.ts.map} +1 -1
  21. package/dist/{define-agent-eval-Db2cZJjC.js → define-agent-eval-BeLMK-OM.js} +2 -2
  22. package/dist/{define-agent-eval-Db2cZJjC.js.map → define-agent-eval-BeLMK-OM.js.map} +1 -1
  23. package/dist/{evaluation-DJqWiVkb.d.ts → evaluation-CQ-uAbqF.d.ts} +2 -2
  24. package/dist/{evaluation-DJqWiVkb.d.ts.map → evaluation-CQ-uAbqF.d.ts.map} +1 -1
  25. package/dist/evaluation.d.ts +1 -1
  26. package/dist/experiment/index.d.ts +1 -1
  27. package/dist/{index-BEAzBo4U.d.ts → index-Bhc7H9e0.d.ts} +2 -2
  28. package/dist/{index-BEAzBo4U.d.ts.map → index-Bhc7H9e0.d.ts.map} +1 -1
  29. package/dist/{index-D5_Srjot.d.ts → index-BsTGJf2M.d.ts} +10 -10
  30. package/dist/{index-D5_Srjot.d.ts.map → index-BsTGJf2M.d.ts.map} +1 -1
  31. package/dist/{index-BOm81bra.d.ts → index-CzEGCOWM.d.ts} +6 -6
  32. package/dist/{index-BOm81bra.d.ts.map → index-CzEGCOWM.d.ts.map} +1 -1
  33. package/dist/{index-DX0t5hA_.d.ts → index-OvU1UXKC.d.ts} +4 -4
  34. package/dist/{index-DX0t5hA_.d.ts.map → index-OvU1UXKC.d.ts.map} +1 -1
  35. package/dist/{index-CDEe3TyM.d.ts → index-RBV2Y-7X.d.ts} +2 -2
  36. package/dist/{index-CDEe3TyM.d.ts.map → index-RBV2Y-7X.d.ts.map} +1 -1
  37. package/dist/index.d.ts +10 -10
  38. package/dist/index.js +2 -2
  39. package/dist/{llm-judge-C5pZ7DSS.js → llm-judge-BBHrAlcE.js} +25 -18
  40. package/dist/llm-judge-BBHrAlcE.js.map +1 -0
  41. package/dist/{matrix-C5hfz5wA.d.ts → matrix-BKzNwIWb.d.ts} +2 -2
  42. package/dist/{matrix-C5hfz5wA.d.ts.map → matrix-BKzNwIWb.d.ts.map} +1 -1
  43. package/dist/multishot/golden/index.d.ts +1 -1
  44. package/dist/multishot/index.d.ts +2 -2
  45. package/dist/openapi.json +1 -1
  46. package/dist/rl.d.ts +1 -1
  47. package/dist/rollout/index.d.ts +2 -2
  48. package/dist/search/index.d.ts +2 -2
  49. package/dist/{search-kernel-VeoTiwiJ.d.ts → search-kernel-DRHWY35J.d.ts} +2 -2
  50. package/dist/{search-kernel-VeoTiwiJ.d.ts.map → search-kernel-DRHWY35J.d.ts.map} +1 -1
  51. package/dist/{skillopt-optimization-method-CH9roCBs.js → skillopt-optimization-method-BmfnAzG4.js} +2 -2
  52. package/dist/{skillopt-optimization-method-CH9roCBs.js.map → skillopt-optimization-method-BmfnAzG4.js.map} +1 -1
  53. package/dist/{statistical-heldout-Bk9mrEoz.d.ts → statistical-heldout-RmdXoz2e.d.ts} +2 -2
  54. package/dist/{statistical-heldout-Bk9mrEoz.d.ts.map → statistical-heldout-RmdXoz2e.d.ts.map} +1 -1
  55. package/dist/{systemone-BCtHGtds.d.ts → systemone-B_3Vd395.d.ts} +3 -3
  56. package/dist/{systemone-BCtHGtds.d.ts.map → systemone-B_3Vd395.d.ts.map} +1 -1
  57. package/dist/systemone.d.ts +2 -2
  58. package/dist/{types-D7X941FU.d.ts → types-ClDpBoLt.d.ts} +2 -2
  59. package/dist/{types-D7X941FU.d.ts.map → types-ClDpBoLt.d.ts.map} +1 -1
  60. package/dist/{types-Bq8xZKCQ.d.ts → types-DGqGbNY4.d.ts} +3 -2
  61. package/dist/{types-Bq8xZKCQ.d.ts.map → types-DGqGbNY4.d.ts.map} +1 -1
  62. package/docs/concepts.md +3 -0
  63. package/package.json +1 -1
  64. package/dist/campaign-DJciOYZ6.js.map +0 -1
  65. package/dist/llm-judge-C5pZ7DSS.js.map +0 -1
@@ -234,19 +234,32 @@ function cellReceiptModels(cell) {
234
234
  const reported = cell.resolvedModels ?? (cell.resolvedModel ? [cell.resolvedModel] : []);
235
235
  return [...new Set(reported.map((model) => model.trim()).filter(Boolean))];
236
236
  }
237
- function withCurrentAgentModelEvidence(cached, costLedger, stableCostTags) {
238
- const cachedCallIds = new Set(cached.costCallIds ?? []);
237
+ /** Reconcile a live or resumed cell with its agent receipts. Model identity and accounting
238
+ * completeness are independent: a failed call may report complete usage without a served model. */
239
+ function withCurrentAgentEvidence(source, costLedger, stableCostTags) {
240
+ const callIds = new Set(source.costCallIds ?? []);
239
241
  const receipts = costLedger.list({
240
242
  channel: "agent",
241
243
  tags: stableCostTags
242
- }).filter((receipt) => cachedCallIds.has(receipt.callId));
243
- const cell = { ...cached };
244
+ }).filter((receipt) => callIds.has(receipt.callId));
245
+ const cell = { ...source };
244
246
  delete cell.resolvedModel;
245
247
  delete cell.resolvedModels;
248
+ if (cell.error !== void 0 && receipts.length === 0) {
249
+ cell.tokenUsage = {
250
+ ...cell.tokenUsage,
251
+ tokensKnown: false
252
+ };
253
+ if (cell.costProvenance.kind === "observed" && cell.costUsd === 0) cell.costProvenance = {
254
+ kind: "uncaptured",
255
+ usd: null
256
+ };
257
+ }
246
258
  return Object.assign(cell, modelEvidenceFromReceipts(receipts));
247
259
  }
248
260
  function cachedCellReceiptProblem(cached, costLedger, stableCostTags) {
249
- const reportsPaidActivity = cached.costProvenance.kind !== "observed" || cached.costUsd > 0 || cached.tokenUsage.input > 0 || cached.tokenUsage.output > 0;
261
+ const unmeteredFailure = cached.error !== void 0 && cached.costCallIds?.length === 0 && cached.costProvenance.kind === "uncaptured" && cached.tokenUsage.tokensKnown === false && cached.costUsd === 0 && cached.tokenUsage.input === 0 && cached.tokenUsage.output === 0;
262
+ const reportsPaidActivity = cached.costProvenance.kind !== "observed" && !unmeteredFailure || cached.costUsd > 0 || cached.tokenUsage.input > 0 || cached.tokenUsage.output > 0;
250
263
  if (cached.costCallIds === void 0) {
251
264
  if (reportsPaidActivity || Object.keys(cached.judgeScores).length > 0) return "does not identify its ledger receipts";
252
265
  return;
@@ -357,7 +370,7 @@ function reuseCachedCell(args, cachePath, stableCostTags) {
357
370
  if (cached.status === "hit" && (!cached.cell.error || args.opts.reuseFailedCells)) {
358
371
  const receiptProblem = cachedCellReceiptProblem(cached.cell, args.costLedger, stableCostTags);
359
372
  if (receiptProblem === void 0) {
360
- const cell = withCurrentAgentModelEvidence(cached.cell, args.costLedger, stableCostTags);
373
+ const cell = withCurrentAgentEvidence(cached.cell, args.costLedger, stableCostTags);
361
374
  enforceDispatchUsage(cell, args.opts.expectUsage ?? "warn");
362
375
  return {
363
376
  cell: {
@@ -540,12 +553,8 @@ async function awaitCellShutdown(args, run, dispatched, costTags) {
540
553
  throw new CostAccountingIncompleteError(`paid calls for cell '${args.slot.cellId}' did not settle within ${args.dispatchShutdownTimeoutMs}ms; no campaign result was produced`);
541
554
  }
542
555
  }
543
- /** The agent spend of this attempt: cost, token usage and the models that served it. */
556
+ /** The agent spend of this attempt, as reported by the canonical ledger summary. */
544
557
  function measureAgentUsage(args, costTags) {
545
- const agentReceipts = args.costLedger.list({
546
- channel: "agent",
547
- tags: costTags
548
- });
549
558
  const agentCost = args.costLedger.summary({
550
559
  channel: "agent",
551
560
  tags: costTags
@@ -559,8 +568,7 @@ function measureAgentUsage(args, costTags) {
559
568
  ...agentCost.reasoningTokens !== void 0 && agentCost.reasoningTokens > 0 ? { reasoning: agentCost.reasoningTokens } : {},
560
569
  ...agentCost.cachedTokens > 0 ? { cached: agentCost.cachedTokens } : {},
561
570
  ...agentCost.cacheWriteTokens !== void 0 && agentCost.cacheWriteTokens > 0 ? { cacheWrite: agentCost.cacheWriteTokens } : {}
562
- },
563
- agentModelEvidence: modelEvidenceFromReceipts(agentReceipts)
571
+ }
564
572
  };
565
573
  }
566
574
  /**
@@ -652,7 +660,7 @@ async function executeCell(args) {
652
660
  const dispatch = await dispatchCell(args, run);
653
661
  await awaitCellShutdown(args, run, dispatch.dispatched, costTags);
654
662
  const { artifact } = dispatch;
655
- const { agentCost, tokenUsage, agentModelEvidence } = measureAgentUsage(args, costTags);
663
+ const { agentCost, tokenUsage } = measureAgentUsage(args, costTags);
656
664
  try {
657
665
  enforceDispatchUsage({
658
666
  cellId: args.slot.cellId,
@@ -677,7 +685,7 @@ async function executeCell(args) {
677
685
  timeoutMs: args.dispatchShutdownTimeoutMs
678
686
  });
679
687
  const costCallIds = args.costLedger.list({ tags: costTags }).map((receipt) => receipt.callId).sort();
680
- const cell = {
688
+ const cell = withCurrentAgentEvidence({
681
689
  manifestHash: args.manifestHash,
682
690
  attempt,
683
691
  cellId: args.slot.cellId,
@@ -690,7 +698,6 @@ async function executeCell(args) {
690
698
  costProvenance: agentCost.costProvenance,
691
699
  costCallIds,
692
700
  tokenUsage,
693
- ...agentModelEvidence,
694
701
  durationMs: Date.now() - startMs,
695
702
  seed: args.slot.cellSeed,
696
703
  cached: false,
@@ -698,7 +705,7 @@ async function executeCell(args) {
698
705
  ...failure ? { errorStage: failure.stage } : {},
699
706
  ...failure?.judge ? { errorJudge: failure.judge } : {},
700
707
  error: errorMessage
701
- };
708
+ }, args.costLedger, costTags);
702
709
  let retry = failure ? recordCellFailure(args, run, failure, cell, costTags, fatalCellError) : false;
703
710
  await trace.flush();
704
711
  const resultPath = join(attemptDir, "result.json");
@@ -6017,4 +6024,4 @@ function firstString(value) {
6017
6024
  }
6018
6025
  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
6026
 
6020
- //# sourceMappingURL=llm-judge-C5pZ7DSS.js.map
6027
+ //# sourceMappingURL=llm-judge-BBHrAlcE.js.map