@tangle-network/agent-eval 2.0.19 → 2.0.20

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 (31) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/benchmarks/index.js +2 -2
  3. package/dist/campaign/index.js +6 -6
  4. package/dist/{campaign-CJRlis5N.js → campaign-DPB35MjP.js} +25 -8
  5. package/dist/{campaign-CJRlis5N.js.map → campaign-DPB35MjP.js.map} +1 -1
  6. package/dist/cli.js +2144 -25
  7. package/dist/cli.js.map +1 -1
  8. package/dist/contract/index.js +5 -5
  9. package/dist/{define-agent-eval-Dd6hFx0-.js → define-agent-eval-CBhYD7Gq.js} +3 -3
  10. package/dist/{define-agent-eval-Dd6hFx0-.js.map → define-agent-eval-CBhYD7Gq.js.map} +1 -1
  11. package/dist/index.js +4 -4
  12. package/dist/{llm-judge-Bf3p1WNA.js → llm-judge-DRHTRT66.js} +2 -2
  13. package/dist/{llm-judge-Bf3p1WNA.js.map → llm-judge-DRHTRT66.js.map} +1 -1
  14. package/dist/multishot/index.js +2 -2
  15. package/dist/openapi.json +1 -1
  16. package/dist/{optimization-method-BO2sb1m4.js → optimization-method-B-NFaHom.js} +3 -3
  17. package/dist/{optimization-method-BO2sb1m4.js.map → optimization-method-B-NFaHom.js.map} +1 -1
  18. package/dist/run-improvement-loop-D9IAZviC.d.ts.map +1 -1
  19. package/dist/search/index.js +2 -2
  20. package/dist/{search-kernel-D96Eibc_.js → search-kernel-DezUrquk.js} +3 -3
  21. package/dist/{search-kernel-D96Eibc_.js.map → search-kernel-DezUrquk.js.map} +1 -1
  22. package/dist/{search-summary-DjgKz7B1.js → search-summary-DOhRouoT.js} +2 -2
  23. package/dist/{search-summary-DjgKz7B1.js.map → search-summary-DOhRouoT.js.map} +1 -1
  24. package/dist/{self-improve-BiTuylQQ.js → self-improve-Dm9PvLF2.js} +2 -2
  25. package/dist/{self-improve-BiTuylQQ.js.map → self-improve-Dm9PvLF2.js.map} +1 -1
  26. package/dist/{skillopt-optimization-method-CJkejuSP.js → skillopt-optimization-method-QZoNbg57.js} +2 -2
  27. package/dist/{skillopt-optimization-method-CJkejuSP.js.map → skillopt-optimization-method-QZoNbg57.js.map} +1 -1
  28. package/dist/{tree-lU9KWuxr.js → tree-DBvepwFt.js} +2 -2
  29. package/dist/{tree-lU9KWuxr.js.map → tree-DBvepwFt.js.map} +1 -1
  30. package/docs/real-work.md +81 -0
  31. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ # Real-work benchmark builder
2
+
3
+ `src/real-work/` builds a benchmark of real work from git history. A task starts at the code just before a merged change, holds back the tests that change added or changed, and is graded by them. Every candidate merge in the window becomes a task or carries the reason it was rejected.
4
+
5
+ ```sh
6
+ agent-eval real-work build real-work.config.json
7
+ ```
8
+
9
+ From an agent-eval checkout, after `pnpm install --frozen-lockfile` and `pnpm build`, the same command is `node dist/cli.js real-work build real-work.config.json`; it runs on Node 22 and later. `build` runs every stage. `census`, `build-env`, `grade`, `laterfix`, `timecut`, `seal` and `report` run the incomplete stages up to that one. Progress persists in `<outDir>/.work/state.json` and is checkpointed after every candidate, so a stopped build resumes; `gradeBatchSize` bounds how many buildable candidates one invocation grades. The schema in [`src/real-work/config.ts`](../src/real-work/config.ts) owns every config field and default.
10
+
11
+ The builder records its own commit in the manifest: HEAD of the agent-eval checkout running it. An installed package is not a checkout, so it needs `builderCommit` in the config, and a `builderCommit` that disagrees with the checkout is refused.
12
+
13
+ ## Stages
14
+
15
+ | Stage | What it does | Module |
16
+ | --- | --- | --- |
17
+ | census | Every first-parent merge on each default branch in the window is a candidate. The repository is cached as a bare clone and fetched again on every census. | [`git-history.ts`](../src/real-work/git-history.ts) |
18
+ | build-env | The repository's build runs twice, in two clean checkouts of the snapshot, from the frozen lockfile. | [`environment.ts`](../src/real-work/environment.ts) |
19
+ | grade | Red and green receipts, three runs each, with the grader mounted read-only. | [`receipts.ts`](../src/real-work/receipts.ts), [`grader.ts`](../src/real-work/grader.ts) |
20
+ | laterfix | A later merge that fixes the change becomes its hidden grader. | [`later-fix.ts`](../src/real-work/later-fix.ts) |
21
+ | timecut | The solver's repository is cut at the snapshot and canaries are planted and probed. | [`time-cut.ts`](../src/real-work/time-cut.ts) |
22
+ | solve | Oracle, null and middle-model cells. | [`solvers.ts`](../src/real-work/solvers.ts) |
23
+ | retrieval | The notes-only control; a task it solves is dropped. | [`solvers.ts`](../src/real-work/solvers.ts) |
24
+ | audit | Red and green rerun on a sample, recorded under the configured auditor. | [`pipeline.ts`](../src/real-work/pipeline.ts) |
25
+ | seal | Train, selection and test splits, and the test-set digest. | [`seal.ts`](../src/real-work/seal.ts) |
26
+ | report | The delivered pages. | [`report.ts`](../src/real-work/report.ts) |
27
+
28
+ ## Rejection reasons
29
+
30
+ Before any environment is built, a candidate is `no-tests` when it touches no test path, `too-large` when it adds more than `maxAddedLines` lines or touches more than `maxFiles` files, and `generated-only` when every non-test file it touches is under a `generatedOnly` path. A repository without a gate makes its candidates `no-gate`.
31
+
32
+ A candidate is `env-unbuildable` when its snapshot's lockfile differs from the lockfile at `gateRef` (the default branch unless set), when the repository declares no build command, when either build fails, when the two builds disagree on a digest, or when the environment fails to install before a graded run.
33
+
34
+ Grading rejects a candidate as `no-tests` when the merged change's run reports no test, `tests-flaky` when the three runs of a receipt disagree, the snapshot's run fails without naming a failing test, or a test failing red does not pass green, `already-passes` when the snapshot passes, `generated-only` when the change touches only test files, `merged-fails` when the merged change does not pass, and `duplicate` when its merged commit is already a task. The retrieval stage moves a task it solves to `answer-in-notes`.
35
+
36
+ ## Grader and receipts
37
+
38
+ A test path is a file under a `test`, `tests`, `__tests__`, `spec`, `acceptance` or `fixtures` directory, or a file named `*.test.*`, `*.spec.*`, `*_test.*` or `test_*.py`. The grader is the repository's gate restricted to the change's test paths: appended as arguments (`gate.mode: "argv"`), passed in `TEST_FILES` (`"env"`), or not restricted (`"none"`). The gate runs exactly as configured, through no shell. `runner` selects the parser for its output: `jest`, `vitest` (whose JSON report is read from `--outputFile`, added when the gate names none), `tap`, `cargo`, `pytest` or `go`. Output the parser cannot read reports no tests.
39
+
40
+ A receipt is one verdict repeated three times. Each run resets the checkout (`clean -fdx`, `checkout --force`, `reset --hard`), installs the environment, mounts the grader read-only and runs the gate. Red applies nothing; green applies the merged commit. The verdict is the first failing run's, and `runs` keeps every run so disagreement is visible. `receiptDigest` is the canonical digest ([`ledger-core/canonical.ts`](../src/ledger-core/canonical.ts)) of the receipt without that field, so a reader recomputes it from the JSON. `host` names the configured host kind (`local` by default) and id (this machine's hostname by default), and a fresh `runId` per receipt.
41
+
42
+ ## Later fixes
43
+
44
+ A later fix is a merge on the default branch within seven days after the change and before `builtAt`, touching a non-test file the change touched, with test files the change does not hold back. The shipped change must fail the fix's tests and the fix must pass them, each over three runs; otherwise the task stays ordinary. Solvers on a later-fix task are graded by the hidden grader, so an oracle that replays the shipped change fails there.
45
+
46
+ ## Time cut and canaries
47
+
48
+ The solver's repository is one orphan commit of the snapshot tree, dated at the snapshot, with every held-back test removed. Remotes, branches, tags and reflogs are deleted and unreachable objects pruned, and the cut throws if a later commit or the original snapshot survives. Receipts and audits use the original snapshot from the builder's cache.
49
+
50
+ The four stores under `stores.root` are `memory.json`, `knowledge/`, `docs/` and `history.jsonl`. For every task the builder writes a fresh random token into each store, so point `stores.root` at a copy. The probe requires each token to be findable in its store and counts its occurrences in the solver's context: the prompt and every file of the solver's repository. `solverContextSha256` is the canonical digest of `{prompt, files}`, where `files` holds the sorted `[path, sha256]` pairs. The builder gives a solver no search index, so `timeCut.indexes` is empty.
51
+
52
+ Solvers run in clones of the solver repository under `<outDir>/.work/runs/`, next to the builder's cache and state, which hold the answers. The time cut controls what the checkout holds, not what the solver process can read: run the model and notes commands somewhere that sees only their working directory.
53
+
54
+ ## Solvers
55
+
56
+ - The oracle applies every file of the real change except the graders, which only the harness writes.
57
+ - The null solver does nothing.
58
+ - The middle model is invoked as `<command> <workdir> <gate> <prompt>`. A nonzero exit is a graded attempt; a command that cannot start stops the build.
59
+ - The retrieval control is invoked as `<command> <workdir> <prompt> <storesRoot>`, with the allowed search tools in `REAL_WORK_RETRIEVAL_TOOLS`. It must attempt the task, so a failing command stops the build rather than reading as a miss.
60
+
61
+ A cell's `tokens` is what the solver reported on a last `TOKENS <n>` line, with `tokensSource: "reported"`, or else an estimate of four bytes a token over the prompt and the applied change, with `tokensSource: "estimated"`. `graderIntegrity.solverWrites` lists every path whose content changed, appeared or disappeared while a solver worked; the grader is mounted only afterwards.
62
+
63
+ ## Kinds
64
+
65
+ The caller's `kinds` rules are tried in order. A rule matches when a changed path has a segment equal to one of its `pathSegments` (a token ending in `*` matches a segment that starts with it), or when the change's subject or an added line matches its `linePattern`, case-insensitively. Otherwise the kind is the change type read from the merged branch's subject: `perf`, `refactor`, `test` (also a change touching only test files), `fix`, else `feature`. A task's family is `<repo>/<kind>`.
66
+
67
+ ## Audit
68
+
69
+ The audit stage reruns red and green on `audit.count` tasks (a tenth, at least three, by default) and records each under `audit.agent`. The builder cannot verify who invoked it, so the rerun is independent only when the auditor runs that stage: the builder runs `seal`, and the auditor runs `report` from the same state.
70
+
71
+ ## Seal
72
+
73
+ The test split holds `max(minTest, the number of repositories with at least minPerRepo tasks, ceil(N * maxTestShare / 3))` tasks, capped at `floor(N * maxTestShare)`. Every such repository gets a test task first; the rest are taken at a stride through the merge-time order, and selection is the first quarter of what remains. The assignment depends only on the tasks' merge times and ids. `testSetSha256` is the sha256 of the sorted test ids joined by newlines.
74
+
75
+ ## Pages
76
+
77
+ `<outDir>` receives `manifest.json` (schema `real-work-benchmark.v2`), `candidates.json`, `yield.json`, `tasks/<id>.json`, `spread.json` and `retrieval.json`. [`report.ts`](../src/real-work/report.ts) owns every field. `builtAt` is the report time unless the config pins one, and the census window ends at it. `manifest.builder.command` is `agent-eval real-work <stage> <config>` as invoked unless `builderCommand` overrides it, and `manifest.agents` names the builder agent and the middle model.
78
+
79
+ ## Verification
80
+
81
+ [`tests/real-work-builder.integration.test.ts`](../tests/real-work-builder.integration.test.ts) builds three invented repositories with [`tests/fixtures/real-work/repos.ts`](../tests/fixtures/real-work/repos.ts), runs the command as a child process and checks the pages: every candidate's reason, recomputed receipt digests, three agreeing red and green runs, the later fix, the time cut and its canaries, the notes-only drop, the seal, and a resumed grade.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "2.0.19",
3
+ "version": "2.0.20",
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": {