@tangle-network/agent-eval 0.189.0 → 0.190.1

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 (146) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +3 -2
  3. package/dist/adapters/http.d.ts +10 -1
  4. package/dist/adapters/http.d.ts.map +1 -1
  5. package/dist/adapters/http.js +75 -7
  6. package/dist/adapters/http.js.map +1 -1
  7. package/dist/analyst/index.d.ts +66 -3
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +212 -7
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/{benchmark-command-BhhAYstU.js → benchmark-command-BXIr_k8D.js} +12 -11
  12. package/dist/benchmark-command-BXIr_k8D.js.map +1 -0
  13. package/dist/benchmarks/index.d.ts +1 -1
  14. package/dist/benchmarks/index.js +3 -3
  15. package/dist/campaign/index.d.ts +4 -4
  16. package/dist/campaign/index.js +7 -7
  17. package/dist/{campaign-BWoSQPSU.js → campaign-B7q74uIh.js} +256 -11
  18. package/dist/campaign-B7q74uIh.js.map +1 -0
  19. package/dist/{campaign-evidence-CBlGJ3kC.js → campaign-evidence-D40-LHIL.js} +6 -5
  20. package/dist/campaign-evidence-D40-LHIL.js.map +1 -0
  21. package/dist/{chat-client-C4dg7Ng_.js → chat-client-B_ItsSBw.js} +2 -2
  22. package/dist/{chat-client-C4dg7Ng_.js.map → chat-client-B_ItsSBw.js.map} +1 -1
  23. package/dist/{chat-json-call-JVGbfx95.js → chat-json-call-CXHBvUz8.js} +2 -2
  24. package/dist/{chat-json-call-JVGbfx95.js.map → chat-json-call-CXHBvUz8.js.map} +1 -1
  25. package/dist/claim-BGOUqoMq.d.ts +38 -0
  26. package/dist/claim-BGOUqoMq.d.ts.map +1 -0
  27. package/dist/cli.js +3 -3
  28. package/dist/contract/index.d.ts +4 -4
  29. package/dist/contract/index.js +8 -8
  30. package/dist/{default-registry-m2jhbG6Q.js → default-registry-16I-Bxlf.js} +2 -2
  31. package/dist/{default-registry-m2jhbG6Q.js.map → default-registry-16I-Bxlf.js.map} +1 -1
  32. package/dist/{define-agent-eval-98sgUaC1.js → define-agent-eval-DPizhHfy.js} +4 -4
  33. package/dist/{define-agent-eval-98sgUaC1.js.map → define-agent-eval-DPizhHfy.js.map} +1 -1
  34. package/dist/{define-agent-eval-q6890HU4.d.ts → define-agent-eval-DblGedQk.d.ts} +4 -3
  35. package/dist/define-agent-eval-DblGedQk.d.ts.map +1 -0
  36. package/dist/diagnosis/index.d.ts +14 -2
  37. package/dist/diagnosis/index.d.ts.map +1 -1
  38. package/dist/diagnosis/index.js +11 -4
  39. package/dist/diagnosis/index.js.map +1 -1
  40. package/dist/{dspy-rlm-engine-DLYttKBm.js → dspy-rlm-engine-Cs5LzJ-f.js} +3 -3
  41. package/dist/{dspy-rlm-engine-DLYttKBm.js.map → dspy-rlm-engine-Cs5LzJ-f.js.map} +1 -1
  42. package/dist/{eval-campaign-C0Q1Eeo_.js → eval-campaign-CwsBn0Gm.js} +2 -2
  43. package/dist/{eval-campaign-C0Q1Eeo_.js.map → eval-campaign-CwsBn0Gm.js.map} +1 -1
  44. package/dist/experiment/index.d.ts +2 -1
  45. package/dist/experiment/index.d.ts.map +1 -1
  46. package/dist/experiment/index.js +1 -1
  47. package/dist/exporters-XMCYJlqT.d.ts +161 -0
  48. package/dist/exporters-XMCYJlqT.d.ts.map +1 -0
  49. package/dist/{external-optimizer-process-C3quNeKV.js → external-optimizer-process-BnSmrkgL.js} +3 -3
  50. package/dist/{external-optimizer-process-C3quNeKV.js.map → external-optimizer-process-BnSmrkgL.js.map} +1 -1
  51. package/dist/{external-optimizer-subprocess-BDwgKLO1.js → external-optimizer-subprocess-kbcPu5po.js} +3 -3
  52. package/dist/{external-optimizer-subprocess-BDwgKLO1.js.map → external-optimizer-subprocess-kbcPu5po.js.map} +1 -1
  53. package/dist/{feedback-trajectory-B3ZSkfAq.d.ts → feedback-trajectory-BYjh7NEM.d.ts} +2 -2
  54. package/dist/{feedback-trajectory-B3ZSkfAq.d.ts.map → feedback-trajectory-BYjh7NEM.d.ts.map} +1 -1
  55. package/dist/{index-CnJOPR_E.d.ts → index-CJv56rhX.d.ts} +673 -244
  56. package/dist/index-CJv56rhX.d.ts.map +1 -0
  57. package/dist/{index-Dk1dOUfm.d.ts → index-CWoIJHmy.d.ts} +4 -4
  58. package/dist/{index-Dk1dOUfm.d.ts.map → index-CWoIJHmy.d.ts.map} +1 -1
  59. package/dist/{index-Bcc9PkOz.d.ts → index-D4pC7Tvd.d.ts} +3 -2
  60. package/dist/index-D4pC7Tvd.d.ts.map +1 -0
  61. package/dist/{index-BqDJ6fUK.d.ts → index-I4UJGRno.d.ts} +74 -2
  62. package/dist/index-I4UJGRno.d.ts.map +1 -0
  63. package/dist/index.d.ts +66 -17
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +375 -31
  66. package/dist/index.js.map +1 -1
  67. package/dist/{journal-CDP0Vhx_.js → journal-c3qY0SDP.js} +246 -5
  68. package/dist/journal-c3qY0SDP.js.map +1 -0
  69. package/dist/{kind-factory-BGwN0nE6.js → kind-factory-ByZeXDqF.js} +2 -2
  70. package/dist/{kind-factory-BGwN0nE6.js.map → kind-factory-ByZeXDqF.js.map} +1 -1
  71. package/dist/ledger-core/index.d.ts +2 -2
  72. package/dist/ledger-core/index.js +2 -2
  73. package/dist/{llm-client-DF9bPNYA.js → llm-client-KYQBh9C8.js} +2 -2
  74. package/dist/{llm-client-DF9bPNYA.js.map → llm-client-KYQBh9C8.js.map} +1 -1
  75. package/dist/{llm-judge-M_l_WXw2.js → llm-judge-BnxAv7ed.js} +1892 -1378
  76. package/dist/llm-judge-BnxAv7ed.js.map +1 -0
  77. package/dist/mint-C9Lojt1V.d.ts +147 -0
  78. package/dist/mint-C9Lojt1V.d.ts.map +1 -0
  79. package/dist/openapi.json +1 -1
  80. package/dist/pipelines/index.d.ts +1 -1
  81. package/dist/pipelines/index.js +1 -1
  82. package/dist/pipelines/index.js.map +1 -1
  83. package/dist/{produced-state-BOY98IJO.js → produced-state-BXjXJHJT.js} +4 -4
  84. package/dist/{produced-state-BOY98IJO.js.map → produced-state-BXjXJHJT.js.map} +1 -1
  85. package/dist/{raw-provider-sink-C96CcqeG.js → raw-provider-sink-DYh4Bszw.js} +2 -2
  86. package/dist/{raw-provider-sink-C96CcqeG.js.map → raw-provider-sink-DYh4Bszw.js.map} +1 -1
  87. package/dist/{redact-DxwlUAvh.js → redact-B7rt9Zot.js} +130 -10
  88. package/dist/redact-B7rt9Zot.js.map +1 -0
  89. package/dist/{redact-DPoH1-OW.d.ts → redact-CopuMxll.d.ts} +7 -5
  90. package/dist/redact-CopuMxll.d.ts.map +1 -0
  91. package/dist/rl.d.ts +3 -2
  92. package/dist/rl.d.ts.map +1 -1
  93. package/dist/rl.js +1 -1
  94. package/dist/rollout/index.d.ts +3 -2
  95. package/dist/search-ledger-types-C9anU2DX.d.ts +489 -0
  96. package/dist/search-ledger-types-C9anU2DX.d.ts.map +1 -0
  97. package/dist/{semantic-concept-judge-Cm2K2wAo.js → semantic-concept-judge-ClB73cei.js} +6 -6
  98. package/dist/{semantic-concept-judge-Cm2K2wAo.js.map → semantic-concept-judge-ClB73cei.js.map} +1 -1
  99. package/dist/{server-C8XvqCg8.js → server-DtetGGoA.js} +2 -2
  100. package/dist/{server-C8XvqCg8.js.map → server-DtetGGoA.js.map} +1 -1
  101. package/dist/{skillopt-optimization-method-BVSB676o.js → skillopt-optimization-method-l2vDBtKp.js} +363 -18
  102. package/dist/skillopt-optimization-method-l2vDBtKp.js.map +1 -0
  103. package/dist/{spans-W0o8pbEg.d.ts → spans-BWtjk_9c.d.ts} +2 -2
  104. package/dist/{spans-W0o8pbEg.d.ts.map → spans-BWtjk_9c.d.ts.map} +1 -1
  105. package/dist/{statistical-heldout-plAHG82H.d.ts → statistical-heldout-CLpjYffJ.d.ts} +2 -36
  106. package/dist/statistical-heldout-CLpjYffJ.d.ts.map +1 -0
  107. package/dist/{store-otlp-D0AV4cvB.js → store-otlp-84DH0OEH.js} +2 -2
  108. package/dist/{store-otlp-D0AV4cvB.js.map → store-otlp-84DH0OEH.js.map} +1 -1
  109. package/dist/{store-tool-spans-8PAyhRqb.d.ts → store-tool-spans-BBXs8hDP.d.ts} +2 -2
  110. package/dist/{store-tool-spans-8PAyhRqb.d.ts.map → store-tool-spans-BBXs8hDP.d.ts.map} +1 -1
  111. package/dist/{store-tool-spans-B_0mXvYl.js → store-tool-spans-DUiqyHvR.js} +5 -5
  112. package/dist/{store-tool-spans-B_0mXvYl.js.map → store-tool-spans-DUiqyHvR.js.map} +1 -1
  113. package/dist/traces.d.ts +3 -63
  114. package/dist/traces.d.ts.map +1 -1
  115. package/dist/traces.js +6 -195
  116. package/dist/traces.js.map +1 -1
  117. package/dist/wire/index.d.ts +1 -1
  118. package/dist/wire/index.js +1 -1
  119. package/docs/adapters-observability.md +31 -27
  120. package/docs/charter.md +1 -1
  121. package/docs/design/mlbenchmarks-book-review.md +1 -1
  122. package/docs/distributed-driver.md +1 -5
  123. package/docs/experiment.md +15 -0
  124. package/docs/public-api.md +181 -71
  125. package/docs/redaction.md +7 -1
  126. package/docs/search-ledger.md +174 -0
  127. package/docs/trace-contracts.md +48 -3
  128. package/package.json +1 -1
  129. package/dist/benchmark-command-BhhAYstU.js.map +0 -1
  130. package/dist/campaign-BWoSQPSU.js.map +0 -1
  131. package/dist/campaign-evidence-CBlGJ3kC.js.map +0 -1
  132. package/dist/define-agent-eval-q6890HU4.d.ts.map +0 -1
  133. package/dist/index-Bcc9PkOz.d.ts.map +0 -1
  134. package/dist/index-BqDJ6fUK.d.ts.map +0 -1
  135. package/dist/index-CnJOPR_E.d.ts.map +0 -1
  136. package/dist/journal-CDP0Vhx_.js.map +0 -1
  137. package/dist/llm-judge-M_l_WXw2.js.map +0 -1
  138. package/dist/mint-DsS38v5c.d.ts +0 -305
  139. package/dist/mint-DsS38v5c.d.ts.map +0 -1
  140. package/dist/redact-DPoH1-OW.d.ts.map +0 -1
  141. package/dist/redact-DxwlUAvh.js.map +0 -1
  142. package/dist/search-ledger-types-D7KDVg-o.d.ts +0 -302
  143. package/dist/search-ledger-types-D7KDVg-o.d.ts.map +0 -1
  144. package/dist/skillopt-optimization-method-BVSB676o.js.map +0 -1
  145. package/dist/statistical-heldout-plAHG82H.d.ts.map +0 -1
  146. package/docs/search-history-receipts.md +0 -233
@@ -1,233 +0,0 @@
1
- # Complete optimization search history
2
-
3
- A selected prompt, profile, or patch is not a record of the search that produced it. A trustworthy optimizer must account for what it planned, tried, failed to run, rejected, and left unresolved before its winner is evaluated on untouched final cases.
4
-
5
- Eval already has one rich source of truth for that process: `SearchLedger`. This feature does not add another event log.
6
-
7
- ```text
8
- SearchLedger JSONL canonical facts and rich evidence
9
- │
10
- ├── hash chain mutation and truncation detection
11
- ├── replay audit planned denominator and unresolved work
12
- └── SearchHistoryReceipt bounded proof envelope
13
- │
14
- └── compareOptimizationMethods({
15
- searchHistoryPolicy: 'require-complete'
16
- })
17
- ```
18
-
19
- ## ELI5
20
-
21
- `SearchLedger` is the sealed laboratory notebook. `SearchHistoryReceipt` is the small signed cover sheet saying which notebook, which run, and whether the notebook accounts for the whole planned experiment.
22
-
23
- The cover sheet does not copy every page. To inspect a candidate, failed attempt, missing task id, decision, or accounting gap, open the notebook.
24
-
25
- ## What the receipt contains
26
-
27
- The receipt is bounded by the contract rather than by search length. It carries:
28
-
29
- - the producer and concrete run identity;
30
- - a content-addressed reference to the canonical ledger bytes;
31
- - the digest of the exact replay audit;
32
- - counts and terminal state needed to classify completeness;
33
- - short, count-based incompleteness reasons;
34
- - its own RFC 8785 SHA-256 digest.
35
-
36
- It does not carry event arrays, candidate inventories, attempt records, decisions, or lists of every missing id. Those remain in `SearchLedgerReplay`.
37
-
38
- ## Create a receipt
39
-
40
- Create receipts only from the result returned by `SearchLedger.replay()`:
41
-
42
- ```ts
43
- import {
44
- createSearchHistoryReceipt,
45
- openSearchLedger,
46
- } from '@tangle-network/agent-eval/campaign'
47
-
48
- const searchLedger = openSearchLedger({
49
- path: '/runs/gepa/search-ledger.jsonl',
50
- campaignId: 'gepa-run-42',
51
- })
52
-
53
- const replay = await searchLedger.replay()
54
- const receipt = createSearchHistoryReceipt({
55
- producerId: 'gepa',
56
- runId: 'gepa-run-42',
57
- ledger: {
58
- role: 'search-ledger',
59
- uri: 'artifact://gepa-run-42/search-ledger.jsonl',
60
- sha256: ledgerArtifactDigest,
61
- byteLength: ledgerArtifactBytes,
62
- },
63
- replay,
64
- })
65
- ```
66
-
67
- First-party optimizers do this for you. Application code should not hand-author receipt JSON.
68
-
69
- ## Record a search from the loop
70
-
71
- `runOptimization()` and `selfImprove()` accept `searchLedger` and return the receipt on `searchHistory`:
72
-
73
- ```ts
74
- import { openSearchLedger, runOptimization } from '@tangle-network/agent-eval/campaign'
75
-
76
- const result = await runOptimization({
77
- // ...scenarios, dispatchWithSurface, judges, proposer, populationSize, maxGenerations, runDir
78
- searchLedger: {
79
- ledger: openSearchLedger({ path: `${runDir}/search-ledger.jsonl`, campaignId: runId }),
80
- identity: {
81
- agent: { uri: 'git+https://github.com/acme/agent.git', revision: agentCommit },
82
- proposer: { kind: 'deterministic', source: { uri: proposerUri, revision: proposerCommit } },
83
- search: { uri: searchUri, revision: searchCommit },
84
- model: { provider: 'openai', snapshot: 'gpt-5.4@2026-06-01' },
85
- },
86
- },
87
- })
88
- ```
89
-
90
- The loop emits the plan, one candidate-generation operation per generation, one registration per candidate with the exact parent it mutated, one task attempt per designed cell, one decision per candidate, and the terminal event.
91
-
92
- `identity` carries what the ledger requires and a campaign cannot infer: immutable revisions for the agent, proposer, and search implementations, plus the model the agent runs. A measured value wins wherever execution reported one; a cell that ran a moving model alias is refused rather than recorded as an immutable identity.
93
-
94
- `gepaOptimizationMethod({ searchLedger: { identity } })` records GEPA's own candidate population into the same ledger, so a comparison under `require-complete` accepts it.
95
-
96
- ## Extend a plan for a rolling search
97
-
98
- A search whose length is not known when it starts appends `search-plan-extended` with the extra candidate slots and operations.
99
- The first plan event stays first, the effective plan is the merge, and the generation invariant continues across rounds: a candidate whose parent is a round-one candidate is generation 2, not a restarted 0.
100
-
101
- The planned task denominator does not extend. Extending it would reopen candidates that already closed their tasks.
102
-
103
- A search still uses one ledger. A parent from an earlier ledger enters as a generation-0 `candidate-registered` whose surface artifact references the prior ledger, because a cross-file parent cannot be replayed and verified from these bytes.
104
-
105
- ## Complete means the planned denominator is closed
106
-
107
- A receipt is complete only when canonical replay reports:
108
-
109
- - a search plan;
110
- - a terminal `search-completed` event;
111
- - no unresolved candidate slots;
112
- - no missing planned task outcomes;
113
- - no missing planned operations;
114
- - no pending candidate decisions;
115
- - a terminal status of `selected` or `all-rejected`.
116
-
117
- A first-party recorder appends the terminal event only when replay already accounts for the whole planned denominator. An interrupted run, or a candidate that left a designed cell unscored, stays `in-progress` and reports the exact gap.
118
-
119
- Cost completeness remains a separate contract. Unknown spend stays unknown; it is never converted into zero merely because search history is complete.
120
-
121
- ## Compare methods without exposing final cases
122
-
123
- Existing callers remain compatible. Missing history is reported:
124
-
125
- ```ts
126
- const comparison = await compareOptimizationMethods({
127
- methods,
128
- trainScenarios,
129
- selectionScenarios,
130
- testScenarios,
131
- // existing options
132
- })
133
-
134
- console.log(comparison.searchHistory)
135
- ```
136
-
137
- Autonomous or publication-grade callers fail closed:
138
-
139
- ```ts
140
- const comparison = await compareOptimizationMethods({
141
- methods,
142
- trainScenarios,
143
- selectionScenarios,
144
- testScenarios,
145
- searchHistoryPolicy: 'require-complete',
146
- // existing options
147
- })
148
- ```
149
-
150
- `selfImprove({ method })` accepts the same `searchHistoryPolicy` and `searchHistoryVerification` options.
151
- Both workflows use the same method preparation, result validation, cost reconciliation, and history admission.
152
- `selfImprove` returns `searchHistoryCoverage`; comparison returns coverage for every method.
153
- The default remains `allow-missing` with receipt verification.
154
-
155
- ### Verify referenced history before final assessment
156
-
157
- Set `searchHistoryVerification: 'ledger'` to require the referenced bytes, even with `allow-missing`.
158
- Combine it with `require-complete` to require both verified bytes and complete history.
159
-
160
- ```ts
161
- const comparison = await compareOptimizationMethods({
162
- // ...methods, partitions, dispatch, judges, runDir
163
- searchHistoryPolicy: 'require-complete',
164
- searchHistoryVerification: 'ledger',
165
- storage,
166
- })
167
- ```
168
-
169
- Eval reads the receipt URI through `storage.read`.
170
- A `file:` URI becomes a local path; other URIs remain opaque storage keys.
171
- A custom `CampaignStorage` can resolve retained artifacts without another ledger implementation.
172
- Missing bytes, length or digest mismatches, invalid chains, and replay discrepancies refuse final dispatch.
173
- A verified coverage row carries `ledgerVerified: true`.
174
- Receipt-only coverage does not make that claim.
175
-
176
- Existing search recorders compute `ledger.sha256` with `hashCanonical` over the complete JSONL string.
177
- It hashes that string's canonical JSON encoding, rather than the raw UTF-8 file.
178
- Verification preserves this existing identity scheme.
179
- `byteLength` measures the UTF-8 JSONL bytes.
180
-
181
- Every method finishes optimization before the first untouched-final-test dispatch. Under `require-complete`, missing, malformed, producer-mismatched, interrupted, or denominator-incomplete evidence aborts at that boundary.
182
-
183
- ## Verification boundary
184
-
185
- `verifySearchHistoryReceipt()` verifies the bounded envelope and its canonical digest.
186
-
187
- `assertSearchHistoryMatchesReplay()` additionally proves that the envelope was derived from the supplied canonical replay.
188
-
189
- `verifySearchHistoryArtifact(receipt, storage)` resolves bytes and runs both checks through the canonical journal codec.
190
- The two receipt-only functions do not fetch or retain the ledger artifact. A skeptical consumer must resolve `receipt.ledger`, verify its digest and byte length, replay it with `SearchLedger`, and then call `assertSearchHistoryMatchesReplay()`.
191
-
192
- The receipt does not prove that:
193
-
194
- - the optimizer searched intelligently;
195
- - a candidate is correct, safe, or novel;
196
- - the winner generalizes;
197
- - an external source identity is honest;
198
- - knowledge caused an improvement;
199
- - the artifact URI will remain available.
200
-
201
- Those claims require held-out evaluation, artifact retention, provenance verification, knowledge-use evidence, and causal experiments.
202
-
203
- ## Ownership
204
-
205
- - **Eval** owns search evidence, completeness, held-out comparison, statistics, and release decisions.
206
- - **Runtime** owns execution, checkpoints, cancellation, and resume orchestration while referencing Eval evidence.
207
- - **Knowledge** owns what information was visible, retrieved, and selected for use.
208
- - **Interface** owns portable profiles, diffs, identities, and digest primitives.
209
- - **SDKs** should automate these owner contracts, not copy their types or introduce another optimizer loop.
210
-
211
- ## Bind final measurements to execution evidence
212
-
213
- Both complete-method workflows accept optional `evidence: CampaignEvidenceContext`.
214
- It requires the caller's pursuit, evaluator, environment, authority, and attestation provenance.
215
- Eval does not infer independent authority or certify those external declarations.
216
-
217
- Each measured baseline and winner receives the existing `EvidenceReceipt` format.
218
- Eval derives candidate, input-set, output, and result digests from the executed surface and complete campaign.
219
- A missing or deferred final measurement cannot produce a receipt.
220
- Receipts describe measurements; they do not override the release gate or replace the method's selected winner.
221
-
222
- `createCampaignEvidenceReceipt` on `/experiment` provides the same binding for other complete campaign consumers.
223
- Changing an output changes its output digest; changing a judge result changes its measurement digest.
224
- The final receipt retains caller authority, including `candidate-self-report`, without upgrading it.
225
-
226
- ## Implementation ownership
227
-
228
- `src/campaign/search-ledger.ts` owns validation, canonical event normalization, and composition with the shared ledger journal.
229
- `search-ledger-projector.ts` owns campaign replay invariants and audit projection.
230
- `search-ledger-types.ts` defines the shared data contracts, reexported through the existing facade.
231
- `search-ledger-ordering.ts` shares artifact identity and deterministic string ordering between normalization and replay.
232
- The journal in `src/ledger-core` owns hashing, locking, durable appends, and chain verification.
233
- An open journal verifies its whole file once, then each append checks that its verified head row is still in place and reads only the rows past it, so an append costs one entry's bytes at any ledger length.