@tangle-network/agent-eval 0.142.2 → 0.144.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +42 -8
  3. package/dist/analyst/index.d.ts +6 -6
  4. package/dist/analyst/index.d.ts.map +1 -1
  5. package/dist/analyst/index.js +3 -3
  6. package/dist/{benchmark-command-bTf4ibj-.js → benchmark-command-4c7N_rlw.js} +7 -6
  7. package/dist/benchmark-command-4c7N_rlw.js.map +1 -0
  8. package/dist/benchmarks/index.d.ts +1 -1
  9. package/dist/benchmarks/index.js +1 -1
  10. package/dist/{benchmarks-Ce8GdJbc.js → benchmarks-05UGZ8sZ.js} +4 -4
  11. package/dist/{benchmarks-Ce8GdJbc.js.map → benchmarks-05UGZ8sZ.js.map} +1 -1
  12. package/dist/campaign/index.d.ts +5 -4
  13. package/dist/campaign/index.js +4 -4
  14. package/dist/{campaign-COFTVy3Q.js → campaign-BKOtvRAB.js} +15 -11
  15. package/dist/campaign-BKOtvRAB.js.map +1 -0
  16. package/dist/cli.js +1 -1
  17. package/dist/{client-BoqGxEqx.d.ts → client-Cgl6KasJ.d.ts} +2 -2
  18. package/dist/{client-BoqGxEqx.d.ts.map → client-Cgl6KasJ.d.ts.map} +1 -1
  19. package/dist/contract/index.d.ts +5 -5
  20. package/dist/contract/index.js +4 -4
  21. package/dist/{default-registry-Ci7wAAR8.d.ts → default-registry-D3uqKbo6.d.ts} +2 -2
  22. package/dist/{default-registry-Ci7wAAR8.d.ts.map → default-registry-D3uqKbo6.d.ts.map} +1 -1
  23. package/dist/{default-registry-BupFSXSN.js → default-registry-DfHJEwYh.js} +2 -2
  24. package/dist/{default-registry-BupFSXSN.js.map → default-registry-DfHJEwYh.js.map} +1 -1
  25. package/dist/{dspy-rlm-engine-Bw8Zz9CX.js → dspy-rlm-engine-CBFwlyaY.js} +89 -7
  26. package/dist/dspy-rlm-engine-CBFwlyaY.js.map +1 -0
  27. package/dist/external-optimizer-contracts-iK0yu4AR.d.ts +128 -0
  28. package/dist/external-optimizer-contracts-iK0yu4AR.d.ts.map +1 -0
  29. package/dist/hosted/index.d.ts +2 -2
  30. package/dist/{index-BKjcUH13.d.ts → index-BZUe-ODI.d.ts} +41 -5
  31. package/dist/index-BZUe-ODI.d.ts.map +1 -0
  32. package/dist/{index-DCP4I2Qx.d.ts → index-DgbFl4cv.d.ts} +14 -11
  33. package/dist/{index-DCP4I2Qx.d.ts.map → index-DgbFl4cv.d.ts.map} +1 -1
  34. package/dist/{index-CKI1CXTL.d.ts → index-DtMpBKVF.d.ts} +4 -4
  35. package/dist/{index-CKI1CXTL.d.ts.map → index-DtMpBKVF.d.ts.map} +1 -1
  36. package/dist/index.d.ts +11 -11
  37. package/dist/index.js +9 -8
  38. package/dist/index.js.map +1 -1
  39. package/dist/{integrity-hruKe6oe.js → integrity-DY6tIbl0.js} +48 -18
  40. package/dist/integrity-DY6tIbl0.js.map +1 -0
  41. package/dist/multishot/index.d.ts +1 -1
  42. package/dist/openapi.json +1 -1
  43. package/dist/{replay-BqTgoioO.d.ts → replay-BuJM6kLh.d.ts} +2 -2
  44. package/dist/{replay-BqTgoioO.d.ts.map → replay-BuJM6kLh.d.ts.map} +1 -1
  45. package/dist/{reward-hacking-GyN0kMd8.js → reward-hacking-DjTi9HLb.js} +34 -14
  46. package/dist/reward-hacking-DjTi9HLb.js.map +1 -0
  47. package/dist/rl.d.ts +263 -2
  48. package/dist/rl.d.ts.map +1 -1
  49. package/dist/rl.js +332 -3
  50. package/dist/rl.js.map +1 -1
  51. package/dist/{single-run-lock-BcvPQY57.js → single-run-lock-t1si1ob7.js} +371 -153
  52. package/dist/single-run-lock-t1si1ob7.js.map +1 -0
  53. package/dist/{skill-usage-CNZTk_LT.d.ts → skill-usage-BiVEU0QY.d.ts} +5 -5
  54. package/dist/{skill-usage-CNZTk_LT.d.ts.map → skill-usage-BiVEU0QY.d.ts.map} +1 -1
  55. package/dist/{skillopt-optimization-method-D1dqGzzH.d.ts → skillopt-optimization-method-B7o01OdX.d.ts} +63 -13
  56. package/dist/skillopt-optimization-method-B7o01OdX.d.ts.map +1 -0
  57. package/dist/{skillopt-optimization-method-DV6c4ooy.js → skillopt-optimization-method-Ds8J1_K8.js} +440 -270
  58. package/dist/skillopt-optimization-method-Ds8J1_K8.js.map +1 -0
  59. package/dist/supervisor-run/index.d.ts +3 -3
  60. package/dist/supervisor-run/index.js +3 -3
  61. package/dist/{supervisor-run-BEns49Nx.js → supervisor-run-DiyQVczd.js} +301 -25
  62. package/dist/supervisor-run-DiyQVczd.js.map +1 -0
  63. package/dist/{tool-groups-DVQTy9lq.d.ts → tool-groups-Bqy4A3QB.d.ts} +2 -2
  64. package/dist/{tool-groups-DVQTy9lq.d.ts.map → tool-groups-Bqy4A3QB.d.ts.map} +1 -1
  65. package/dist/traces.d.ts +2 -2
  66. package/dist/{types-Dk7PB7vh.d.ts → types-KEqL1pZc.d.ts} +6 -4
  67. package/dist/{types-Dk7PB7vh.d.ts.map → types-KEqL1pZc.d.ts.map} +1 -1
  68. package/dist/{types-Dea6tiVI.d.ts → types-yLK8gXE9.d.ts} +15 -2
  69. package/dist/types-yLK8gXE9.d.ts.map +1 -0
  70. package/docs/campaign-proposers.md +11 -7
  71. package/docs/verified-labels-flywheel.md +46 -0
  72. package/package.json +1 -1
  73. package/dist/benchmark-command-bTf4ibj-.js.map +0 -1
  74. package/dist/campaign-COFTVy3Q.js.map +0 -1
  75. package/dist/dspy-rlm-engine-Bw8Zz9CX.js.map +0 -1
  76. package/dist/external-optimizer-contracts-nb7c_WAR.d.ts +0 -42
  77. package/dist/external-optimizer-contracts-nb7c_WAR.d.ts.map +0 -1
  78. package/dist/index-BKjcUH13.d.ts.map +0 -1
  79. package/dist/integrity-hruKe6oe.js.map +0 -1
  80. package/dist/reward-hacking-GyN0kMd8.js.map +0 -1
  81. package/dist/single-run-lock-BcvPQY57.js.map +0 -1
  82. package/dist/skillopt-optimization-method-D1dqGzzH.d.ts.map +0 -1
  83. package/dist/skillopt-optimization-method-DV6c4ooy.js.map +0 -1
  84. package/dist/supervisor-run-BEns49Nx.js.map +0 -1
  85. package/dist/types-Dea6tiVI.d.ts.map +0 -1
@@ -126,8 +126,10 @@ import {
126
126
 
127
127
  const optimizer = {
128
128
  model: 'gpt-4.1-mini',
129
- baseUrl: 'https://api.openai.com/v1',
130
- apiKey: process.env.OPENAI_API_KEY!,
129
+ // Supplied by the package that owns execution. Discovery derives these
130
+ // from Runtime and one exact AgentProfile.
131
+ call: optimizerExecution.call,
132
+ callRef: optimizerExecution.callRef,
131
133
  budget: {
132
134
  maxCostUsd: 5,
133
135
  maxRequests: 100,
@@ -247,7 +249,8 @@ The `recipe` maps directly to official GEPA operations:
247
249
  | `vote` | Run independent engines and use GEPA's vote composition. |
248
250
  | `omni` | Run official best-of exploration, then continue from its winner. |
249
251
 
250
- Each engine run requires `maxEvaluations` and `maxProposerCostUsd`.
252
+ Each engine run requires `maxEvaluations`.
253
+ `maxProposerCostUsd` is optional and should be supplied only when the execution owner can enforce billed USD.
251
254
  `engineConfig` carries the JSON-safe subset of configuration for the registered GEPA engine.
252
255
  GEPA validates the engine name and those values.
253
256
  Python callables, classes, custom loggers, and callbacks cannot be serialized through this TypeScript bridge.
@@ -255,7 +258,7 @@ For a custom engine, set `engineModules` to public dotted Python modules that ca
255
258
  The optimizer process imports those modules before GEPA resolves the engine name.
256
259
 
257
260
  The standard GEPA engine accepts the official `GEPAConfig` fields.
258
- Give Agent Eval the model, exact endpoint rates, and provider connection separately:
261
+ Give Agent Eval the model, caller-owned execution callback, stable callback identity, and exact endpoint rates only when they are known:
259
262
 
260
263
  ```ts
261
264
  const method = gepaOptimizationMethod({
@@ -272,8 +275,8 @@ const method = gepaOptimizationMethod({
272
275
  },
273
276
  optimizer: {
274
277
  model: 'gpt-4.1-mini',
275
- baseUrl: 'https://api.openai.com/v1',
276
- apiKey: process.env.OPENAI_API_KEY!,
278
+ call: optimizerExecution.call,
279
+ callRef: optimizerExecution.callRef,
277
280
  budget: {
278
281
  maxCostUsd: 8,
279
282
  maxRequests: 100,
@@ -292,8 +295,9 @@ const method = gepaOptimizationMethod({
292
295
  ```
293
296
 
294
297
  Replace the rates with the exact rates charged by your endpoint.
298
+ If billed USD is unknown, omit `maxCostUsd`, `pricing`, and `maxProposerCostUsd`; the recorded cost remains unknown rather than becoming a guessed zero.
295
299
  With `optimizer`, every recipe stage must use the standard `gepa` engine.
296
- Agent Eval keeps the provider key outside Python, enforces the shared model budget, and records exact provider usage.
300
+ Agent Eval receives no provider key, enforces the declared request and token budget, and records the execution owner's exact usage and opaque finite JSON evidence.
297
301
  `maxProposerCostUsd` also limits each individual GEPA engine stage.
298
302
 
299
303
  Other official engines can still receive their own settings:
@@ -0,0 +1,46 @@
1
+ # Verified-labels flywheel — own-traffic replay eligibility (phase-2 spec)
2
+
3
+ Phase 1 shipped the dataset pipeline: `src/rl/verified-findings-dataset.ts` joins replay-verify batch verdicts with gold labels and trajectories into execution-verified RL rows (`agent-eval/verified-finding@0`, see `benchmarks/trace-analysis/verified-dataset-v0/README.md`).
4
+ Those rows came from public benchmark trajectories (mini-SWE / CodeTraceBench).
5
+ The flywheel's real fuel is our own traffic: fleet sessions run inside sandboxes where the image is known.
6
+ This document maps which local session classes are replay-eligible today, which are not and why, and the concrete capture changes that make future sessions eligible.
7
+
8
+ ## What replay eligibility requires
9
+
10
+ Derived from what the run2 replay batch actually consumed (its enumeration excluded 111/133 label entries):
11
+
12
+ 1. **Pinned environment** — a docker image (or digest) the trajectory ran in; `no-docker-image` alone excluded 21 entries.
13
+ 2. **Working directory** — the cwd commands were executed from.
14
+ 3. **Ordered step commands** — the exact action string per step; `no-swe-raw-trajectory` excluded 65 entries.
15
+ 4. **Per-step recorded returncodes** — needed for prefix-divergence checking (the replay batch aborts when >10% of prefix steps diverge from recorded returncodes).
16
+ 5. **A verifiable target step** — a finding/label on a *command* step (submit-only golds excluded 21 entries; findings on prose are not executable).
17
+
18
+ ## Local session stores surveyed (2026-08-03, this host)
19
+
20
+ | store | volume | environment (req 1–2) | steps (req 3) | returncodes (req 4) | eligible today |
21
+ | --- | --- | --- | --- | --- | --- |
22
+ | Claude Code transcripts `~/.claude/projects` | 474 projects, 7,579 session JSONLs, 4.6 GB | no image; `cwd` + `gitBranch` + harness `version` per message | yes — full tool calls + results | **no** — Bash `toolUseResult` records `stdout`/`stderr`/`interrupted` only, no exit code field | no (host env unpinned, no rc) |
23
+ | Codex sessions `~/.codex/sessions` | 4,332 rollout files, 113 GB | no image; `session_meta` has `cwd` + git `commit_hash`/`branch`/`repository_url` + `cli_version` | yes | shell events carry exit codes in payloads (format varies by version) | no (host env unpinned) |
24
+ | traces CLI normalized envelope (`~/code/traces`, 18 harness adapters: claude, codex, amp, gemini, opencode, pi, copilot, factory, forge, qwen, …) | imports the two stores above | `cwd` filter exists; **no image/sandbox field in the envelope** | yes | adapter-dependent | no — the schema itself cannot express environment identity |
25
+ | Sandbox sessions (agent-dev-container `PersistedSession`) | remote fleet; none stored on this host | runtime knows the image — `runtime.ready` event carries `image?` + `sandboxId` + backend — but `PersistedSession` persists only `workspaceRoot` + free-form `metadata`; `image?` is optional even on the event | yes (message store) | via tool parts, not normalized | **almost** — the image is in hand at runtime and dropped at persistence time |
26
+ | mini-SWE / CodeTraceBench benchmark trajectories (`~/bench-cache/ctb-20260801`) | 133 labeled, 22 replayable | yes — `mswebench/*` images + cwd | yes | yes — `<returncode>N</returncode>` in every observation | **yes — the only eligible class; run2 proved 16/22 reproduce** |
27
+
28
+ Conclusion: today only benchmark-imported trajectories are replay-eligible.
29
+ Our own sessions fail on environment pinning (all classes) and returncode capture (Claude Code).
30
+ The sandbox class is one persistence field away from eligibility — the runtime already knows the image.
31
+
32
+ ## Phase-2 capture changes (ranked by unlock per line of code)
33
+
34
+ 1. **Persist the sandbox image at session start** (agent-dev-container): copy `runtime.ready`'s `image` (as a digest, not a tag) + `sandboxId` into `PersistedSession` as first-class fields, and make `image` required on the event.
35
+ This single change makes every future fleet sandbox session satisfy requirements 1–2 — the highest-leverage line in the flywheel.
36
+ 2. **Add environment identity to the traces envelope** (traces repo): an optional `environment: { image?, imageDigest?, cwd, gitCommit? }` block on the normalized session, populated by adapters where known.
37
+ Without it, eligible sandbox sessions lose their eligibility at import time.
38
+ 3. **Record exit codes in Claude Code tool results**: the harness owns `toolUseResult`; until it carries `exitCode`, replay divergence checking cannot run on Claude transcripts even inside a pinned sandbox.
39
+ Workaround for sandboxed Claude sessions: derive returncodes from the sandbox's own command journal instead of the transcript.
40
+ 4. **Emit a replay descriptor per session** (the join target this package consumes): `{ image, cwd, steps: [{action, returncode}], findings: [{stepId, claim}] }` — exactly the shape `loadVerifiedFindingsDataset` joins today, so phase-3 needs no new pipeline code.
41
+
42
+ ## Why this matters
43
+
44
+ Run2 measured: 72.7% of eligible trajectories reproduce their recorded failure at the gold step, and 81.8% of generated fixes flip it.
45
+ Execution-verified labels at fleet scale are training data that cannot be bought — AgenTracer-8B showed +18pp from a specialist localizer trained on *unverified* labels; ours carry executed proof per row.
46
+ Every capture change above turns a session class from "readable" into "verifiable", and the phase-1 pipeline converts verifiable sessions into dataset rows with zero new code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "0.142.2",
3
+ "version": "0.144.0",
4
4
  "description": "Evaluate and improve AI agents from runs, traces, judges, and feedback. Compare candidates, cluster failures, measure lift, and gate releases.",
5
5
  "homepage": "https://github.com/tangle-network/agent-eval#readme",
6
6
  "repository": {