@tangle-network/agent-bench 0.1.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/README.md +15 -0
- package/package.json +35 -0
- package/src/adapters.ts +60 -0
- package/src/aec-gate.mts +217 -0
- package/src/atom-humaneval.mts +197 -0
- package/src/atom-mcp-e2e.mts +223 -0
- package/src/benchmarks/_harness.ts +206 -0
- package/src/benchmarks/aec-bench.test.mts +53 -0
- package/src/benchmarks/aec-bench.ts +319 -0
- package/src/benchmarks/appworld.test.mts +45 -0
- package/src/benchmarks/appworld.ts +426 -0
- package/src/benchmarks/cad-design.ts +429 -0
- package/src/benchmarks/cadbench.ts +135 -0
- package/src/benchmarks/cadgenbench.ts +121 -0
- package/src/benchmarks/commit0.test.mts +71 -0
- package/src/benchmarks/commit0.ts +266 -0
- package/src/benchmarks/enterpriseops-gym.test.mts +77 -0
- package/src/benchmarks/enterpriseops-gym.ts +343 -0
- package/src/benchmarks/finsearchcomp.ts +371 -0
- package/src/benchmarks/frames.ts +520 -0
- package/src/benchmarks/hotpotqa.ts +320 -0
- package/src/benchmarks/humaneval.ts +251 -0
- package/src/benchmarks/mind2web.ts +311 -0
- package/src/benchmarks/programbench.test.mts +60 -0
- package/src/benchmarks/programbench.ts +210 -0
- package/src/benchmarks/simpleqa.ts +390 -0
- package/src/benchmarks/swe-bench.ts +152 -0
- package/src/benchmarks/terminal-bench.ts +182 -0
- package/src/benchmarks/trata-hedge.ts +496 -0
- package/src/benchmarks/types.ts +58 -0
- package/src/browser/adapters/bad-design-audit.ts +153 -0
- package/src/browser/adapters/bad-design-audit.verify.ts +85 -0
- package/src/browser/adapters/bad.ts +165 -0
- package/src/browser/agent-adapter.ts +145 -0
- package/src/browser/process-adapter.ts +146 -0
- package/src/browser/run-to-spans.ts +105 -0
- package/src/browser/run-to-spans.verify.ts +89 -0
- package/src/browser/ui-reviewer.ts +200 -0
- package/src/browser/ui-reviewer.verify.ts +94 -0
- package/src/browser/verify.ts +96 -0
- package/src/clbench-codebase-gate.mts +314 -0
- package/src/clbench-context-gate.mts +305 -0
- package/src/cloud-loop.mts +138 -0
- package/src/coding-skills/minimal-diff.md +9 -0
- package/src/coding-skills/read-before-edit.md +9 -0
- package/src/coding-skills/reproduce-first.md +10 -0
- package/src/coding-skills/run-tests-after-edit.md +9 -0
- package/src/coding-skills/trace-the-failure.md +9 -0
- package/src/commit0-env-run.mts +59 -0
- package/src/commit0-env.ts +173 -0
- package/src/commit0-gate.mts +529 -0
- package/src/commit0-prereqs.sh +48 -0
- package/src/corpus-replay.mts +300 -0
- package/src/corpus-report.mts +504 -0
- package/src/corpus.test.mts +273 -0
- package/src/corpus.ts +325 -0
- package/src/decoder-live.mts +133 -0
- package/src/directives.ts +84 -0
- package/src/diverse-gate.mjs +112 -0
- package/src/egress-probe.mts +26 -0
- package/src/eops-skills/address-every-subtask.md +5 -0
- package/src/eops-skills/exact-tools-and-args.md +5 -0
- package/src/eops-skills/full-sequence-to-goal.md +5 -0
- package/src/eops-skills/ground-every-value.md +5 -0
- package/src/eops-skills/honor-the-policies.md +5 -0
- package/src/examples/README.md +58 -0
- package/src/examples/math-demo.mts +110 -0
- package/src/examples/strategy-demo.mts +119 -0
- package/src/fleet.mts +121 -0
- package/src/gate-cli.mts +101 -0
- package/src/gate.test.mts +129 -0
- package/src/gate.ts +460 -0
- package/src/generate-eval/certify.ts +178 -0
- package/src/generate-eval/schema.ts +78 -0
- package/src/humaneval-gate.mts +204 -0
- package/src/humaneval-repair-gate.mts +143 -0
- package/src/index.ts +19 -0
- package/src/mcp-mount-probe.mts +126 -0
- package/src/profile-coordinates.ts +134 -0
- package/src/profiles.ts +128 -0
- package/src/refine-loop.test.mts +106 -0
- package/src/refine-loop.ts +106 -0
- package/src/research-gate.mts +132 -0
- package/src/research-shot.ts +134 -0
- package/src/resolve-client.ts +58 -0
- package/src/router-executor.ts +51 -0
- package/src/run-pool.ts +48 -0
- package/src/runtime-hook-recorder.ts +137 -0
- package/src/sandbox-run.ts +125 -0
- package/src/search-bench/bridge.ts +124 -0
- package/src/search-bench/export.mts +0 -0
- package/src/search-bench/parametric-check.mts +63 -0
- package/src/search-bench/profiles.ts +98 -0
- package/src/search-bench/run.mts +287 -0
- package/src/search-bench/tasks-fresh.ts +688 -0
- package/src/search-bench/tasks.ts +129 -0
- package/src/search-tool.ts +95 -0
- package/src/selector.test.mts +189 -0
- package/src/selector.ts +366 -0
- package/src/skill-sandbox-smoke.mts +100 -0
- package/src/stats.mts +90 -0
- package/src/terminal-compare.ts +519 -0
- package/src/trajectory-assemble.mjs +130 -0
- package/src/trata-gate.mts +243 -0
- package/src/trata-gepa.mts +434 -0
- package/src/worker-blender.ts +230 -0
- package/src/worker-browser.ts +102 -0
- package/src/worker-build123d.ts +143 -0
- package/src/worker-cad.ts +451 -0
- package/src/worker.ts +136 -0
- package/src/workspace-loop.mts +133 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decisive de-risk: does a git-backed shared workspace make accumulating,
|
|
3
|
+
* resumable, multi-worker loops REAL on a share-nothing substrate?
|
|
4
|
+
*
|
|
5
|
+
* The red-team's fatal finding: each cloud worker is a fresh box with no shared
|
|
6
|
+
* filesystem, so "worker N+1 builds on worker N's code" is impossible and resume
|
|
7
|
+
* restores decisions, not the mutated workspace. The proposed fix: a git-backed
|
|
8
|
+
* contract. This proves or kills it on 3 dependency-ordered modules (a←b←c).
|
|
9
|
+
*
|
|
10
|
+
* - The DURABLE WORKSPACE = a bare git repo (models a GitHub branch in cloud).
|
|
11
|
+
* - Each WORKER = a FRESH temp clone (models a fresh box's empty FS), torn down
|
|
12
|
+
* after it commits+pushes. State survives ONLY because git persisted it.
|
|
13
|
+
* - THE PROOF: a worker asserts its dependency's file is on disk in its fresh
|
|
14
|
+
* clone. Fails on share-nothing (names-in-a-string); passes on the git seam.
|
|
15
|
+
*
|
|
16
|
+
* Test (a) — does it link? full run → integration test imports a←b←c, must pass.
|
|
17
|
+
* Test (b) — resume? KILL_AFTER=b, then RESUME=1: c clones a repo that
|
|
18
|
+
* HAS a+b committed (durable), re-runs ONLY c, links.
|
|
19
|
+
*
|
|
20
|
+
* pnpm exec tsx src/workspace-loop.mts # (a) happy path
|
|
21
|
+
* KILL_AFTER=b pnpm exec tsx src/workspace-loop.mts # die after b
|
|
22
|
+
* RESUME=1 pnpm exec tsx src/workspace-loop.mts # (b) resume → finish c
|
|
23
|
+
*/
|
|
24
|
+
import { execFileSync } from 'node:child_process'
|
|
25
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
26
|
+
import { appendFileSync } from 'node:fs'
|
|
27
|
+
import { tmpdir } from 'node:os'
|
|
28
|
+
import { join } from 'node:path'
|
|
29
|
+
|
|
30
|
+
const BARE = '/tmp/workspace-loop.git' // the durable shared workspace (≈ a remote branch)
|
|
31
|
+
const JOURNAL = '/tmp/workspace-loop.journal' // the decision record (which modules are committed)
|
|
32
|
+
|
|
33
|
+
const sh = (cmd: string, args: string[], cwd?: string): string =>
|
|
34
|
+
execFileSync(cmd, args, { cwd, stdio: 'pipe', encoding: 'utf-8' })
|
|
35
|
+
const git = (args: string[], cwd?: string): string =>
|
|
36
|
+
// hooksPath=/dev/null: these are throwaway test clones, not project repos — the
|
|
37
|
+
// operator's global ai-agent-hooks must not run on them.
|
|
38
|
+
sh('git', ['-c', 'core.hooksPath=/dev/null', '-c', 'user.email=loop@tangle', '-c', 'user.name=loop', ...args], cwd)
|
|
39
|
+
|
|
40
|
+
/** a←b←c: c.top(1) = ((1+1)*2)+3 = 7. The integration test imports the whole chain,
|
|
41
|
+
* so it passes ONLY if all three files accumulated in the workspace. */
|
|
42
|
+
const modules = [
|
|
43
|
+
{ id: 'a', file: 'a.py', dep: null as string | null, code: 'def base(x):\n return x + 1\n' },
|
|
44
|
+
{ id: 'b', file: 'b.py', dep: 'a', code: 'from a import base\n\ndef mid(x):\n return base(x) * 2\n' },
|
|
45
|
+
{ id: 'c', file: 'c.py', dep: 'b', code: 'from b import mid\n\ndef top(x):\n return mid(x) + 3\n' },
|
|
46
|
+
]
|
|
47
|
+
const depFile = (id: string): string => modules.find((m) => m.id === id)!.file
|
|
48
|
+
|
|
49
|
+
function initWorkspace(): void {
|
|
50
|
+
rmSync(BARE, { recursive: true, force: true })
|
|
51
|
+
rmSync(JOURNAL, { force: true })
|
|
52
|
+
git(['init', '--bare', '-b', 'main', BARE])
|
|
53
|
+
// seed: the integration test, on the branch from commit 0.
|
|
54
|
+
const seed = mkdtempSync(join(tmpdir(), 'wl-seed-'))
|
|
55
|
+
git(['clone', BARE, seed])
|
|
56
|
+
writeFileSync(join(seed, 'test_all.py'), 'from c import top\n\nassert top(1) == 7, top(1)\nprint("INTEGRATION OK")\n')
|
|
57
|
+
git(['add', '-A'], seed)
|
|
58
|
+
git(['commit', '-m', 'seed: integration test'], seed)
|
|
59
|
+
git(['push', 'origin', 'main'], seed)
|
|
60
|
+
rmSync(seed, { recursive: true, force: true })
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function loadJournal(): Set<string> {
|
|
64
|
+
if (!existsSync(JOURNAL)) return new Set()
|
|
65
|
+
return new Set(readFileSync(JOURNAL, 'utf-8').split('\n').filter(Boolean))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** One worker: fresh clone (empty box FS) → verify dep is ON DISK → port → push → torn down. */
|
|
69
|
+
function runWorker(m: (typeof modules)[number]): void {
|
|
70
|
+
const work = mkdtempSync(join(tmpdir(), `wl-${m.id}-`))
|
|
71
|
+
try {
|
|
72
|
+
git(['clone', BARE, work]) // a brand-new, otherwise-empty box
|
|
73
|
+
// THE PROOF: did the durable workspace carry my dependency's code to this fresh box?
|
|
74
|
+
if (m.dep) {
|
|
75
|
+
const present = existsSync(join(work, depFile(m.dep)))
|
|
76
|
+
console.error(` [${m.id}] fresh clone — dependency ${depFile(m.dep)} on disk? ${present ? 'YES ✓ (git carried it)' : 'NO ✗ (share-nothing)'}`)
|
|
77
|
+
if (!present) throw new Error(`SHARE-NOTHING: ${m.id} cannot see ${m.dep} — the seam is broken`)
|
|
78
|
+
} else {
|
|
79
|
+
console.error(` [${m.id}] fresh clone — root module, no dependency`)
|
|
80
|
+
}
|
|
81
|
+
writeFileSync(join(work, m.file), m.code) // port the module
|
|
82
|
+
git(['add', '-A'], work)
|
|
83
|
+
git(['commit', '-m', `port ${m.id}`], work)
|
|
84
|
+
git(['push', 'origin', 'main'], work) // accumulate into the durable workspace
|
|
85
|
+
appendFileSync(JOURNAL, `${m.id}\n`) // record the decision durably
|
|
86
|
+
console.error(` [${m.id}] ported + committed + pushed → torn down`)
|
|
87
|
+
} finally {
|
|
88
|
+
rmSync(work, { recursive: true, force: true }) // teardown — the box dies, git survives
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Test (a): a fresh clone of the durable workspace must pass the integration test. */
|
|
93
|
+
function integrationLinks(): boolean {
|
|
94
|
+
const check = mkdtempSync(join(tmpdir(), 'wl-check-'))
|
|
95
|
+
try {
|
|
96
|
+
git(['clone', BARE, check])
|
|
97
|
+
const out = sh('python3', ['test_all.py'], check)
|
|
98
|
+
console.error(` integration: ${out.trim()}`)
|
|
99
|
+
return out.includes('INTEGRATION OK')
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(` integration FAILED: ${e instanceof Error ? e.message.split('\n').slice(-3).join(' ') : e}`)
|
|
102
|
+
return false
|
|
103
|
+
} finally {
|
|
104
|
+
rmSync(check, { recursive: true, force: true })
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function main(): void {
|
|
109
|
+
const resume = process.env.RESUME === '1'
|
|
110
|
+
const killAfter = process.env.KILL_AFTER
|
|
111
|
+
if (!resume) initWorkspace()
|
|
112
|
+
const done = loadJournal()
|
|
113
|
+
console.error(`\n=== git-backed workspace loop · ${resume ? 'RESUME' : 'fresh'}${done.size ? ` (done: ${[...done].join(',')})` : ''} ===`)
|
|
114
|
+
|
|
115
|
+
for (const m of modules) {
|
|
116
|
+
if (done.has(m.id)) {
|
|
117
|
+
console.error(` [${m.id}] skip — already committed (resumed from durable git)`)
|
|
118
|
+
continue
|
|
119
|
+
}
|
|
120
|
+
if (m.dep && !loadJournal().has(m.dep)) throw new Error(`${m.id} blocked: dependency ${m.dep} not done (topo order)`)
|
|
121
|
+
runWorker(m)
|
|
122
|
+
if (killAfter === m.id) {
|
|
123
|
+
console.error(`\n💥 KILLED after ${m.id} (orchestrator death). Durable git has: ${[...loadJournal()].join(',')}. Re-run with RESUME=1.\n`)
|
|
124
|
+
process.exit(1)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const links = integrationLinks()
|
|
129
|
+
console.error(`\n=== ${links ? '✅ LINKS — git-backed workspace + resume is REAL' : '❌ does not link'} ===`)
|
|
130
|
+
process.exit(links ? 0 : 1)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
main()
|