@tangle-network/agent-bench 1.0.2 → 3.0.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.
- package/CHANGELOG.md +29 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +63 -50
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +55 -44
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +3 -3
- package/dist/benchmarks/mcad-cq-bench.js +70 -58
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +63 -52
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +49 -43
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +50 -0
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/atom-mcp-e2e.mts +2 -2
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +36 -36
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +58 -48
- package/src/benchmarks/finsearchcomp.ts +73 -68
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +79 -74
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +61 -58
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +19 -16
- package/src/examples/lean-proof-gate.mts +1 -1
- package/src/examples/math-demo.mts +2 -2
- package/src/examples/strategy-demo.mts +1 -1
- package/src/gate-cli.mts +6 -6
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/generate-eval/certify.ts +4 -4
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +3 -3
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/swe-self-improve.mts +3 -3
- package/src/terminal-compare.ts +1 -1
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-DhAndllg.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* # live: real benchmarks graded by their real graders
|
|
14
14
|
* TANGLE_API_KEY=... BENCHMARKS=humaneval tsx src/examples/benchmark-matrix.mts
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type BenchEvaluation, type BenchTask, type RuntimeBenchmark, runtimeBenchmark } from '../benchmarks/types'
|
|
17
17
|
import { type BenchCell, type BenchShot, printBenchmarksReport, runBenchmarks } from '../run-benchmarks'
|
|
18
18
|
|
|
19
19
|
/** The matrix: three cells spanning harnesses, models, and transports. */
|
|
20
20
|
const cells: BenchCell[] = [
|
|
21
|
-
{ label: 'opencode/glm-
|
|
22
|
-
{ label: 'codex/gpt-
|
|
23
|
-
{ label: 'router/deepseek-v4-flash', model: 'deepseek-v4-flash', backend: 'router' },
|
|
21
|
+
{ label: 'opencode/glm-5.3', harness: 'opencode', model: 'glm-5.3', backend: 'sandbox' },
|
|
22
|
+
{ label: 'codex/gpt-6.1-sol', harness: 'codex', model: 'gpt-6.1-sol', backend: 'sandbox' },
|
|
23
|
+
{ label: 'router/deepseek-v4.1-flash', model: 'deepseek/deepseek-v4.1-flash', backend: 'router' },
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
async function live(): Promise<void> {
|
|
@@ -46,31 +46,34 @@ async function live(): Promise<void> {
|
|
|
46
46
|
/** Offline proof: a stub registry whose judge is deterministic, and a stub shot whose "ability"
|
|
47
47
|
* differs per cell — so the leaderboard ORDER reflects the cells, with no model or sandbox. */
|
|
48
48
|
async function demo(): Promise<void> {
|
|
49
|
-
const stub = (name: string, n: number):
|
|
50
|
-
name,
|
|
51
|
-
|
|
52
|
-
loadTasks: async (o) =>
|
|
49
|
+
const stub = (name: string, n: number): RuntimeBenchmark => runtimeBenchmark({
|
|
50
|
+
id: name,
|
|
51
|
+
loadAll: async (o) =>
|
|
53
52
|
Array.from({ length: o?.limit ?? n }, (_, i) => ({
|
|
54
53
|
id: `${name}-${i}`,
|
|
55
|
-
prompt: `task ${i}
|
|
54
|
+
payload: { prompt: `task ${i}` },
|
|
56
55
|
metadata: { gold: `G-${name}-${i}` },
|
|
57
56
|
})),
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
evaluate: async (t: BenchTask, a: string): Promise<BenchEvaluation> => ({
|
|
58
|
+
passed: a === t.metadata?.gold,
|
|
60
59
|
score: a === t.metadata?.gold ? 1 : 0,
|
|
60
|
+
raw: {},
|
|
61
61
|
}),
|
|
62
|
-
|
|
62
|
+
runtime: {
|
|
63
|
+
preflight: async () => {},
|
|
64
|
+
goldArtifact: async (t: BenchTask) => String(t.metadata?.gold),
|
|
65
|
+
},
|
|
63
66
|
})
|
|
64
|
-
const registry: Record<string,
|
|
67
|
+
const registry: Record<string, RuntimeBenchmark> = {
|
|
65
68
|
'demo-coding': stub('demo-coding', 8),
|
|
66
69
|
'demo-research': stub('demo-research', 8),
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
// Cell ability: opencode/glm solves the most, router the least — deterministic by task index.
|
|
70
73
|
const ability: Record<string, number> = {
|
|
71
|
-
'opencode/glm-
|
|
72
|
-
'codex/gpt-
|
|
73
|
-
'router/deepseek-v4-flash': 0.38,
|
|
74
|
+
'opencode/glm-5.3': 0.88,
|
|
75
|
+
'codex/gpt-6.1-sol': 0.62,
|
|
76
|
+
'router/deepseek-v4.1-flash': 0.38,
|
|
74
77
|
}
|
|
75
78
|
const shot: BenchShot = async ({ task, cell }) => {
|
|
76
79
|
const idx = Number(task.id.split('-').pop())
|
|
@@ -148,7 +148,7 @@ async function main(): Promise<void> {
|
|
|
148
148
|
routerKey,
|
|
149
149
|
workerProfile: benchRouterProfile(
|
|
150
150
|
'lean-proof-worker',
|
|
151
|
-
process.env.WORKER_MODEL ?? 'deepseek-v4-flash',
|
|
151
|
+
process.env.WORKER_MODEL ?? 'deepseek/deepseek-v4.1-flash',
|
|
152
152
|
{
|
|
153
153
|
systemPrompt: 'Construct and verify Lean proofs with the available checker before answering.',
|
|
154
154
|
maxTurns: 8,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* sampleThenRefine (both). Swap the `check` and this same file grades a tax return value,
|
|
9
9
|
* a rubric score, anything answer-shaped.
|
|
10
10
|
*
|
|
11
|
-
* Run from bench/ (needs a router key; default model deepseek-v4-flash):
|
|
11
|
+
* Run from bench/ (needs a router key; default model deepseek/deepseek-v4.1-flash):
|
|
12
12
|
* TANGLE_API_KEY=... WORKER_MODEL=gpt-4o-mini BUDGET=3 tsx src/examples/math-demo.mts
|
|
13
13
|
*/
|
|
14
14
|
import {
|
|
@@ -98,7 +98,7 @@ async function main(): Promise<void> {
|
|
|
98
98
|
routerKey,
|
|
99
99
|
workerProfile: benchRouterProfile(
|
|
100
100
|
'math-worker',
|
|
101
|
-
process.env.WORKER_MODEL ?? 'deepseek-v4-flash',
|
|
101
|
+
process.env.WORKER_MODEL ?? 'deepseek/deepseek-v4.1-flash',
|
|
102
102
|
{
|
|
103
103
|
systemPrompt: 'Solve the requested math task with the available tools and verify the result.',
|
|
104
104
|
maxTurns: 6,
|
|
@@ -99,7 +99,7 @@ async function main(): Promise<void> {
|
|
|
99
99
|
routerKey: process.env.TANGLE_API_KEY ?? '',
|
|
100
100
|
workerProfile: benchRouterProfile(
|
|
101
101
|
'strategy-demo-worker',
|
|
102
|
-
process.env.WORKER_MODEL ?? 'deepseek-v4-flash',
|
|
102
|
+
process.env.WORKER_MODEL ?? 'deepseek/deepseek-v4.1-flash',
|
|
103
103
|
{
|
|
104
104
|
systemPrompt: 'Use the available tools to complete and verify the task.',
|
|
105
105
|
maxTurns: 6,
|
package/src/gate-cli.mts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Run the diverse-vs-blind gate THROUGH the recursive atom, end to end, in two lines:
|
|
3
3
|
*
|
|
4
4
|
* export TANGLE_API_KEY=... # router + the deployable judge's creds
|
|
5
|
-
* BENCH=
|
|
5
|
+
* BENCH=swe-bench N=20 K=4 tsx src/gate-cli.mts
|
|
6
6
|
*
|
|
7
7
|
* The arms are equal-k by construction (both open K children; blind = K identical copies,
|
|
8
8
|
* diverse = K distinct strategy directives). The deployable selector is the benchmark's OWN
|
|
9
|
-
* judge — pick a benchmark whose `adapter.
|
|
10
|
-
*
|
|
9
|
+
* judge — pick a benchmark whose `adapter.evaluate` is a runnable checker (swe-bench,
|
|
10
|
+
* terminal-bench), NOT an LLM-judge bench (finsearchcomp), or the selector is not
|
|
11
11
|
* deployable and the result does not answer the gate.
|
|
12
12
|
*
|
|
13
13
|
* Output is a verdict-first report: the headline delta, the per-arm resolve table, the equal-k
|
|
@@ -35,9 +35,9 @@ const defaultStrategies: ReadonlyArray<string> = [
|
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
async function main(): Promise<void> {
|
|
38
|
-
const benchKey =
|
|
38
|
+
const benchKey = must('BENCH')
|
|
39
39
|
const adapter = resolveAdapter(benchKey)
|
|
40
|
-
const model = process.env.WORKER_MODEL ?? 'deepseek-v4-flash'
|
|
40
|
+
const model = process.env.WORKER_MODEL ?? 'deepseek/deepseek-v4.1-flash'
|
|
41
41
|
const routerBaseUrl = process.env.ROUTER_BASE ?? 'https://router.tangle.tools/v1'
|
|
42
42
|
const routerKey = must('TANGLE_API_KEY')
|
|
43
43
|
const k = Number(process.env.K ?? defaultStrategies.length)
|
|
@@ -65,7 +65,7 @@ async function main(): Promise<void> {
|
|
|
65
65
|
routerKey,
|
|
66
66
|
n: Number(process.env.N ?? 20),
|
|
67
67
|
...(process.env.IDS ? { ids: process.env.IDS.split(',') } : {}),
|
|
68
|
-
...(process.env.
|
|
68
|
+
...(process.env.SUBSET ? { subset: process.env.SUBSET } : {}),
|
|
69
69
|
...(process.env.PER_CHILD_TOKENS ? { perChildTokens: Number(process.env.PER_CHILD_TOKENS) } : {}),
|
|
70
70
|
})
|
|
71
71
|
|
package/src/gate.test.mts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* drives the `Supervisor`, the per-child deployable verdict drives selection, the paired metric is
|
|
5
5
|
* derived from the run's own trajectory, and the conserved pool yields equal-k across arms.
|
|
6
6
|
*
|
|
7
|
-
* The LIVE solve-and-grade path (`benchSolverRegistry` → router + `adapter.
|
|
7
|
+
* The LIVE solve-and-grade path (`benchSolverRegistry` → router + `adapter.evaluate`) is exercised
|
|
8
8
|
* by a real gate run against a deployable-checker domain, not here.
|
|
9
9
|
*
|
|
10
10
|
* tsx bench/src/gate.test.mts
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
ExecutorFactory,
|
|
22
22
|
ExecutorResult,
|
|
23
23
|
} from '@tangle-network/agent-runtime/kernel'
|
|
24
|
-
import type
|
|
24
|
+
import { type BenchEvaluation, type BenchTask, type RuntimeBenchmark, runtimeBenchmark } from './benchmarks/types'
|
|
25
25
|
import { runGate, type SolveTask } from './gate'
|
|
26
26
|
|
|
27
27
|
/** A child whose verdict is decided purely by whether its prompt carries the STRONG marker — so a
|
|
@@ -62,23 +62,25 @@ const stubRegistry: ExecutorRegistry = {
|
|
|
62
62
|
},
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function stubAdapter(n: number):
|
|
65
|
+
function stubAdapter(n: number): RuntimeBenchmark {
|
|
66
66
|
const tasks: BenchTask[] = Array.from({ length: n }, (_v, i) => ({
|
|
67
67
|
id: `t${i}`,
|
|
68
|
-
prompt: `solve instance ${i}
|
|
68
|
+
payload: { prompt: `solve instance ${i}` },
|
|
69
69
|
}))
|
|
70
|
-
return {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
loadTasks: (opts) =>
|
|
70
|
+
return runtimeBenchmark({
|
|
71
|
+
id: 'stub-bench',
|
|
72
|
+
loadAll: (opts) =>
|
|
74
73
|
Promise.resolve(opts?.limit !== undefined ? tasks.slice(0, opts.limit) : tasks),
|
|
75
|
-
//
|
|
74
|
+
// evaluate is NOT exercised on the injected-registry path (the stub leaf sets verdicts directly);
|
|
76
75
|
// a real run reaches the adapter judge through benchSolverRegistry.
|
|
77
|
-
|
|
76
|
+
evaluate: (): Promise<BenchEvaluation> => {
|
|
78
77
|
throw new Error('stub judge must not be called on the injected-registry path')
|
|
79
78
|
},
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
runtime: {
|
|
80
|
+
preflight: () => Promise.resolve(),
|
|
81
|
+
goldArtifact: () => Promise.resolve(undefined),
|
|
82
|
+
},
|
|
83
|
+
})
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
const profile = {
|
package/src/gate.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The gate's two non-negotiables, enforced structurally here:
|
|
14
14
|
* - DEPLOYABLE selector. Each fanout child SOLVES via the router, then is graded by the
|
|
15
|
-
* benchmark's OWN deterministic `adapter.
|
|
16
|
-
* the answer oracle). That `
|
|
15
|
+
* benchmark's OWN deterministic `adapter.evaluate` (a runnable checker — NOT an LLM judge, NOT
|
|
16
|
+
* the answer oracle). That `BenchEvaluation` becomes the child's `DefaultVerdict`, and `fanout`'s
|
|
17
17
|
* single-sourced `defaultSelectWinner` picks the best-scoring candidate. Selection therefore
|
|
18
18
|
* reads only the deployable verifier — selector ≠ oracle by construction.
|
|
19
19
|
* - EQUAL k. Both arms open the SAME number of children (k = strategies.length; blind = k
|
|
@@ -55,10 +55,10 @@ import {
|
|
|
55
55
|
runPersonified,
|
|
56
56
|
trajectoryReport,
|
|
57
57
|
} from '@tangle-network/agent-runtime/kernel'
|
|
58
|
-
import type {
|
|
58
|
+
import type { BenchTask, RuntimeBenchmark } from './benchmarks/types'
|
|
59
59
|
|
|
60
60
|
/** A fanout child's task: the prompt to solve with + the instance to grade against. The instance
|
|
61
|
-
* travels with the prompt so the solve-and-grade leaf can run `adapter.
|
|
61
|
+
* travels with the prompt so the solve-and-grade leaf can run `adapter.evaluate` without a closure
|
|
62
62
|
* over the per-task state (the registry closes only over the adapter + router config). */
|
|
63
63
|
export interface SolveTask {
|
|
64
64
|
readonly prompt: string
|
|
@@ -68,7 +68,7 @@ export interface SolveTask {
|
|
|
68
68
|
/** What `benchSolverRegistry` needs to build a solve-and-grade leaf. The router config is the
|
|
69
69
|
* cheapest leaf (one chat completion, no box); the adapter supplies the deployable judge. */
|
|
70
70
|
interface BenchSolverOptions {
|
|
71
|
-
readonly adapter:
|
|
71
|
+
readonly adapter: RuntimeBenchmark
|
|
72
72
|
readonly routerBaseUrl: string
|
|
73
73
|
readonly routerKey: string
|
|
74
74
|
}
|
|
@@ -93,16 +93,16 @@ const fnv = (prefix: string, value: unknown): string => {
|
|
|
93
93
|
* (e.g. the last fenced ```json block for a transcript bench), so the gate leaf honors
|
|
94
94
|
* `benchmark = adapter owns its deliverable`. Falls back to the trimmed reply when the adapter
|
|
95
95
|
* defines no output parser (the research/QA case). */
|
|
96
|
-
function extractArtifact(adapter:
|
|
97
|
-
if (!adapter.output) return content.trim()
|
|
96
|
+
function extractArtifact(adapter: RuntimeBenchmark, content: string): string {
|
|
97
|
+
if (!adapter.runtime.output) return content.trim()
|
|
98
98
|
const events = [{ type: 'agent', data: { finalText: content } }] as unknown as SandboxEvent[]
|
|
99
|
-
return adapter.output.parse(events)
|
|
99
|
+
return adapter.runtime.output.parse(events)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* A single solve-and-grade leaf executor. Solves the task with ONE router completion, extracts
|
|
104
104
|
* the deliverable via the adapter, then grades it with the benchmark's deterministic judge and
|
|
105
|
-
* surfaces that `
|
|
105
|
+
* surfaces that `BenchEvaluation` as the child's `DefaultVerdict`. The verdict is what `fanout`'s
|
|
106
106
|
* deployable selector ranks on. Reports REAL token usage; a missing-usage provider records zero
|
|
107
107
|
* tokens but still one iteration (never a fabricated priced cost). Fail-loud: a router non-2xx or
|
|
108
108
|
* a judge throw rejects the leaf (the scope types it into a `down` settlement — never a silent 0).
|
|
@@ -118,14 +118,14 @@ function benchSolveLeaf(opts: BenchSolverOptions, spec: AgentSpec, ctx: Executor
|
|
|
118
118
|
const raw = result.out as { content?: unknown }
|
|
119
119
|
const content = typeof raw?.content === 'string' ? raw.content : ''
|
|
120
120
|
const candidate = extractArtifact(opts.adapter, content)
|
|
121
|
-
const score = await opts.adapter.
|
|
121
|
+
const score = await opts.adapter.evaluate(t.instance, candidate)
|
|
122
122
|
return {
|
|
123
123
|
outRef: fnv('bench', { id: t.instance.id, candidate }),
|
|
124
124
|
out: candidate,
|
|
125
125
|
verdict: {
|
|
126
|
-
valid: score.
|
|
126
|
+
valid: score.passed === true,
|
|
127
127
|
score: score.score,
|
|
128
|
-
...(score.
|
|
128
|
+
...(score.notes ? { notes: score.notes } : {}),
|
|
129
129
|
},
|
|
130
130
|
}
|
|
131
131
|
})
|
|
@@ -173,10 +173,10 @@ function defineSolverPersona(
|
|
|
173
173
|
/** The blind/diverse `fanout` over k children. Each item is a strategy directive appended to the
|
|
174
174
|
* task prompt; the blind arm passes k empty strategies (k identical prompts = the compute
|
|
175
175
|
* control). No `synthesize` → the deployable `defaultSelectWinner` returns the best-graded child. */
|
|
176
|
-
function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask): CombinatorShape<unknown, string> {
|
|
176
|
+
function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask, prompt: string): CombinatorShape<unknown, string> {
|
|
177
177
|
return fanout<unknown, string, string>(strategies, {
|
|
178
178
|
itemTask: (strategy): SolveTask => ({
|
|
179
|
-
prompt: strategy.length > 0 ? `${
|
|
179
|
+
prompt: strategy.length > 0 ? `${prompt}\n\n${strategy}` : prompt,
|
|
180
180
|
instance,
|
|
181
181
|
}),
|
|
182
182
|
label: (_s, i) => `solve:${i}`,
|
|
@@ -184,7 +184,7 @@ function solveFanout(strategies: ReadonlyArray<string>, instance: BenchTask): Co
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
interface RunGateOptions {
|
|
187
|
-
readonly adapter:
|
|
187
|
+
readonly adapter: RuntimeBenchmark
|
|
188
188
|
/** The ONE specificity: who the solver is (prompt / model / tools). */
|
|
189
189
|
readonly profile: AgentProfile
|
|
190
190
|
/**
|
|
@@ -198,7 +198,8 @@ interface RunGateOptions {
|
|
|
198
198
|
/** How many benchmark instances to run (the paired n). */
|
|
199
199
|
readonly n?: number
|
|
200
200
|
readonly ids?: string[]
|
|
201
|
-
|
|
201
|
+
/** The publisher's subset (domain, category, language), for benchmarks that have them. */
|
|
202
|
+
readonly subset?: string
|
|
202
203
|
/** Per-child token ceiling the conserved pool reserves. Default 60_000. */
|
|
203
204
|
readonly perChildTokens?: number
|
|
204
205
|
/** Per-child wall-clock deadline (ms) forwarded to the root budget. */
|
|
@@ -288,13 +289,13 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
288
289
|
throw new Error('runGate: need >= 2 strategies (k = strategies.length fixes both arms’ child count)')
|
|
289
290
|
}
|
|
290
291
|
const k = opts.strategies.length
|
|
291
|
-
await opts.adapter.preflight()
|
|
292
|
-
const tasks = await opts.adapter.
|
|
292
|
+
await opts.adapter.runtime.preflight?.()
|
|
293
|
+
const tasks = await opts.adapter.loadAll({
|
|
293
294
|
...(opts.n !== undefined ? { limit: opts.n } : {}),
|
|
294
295
|
...(opts.ids ? { ids: opts.ids } : {}),
|
|
295
|
-
...(opts.
|
|
296
|
+
...(opts.subset ? { subset: opts.subset } : {}),
|
|
296
297
|
})
|
|
297
|
-
if (tasks.length === 0) throw new Error('runGate: adapter.
|
|
298
|
+
if (tasks.length === 0) throw new Error('runGate: adapter.loadAll returned no tasks')
|
|
298
299
|
|
|
299
300
|
const registry = opts.solverRegistry ?? benchSolverRegistry(opts)
|
|
300
301
|
const perChildTokens = opts.perChildTokens ?? 60_000
|
|
@@ -330,7 +331,7 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
330
331
|
const runId = `gate:${armDef.label}:${task.id}`
|
|
331
332
|
const result: SupervisedResult<Outcome<string>> = await runPersonified<unknown, string>({
|
|
332
333
|
persona,
|
|
333
|
-
shape: solveFanout(armDef.strategies, task),
|
|
334
|
+
shape: solveFanout(armDef.strategies, task, opts.adapter.runtime.prompt(task)),
|
|
334
335
|
task: undefined,
|
|
335
336
|
budget,
|
|
336
337
|
shapeBudget: { fanout: k, perChild },
|
|
@@ -395,7 +396,7 @@ export async function runGate(opts: RunGateOptions): Promise<GateReport> {
|
|
|
395
396
|
const blind = arms.find((a) => a.label === 'blind')!
|
|
396
397
|
const diverse = arms.find((a) => a.label === 'diverse')!
|
|
397
398
|
return {
|
|
398
|
-
benchmark: opts.adapter.
|
|
399
|
+
benchmark: opts.adapter.id,
|
|
399
400
|
k,
|
|
400
401
|
n: tasks.length,
|
|
401
402
|
perTask,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* exit 0 admitted · 1 rejected · 2 malformed/infra
|
|
19
19
|
* Env: EVAL_GATE_BASE_URL (default https://router.tangle.tools/v1)
|
|
20
20
|
* EVAL_GATE_API_KEY (default $TANGLE_API_KEY)
|
|
21
|
-
* EVAL_GATE_MODEL (default
|
|
21
|
+
* EVAL_GATE_MODEL (default deepseek/deepseek-v4.1-flash)
|
|
22
22
|
*/
|
|
23
23
|
import { execSync } from 'node:child_process'
|
|
24
24
|
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
@@ -119,14 +119,14 @@ export async function discriminationGate(
|
|
|
119
119
|
): Promise<{ passed: boolean; detail: string }> {
|
|
120
120
|
const baseUrl = opts.gateBaseUrl ?? process.env.EVAL_GATE_BASE_URL ?? 'https://router.tangle.tools/v1'
|
|
121
121
|
const apiKey = opts.gateApiKey ?? process.env.EVAL_GATE_API_KEY ?? process.env.TANGLE_API_KEY
|
|
122
|
-
const model = opts.gateModel ?? process.env.EVAL_GATE_MODEL ?? 'deepseek-v4-flash'
|
|
122
|
+
const model = opts.gateModel ?? process.env.EVAL_GATE_MODEL ?? 'deepseek/deepseek-v4.1-flash'
|
|
123
123
|
if (!apiKey) throw new Error('discrimination gate needs EVAL_GATE_API_KEY (or TANGLE_API_KEY)')
|
|
124
124
|
const res = await runBenchRouterTurn(
|
|
125
125
|
{
|
|
126
126
|
routerBaseUrl: baseUrl,
|
|
127
127
|
routerKey: apiKey,
|
|
128
128
|
profile: {
|
|
129
|
-
name: 'generated-eval-parametric-check',
|
|
129
|
+
name: 'generated-eval-parametric-check', harness: 'cli-base',
|
|
130
130
|
model: { provider: 'tangle-router', default: model },
|
|
131
131
|
},
|
|
132
132
|
},
|
|
@@ -150,7 +150,7 @@ export async function certifyEval(candidate: GeneratedEval, opts: CertifyOpts =
|
|
|
150
150
|
schemaVersion: generatedEvalSchemaVersion,
|
|
151
151
|
groundingPassed: true,
|
|
152
152
|
parametricFailed: true,
|
|
153
|
-
parametricModel: opts.gateModel ?? process.env.EVAL_GATE_MODEL ?? 'deepseek-v4-flash',
|
|
153
|
+
parametricModel: opts.gateModel ?? process.env.EVAL_GATE_MODEL ?? 'deepseek/deepseek-v4.1-flash',
|
|
154
154
|
resolvedTarget: declaredTarget(candidate.setup),
|
|
155
155
|
certifiedAt: new Date().toISOString(),
|
|
156
156
|
certifier: certifierId,
|
package/src/index.ts
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* and scores its agent's artifact against a real, deterministic judge — without owning the benchmark:
|
|
6
6
|
*
|
|
7
7
|
* import { resolveAdapter } from '@tangle-network/agent-bench'
|
|
8
|
-
* const verdict = await resolveAdapter('commit0').
|
|
8
|
+
* const verdict = await resolveAdapter('commit0').evaluate(task, myAgentsDiff)
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Every adapter is an agent-eval `BenchmarkAdapter` (`RuntimeBenchmark`: its `runtime` hooks, and
|
|
11
|
+
* `loadAll`, which ignores agent-eval's splits). Each fails loud in `runtime.preflight()` when its
|
|
12
|
+
* harness/deps (Docker, a venv, a dataset) are absent, so importing the registry is cheap; running a
|
|
13
|
+
* specific benchmark pulls only its deps.
|
|
12
14
|
*/
|
|
13
15
|
export { ADAPTERS, resolveAdapter } from './adapters'
|
|
14
16
|
export { createCragAdapter } from './benchmarks/crag'
|
|
@@ -17,7 +19,7 @@ export { createOpenRagBenchAdapter } from './benchmarks/open-rag-bench'
|
|
|
17
19
|
export { createRagBenchAdapter } from './benchmarks/ragbench'
|
|
18
20
|
export {
|
|
19
21
|
FINAL_ANSWER_SENTINEL,
|
|
20
|
-
|
|
22
|
+
answerScoreToEvaluation,
|
|
21
23
|
contextBlock,
|
|
22
24
|
contextsFrom,
|
|
23
25
|
normalizeAnswer,
|
|
@@ -46,13 +48,17 @@ export {
|
|
|
46
48
|
type StagedRunCaptureSpec,
|
|
47
49
|
type StagedRunSpec,
|
|
48
50
|
} from './benchmarks/_harness'
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
export {
|
|
52
|
+
runtimeBenchmark,
|
|
53
|
+
type BenchEvaluation,
|
|
54
|
+
type BenchPayload,
|
|
55
|
+
type BenchRuntime,
|
|
56
|
+
type BenchTask,
|
|
57
|
+
type JudgeArtifactFileReceipt,
|
|
58
|
+
type JudgeArtifactReceipt,
|
|
59
|
+
type LoadOptions,
|
|
60
|
+
type RuntimeBenchmark,
|
|
61
|
+
type RuntimeBenchmarkSpec,
|
|
56
62
|
} from './benchmarks/types'
|
|
57
63
|
|
|
58
64
|
/**
|