@tangle-network/agent-bench 0.7.1 → 0.8.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.
- package/CHANGELOG.md +12 -0
- package/HARNESS.md +2 -2
- package/dist/adapters.js +6 -2
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +61 -2
- package/dist/benchmarks/appworld.js +111 -40
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/finresearchbench.js +16 -22
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.js +16 -22
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.js +18 -20
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +106 -0
- package/dist/benchmarks/mcad-bench.js +569 -0
- package/dist/benchmarks/mcad-bench.js.map +1 -0
- package/dist/benchmarks/mcad-cq-bench.d.ts +82 -0
- package/dist/benchmarks/mcad-cq-bench.js +339 -0
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -0
- package/dist/benchmarks/mcad-cq-golds.d.ts +36 -0
- package/dist/benchmarks/mcad-cq-golds.js +342 -0
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -0
- package/dist/benchmarks/mcad-golds.d.ts +20 -0
- package/dist/benchmarks/mcad-golds.js +318 -0
- package/dist/benchmarks/mcad-golds.js.map +1 -0
- package/dist/benchmarks/mcad-tasks.d.ts +66 -0
- package/dist/benchmarks/mcad-tasks.js +508 -0
- package/dist/benchmarks/mcad-tasks.js.map +1 -0
- package/dist/benchmarks/simpleqa.js +15 -19
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/trata-hedge.js +20 -23
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/{cadbench-BrpwOU6A.js → cadbench-BLSyxR1N.js} +21 -20
- package/dist/cadbench-BLSyxR1N.js.map +1 -0
- package/dist/{cadgenbench-DF7hYHdl.js → cadgenbench-x2OFkf8y.js} +2 -2
- package/dist/cadgenbench-x2OFkf8y.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/router-turn-C2wMiDoo.js +31 -0
- package/dist/router-turn-C2wMiDoo.js.map +1 -0
- package/package.json +7 -7
- package/scripts/appworld_driver.py +1 -170
- package/scripts/run-package-tests.mjs +56 -36
- package/scripts/run-package-tests.test.mjs +33 -0
- package/scripts/trata-hedge/README.md +3 -3
- package/scripts/trata-hedge/run.sh +6 -2
- package/src/adapters.ts +11 -0
- package/src/aec-gate.mts +30 -9
- package/src/agent-graphs-gen2.mts +523 -0
- package/src/agent-graphs-gen3.mts +660 -0
- package/src/agent-graphs-improve/offline-seams.mts +128 -0
- package/src/agent-graphs-improve.mts +747 -0
- package/src/atom-humaneval.mts +76 -55
- package/src/atom-mcp-e2e.mts +27 -13
- package/src/benchmarks/appworld.test.mts +119 -1
- package/src/benchmarks/appworld.ts +156 -33
- package/src/benchmarks/cadbench.ts +21 -8
- package/src/benchmarks/finresearchbench.ts +20 -16
- package/src/benchmarks/finsearchcomp.ts +20 -20
- package/src/benchmarks/frames.ts +19 -18
- package/src/benchmarks/mcad-bench.test.mts +455 -0
- package/src/benchmarks/mcad-bench.ts +561 -0
- package/src/benchmarks/mcad-cq-bench.ts +423 -0
- package/src/benchmarks/mcad-cq-golds.ts +374 -0
- package/src/benchmarks/mcad-cq.test.mts +386 -0
- package/src/benchmarks/mcad-golds.ts +359 -0
- package/src/benchmarks/mcad-tasks.ts +490 -0
- package/src/benchmarks/simpleqa.ts +19 -17
- package/src/benchmarks/trata-hedge.ts +26 -18
- package/src/browser/ui-reviewer.ts +1 -1
- package/src/clbench-context-gate.mts +45 -9
- package/src/cloud-loop.mts +24 -6
- package/src/commit0-env-run.mts +6 -3
- package/src/commit0-env.ts +2 -3
- package/src/commit0-gate.mts +53 -24
- package/src/corpus.ts +3 -3
- package/src/david-attribution.mts +28 -9
- package/src/david-goliath.mts +31 -12
- package/src/egress-probe.mts +3 -3
- package/src/examples/lean-proof-gate.mts +10 -3
- package/src/examples/math-demo.mts +10 -3
- package/src/examples/strategy-demo.mts +10 -4
- package/src/fleet.mts +30 -8
- package/src/gate-cli.mts +9 -4
- package/src/gate.test.mts +7 -2
- package/src/gate.ts +23 -75
- package/src/generate-eval/certify.ts +13 -5
- package/src/hev-eval.mts +39 -10
- package/src/hev-improve.mts +28 -16
- package/src/hev-structural.mts +28 -20
- package/src/humaneval-gate.mts +24 -8
- package/src/humaneval-object-ablation.mts +52 -14
- package/src/humaneval-repair-gate.mts +53 -14
- package/src/mbpp-structural.mts +28 -20
- package/src/mcp-mount-probe.mts +23 -11
- package/src/official-optimizer-config.mts +61 -12
- package/src/official-optimizer-config.test.mts +72 -3
- package/src/quant-arena/profiles/quant-researcher.profile.json +6 -1
- package/src/quant-arena/quant-loop.mts +88 -61
- package/src/research-shot.ts +21 -11
- package/src/resolve-client.ts +6 -8
- package/src/rollout-ledger/backfill-swe-arena.test.mts +7 -2
- package/src/router-executor.ts +1 -1
- package/src/router-turn.ts +135 -0
- package/src/run-benchmarks.ts +7 -2
- package/src/sandbox-run.ts +23 -41
- package/src/search-bench/bridge.ts +66 -8
- package/src/search-bench/parametric-check.mts +19 -4
- package/src/search-bench/profiles.ts +24 -9
- package/src/search-bench/run.mts +3 -4
- package/src/smoke-structural-rollout.mts +21 -5
- package/src/supervisor-arena.mts +28 -20
- package/src/swe-arena/arms.ts +73 -15
- package/src/swe-arena/capacity.ts +44 -41
- package/src/swe-arena/diagnosis-ensemble.ts +51 -48
- package/src/swe-arena/execution.test.mts +12 -12
- package/src/swe-arena/gepa-seat.mts +12 -5
- package/src/swe-arena/gepa-seat.test.mts +45 -33
- package/src/swe-arena/outer-loop.mts +94 -70
- package/src/swe-arena/premeasured-from-cells.mts +16 -1
- package/src/swe-arena/premeasured-from-cells.test.mts +21 -1
- package/src/swe-arena/profiles/deepseek-author.profile.json +12 -0
- package/src/swe-arena/profiles/default-author.profile.json +9 -1
- package/src/swe-arena/proposer-fanout.mts +52 -99
- package/src/swe-arena/proposer-fanout.test.mts +92 -57
- package/src/swe-arena/proposer-provenance.mts +1 -1
- package/src/swe-code-improve.mts +30 -52
- package/src/swe-emit-patch.mts +26 -5
- package/src/swe-improve.mts +27 -8
- package/src/swe-jail.test.ts +128 -0
- package/src/swe-jail.ts +106 -22
- package/src/swe-local-proof.mts +27 -5
- package/src/swe-repro-calibrate.mts +5 -0
- package/src/swe-self-improve.mts +45 -10
- package/src/swe-stream.mts +68 -6
- package/src/swe-structural.mts +46 -7
- package/src/tb-container-executor.mts +38 -6
- package/src/tb-container-executor.test.mts +11 -3
- package/src/tb-supervisor-sidecar.mts +11 -27
- package/src/terminal-compare.ts +38 -18
- package/src/trata-gate.mts +26 -26
- package/src/trata-gepa.mts +25 -16
- package/src/trata-hedge-solve.mts +80 -0
- package/src/worker-blender.ts +21 -11
- package/src/worker-browser.ts +18 -5
- package/src/worker-build123d.ts +17 -8
- package/src/worker-cad.ts +31 -12
- package/src/worker.ts +1 -1
- package/tb_agents/opencode_router_agent.py +84 -42
- package/dist/cadbench-BrpwOU6A.js.map +0 -1
- package/dist/cadgenbench-DF7hYHdl.js.map +0 -1
- package/scripts/trata-hedge/solve.py +0 -83
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OFFLINE seams for the codemode-skill improvement harness — copied from
|
|
3
|
+
* `examples/graphs/shared.ts` (the same two seams the kernel's own graph tests use), with the
|
|
4
|
+
* imports rewritten to the worktree's own src so the bench runs against the in-repo kernel
|
|
5
|
+
* without a dist build:
|
|
6
|
+
*
|
|
7
|
+
* • `scriptedBrain` — a `ToolLoopChat` that plays a fixed sequence of driver turns.
|
|
8
|
+
* • `leafSeam` — a `MakeWorkerAgent` whose leaf executors settle instantly.
|
|
9
|
+
*
|
|
10
|
+
* Only the leaf `act` and the driver brain are scripted; the graph machinery around them
|
|
11
|
+
* (node pinning, directive delivery, edge ledger, journal twin) is the real shipped path.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { AgentProfile } from '@tangle-network/agent-interface'
|
|
15
|
+
import {
|
|
16
|
+
type Agent,
|
|
17
|
+
type AgentSpec,
|
|
18
|
+
createPushTraceSource,
|
|
19
|
+
type Executor,
|
|
20
|
+
type ExecutorResult,
|
|
21
|
+
type MakeWorkerAgent,
|
|
22
|
+
type TraceSource,
|
|
23
|
+
} from '../../../src/runtime/index.ts'
|
|
24
|
+
import type { ToolLoopChat } from '../../../src/testing/index.ts'
|
|
25
|
+
|
|
26
|
+
// ── The scripted driver brain ──────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
/** A scripted driver turn in the easy-to-write form (parsed tool args). */
|
|
29
|
+
export interface ScriptedTurn {
|
|
30
|
+
content?: string
|
|
31
|
+
toolCalls?: Array<{ id?: string; name: string; arguments: Record<string, unknown> }>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Build a scripted `ToolLoopChat` brain from a fixed turn sequence. */
|
|
35
|
+
export function scriptedBrain(turns: ScriptedTurn[]): ToolLoopChat {
|
|
36
|
+
let i = 0
|
|
37
|
+
return async () => {
|
|
38
|
+
const turn = turns[Math.min(i, turns.length - 1)] ?? {}
|
|
39
|
+
i += 1
|
|
40
|
+
return {
|
|
41
|
+
...(turn.content !== undefined ? { content: turn.content } : {}),
|
|
42
|
+
toolCalls: (turn.toolCalls ?? []).map((tc, j) => ({
|
|
43
|
+
id: tc.id ?? `call-${i}-${j}`,
|
|
44
|
+
name: tc.name,
|
|
45
|
+
arguments: JSON.stringify(tc.arguments),
|
|
46
|
+
})),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── The leaf seam ──────────────────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
/** What one settle of a node should produce (per spawn ordinal; the last entry repeats). */
|
|
54
|
+
export interface LeafShot {
|
|
55
|
+
out: unknown
|
|
56
|
+
valid: boolean
|
|
57
|
+
score?: number
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface LeafOptions {
|
|
61
|
+
/** Block settlement until a deliver() arrives — so a steer can reach a LIVE worker. */
|
|
62
|
+
awaitSteer?: boolean
|
|
63
|
+
/** Expose a live tool-trace source so settle-time analysts have evidence to read. */
|
|
64
|
+
withTrace?: boolean
|
|
65
|
+
/** Per-spawn scripts for this node (last entry repeats). Omit for a generic valid settle. */
|
|
66
|
+
shots?: ReadonlyArray<LeafShot>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** A leaf-agent factory keyed by node name; every spawned profile is captured into `received`. */
|
|
70
|
+
export function leafSeam(
|
|
71
|
+
received: AgentProfile[],
|
|
72
|
+
optsByNode: Record<string, LeafOptions> = {},
|
|
73
|
+
): MakeWorkerAgent {
|
|
74
|
+
const attempts = new Map<string, number>()
|
|
75
|
+
return (profile) => {
|
|
76
|
+
received.push(profile)
|
|
77
|
+
const name = profile.name ?? 'leaf'
|
|
78
|
+
const opts = optsByNode[name] ?? {}
|
|
79
|
+
const attempt = (attempts.get(name) ?? 0) + 1
|
|
80
|
+
attempts.set(name, attempt)
|
|
81
|
+
const shot = opts.shots?.[Math.min(attempt - 1, opts.shots.length - 1)]
|
|
82
|
+
let release: (() => void) | undefined
|
|
83
|
+
const gate = opts.awaitSteer
|
|
84
|
+
? new Promise<void>((resolve) => {
|
|
85
|
+
release = resolve
|
|
86
|
+
})
|
|
87
|
+
: undefined
|
|
88
|
+
const trace = opts.withTrace
|
|
89
|
+
? createPushTraceSource({ runId: `leaf-${name}-${attempt}` })
|
|
90
|
+
: undefined
|
|
91
|
+
let artifact: ExecutorResult<unknown> | undefined
|
|
92
|
+
const ex: Executor<unknown> = {
|
|
93
|
+
runtime: 'router',
|
|
94
|
+
...(opts.awaitSteer
|
|
95
|
+
? {
|
|
96
|
+
deliver: () => {
|
|
97
|
+
release?.()
|
|
98
|
+
return true
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
: {}),
|
|
102
|
+
...(trace ? { traceSource: (): TraceSource => trace.source } : {}),
|
|
103
|
+
async execute() {
|
|
104
|
+
if (trace) {
|
|
105
|
+
trace.record({ toolName: 'write_file', args: { path: `${name}.ts` }, status: 'ok' })
|
|
106
|
+
}
|
|
107
|
+
if (gate) await gate
|
|
108
|
+
const valid = shot ? shot.valid : true
|
|
109
|
+
artifact = {
|
|
110
|
+
outRef: `w:${name}:${attempt}`,
|
|
111
|
+
out: shot ? shot.out : { built: name, attempt },
|
|
112
|
+
verdict: { valid, score: shot?.score ?? (valid ? 1 : 0) },
|
|
113
|
+
spent: { iterations: 1, tokens: { input: 5, output: 5 }, usd: 0, ms: 0 },
|
|
114
|
+
}
|
|
115
|
+
return artifact
|
|
116
|
+
},
|
|
117
|
+
teardown: () => Promise.resolve({ destroyed: true }),
|
|
118
|
+
resultArtifact: () => {
|
|
119
|
+
if (!artifact) throw new Error(`leaf ${name}: no terminal artifact`)
|
|
120
|
+
return artifact
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
const spec: AgentSpec = { profile, harness: null, executor: ex }
|
|
124
|
+
return { name, act: async () => undefined, executorSpec: spec } as Agent<unknown, unknown> & {
|
|
125
|
+
executorSpec: AgentSpec
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|