@tangle-network/agent-bench 0.4.7 → 0.4.9
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 +9 -0
- package/HARNESS.md +1 -1
- package/dist/adapters.js +2 -2
- package/dist/benchmarks/agentbench.d.ts +1 -1
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +1 -1
- package/dist/benchmarks/appworld.js +1 -1
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +1 -1
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +1 -1
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +1 -1
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +1 -1
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +1 -1
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +1 -1
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +1 -1
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +1 -1
- package/dist/benchmarks/toollm.d.ts +1 -1
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/types.d.ts +1 -1
- package/dist/benchmarks/webarena-verified.d.ts +1 -1
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-DpQWZHp4.js → cadbench-BrpwOU6A.js} +2 -2
- package/dist/cadbench-BrpwOU6A.js.map +1 -0
- package/dist/{cadgenbench-DRhczfsG.js → cadgenbench-DF7hYHdl.js} +2 -2
- package/dist/cadgenbench-DF7hYHdl.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/scripts/verify-packed-consumer.mjs +38 -15
- package/scripts/wait-for-published-dependencies.mjs +245 -0
- package/scripts/wait-for-published-dependencies.test.mjs +96 -0
- package/src/aec-gate.mts +1 -1
- package/src/benchmarks/agentbench.ts +1 -1
- package/src/benchmarks/appworld.ts +1 -1
- package/src/benchmarks/bfcl.ts +1 -1
- package/src/benchmarks/commit0.ts +1 -1
- package/src/benchmarks/dabstep.ts +1 -1
- package/src/benchmarks/enterpriseops-gym.ts +1 -1
- package/src/benchmarks/programbench.ts +1 -1
- package/src/benchmarks/rag-shared.ts +1 -1
- package/src/benchmarks/swe-bench.ts +1 -1
- package/src/benchmarks/tau-bench-shared.ts +1 -1
- package/src/benchmarks/toollm.ts +1 -1
- package/src/benchmarks/types.ts +1 -1
- package/src/benchmarks/webarena-verified.ts +1 -1
- package/src/clbench-codebase-gate.mts +1 -1
- package/src/clbench-context-gate.mts +1 -1
- package/src/cloud-loop.mts +1 -1
- package/src/commit0-env-run.mts +1 -1
- package/src/commit0-env.ts +1 -1
- package/src/commit0-gate.mts +1 -1
- package/src/corpus.ts +1 -1
- package/src/examples/lean-proof-gate.mts +1 -1
- package/src/examples/math-demo.mts +1 -1
- package/src/examples/strategy-demo.mts +1 -1
- package/src/fleet.mts +1 -1
- package/src/gate-cli.mts +1 -1
- package/src/gate.test.mts +1 -1
- package/src/gate.ts +2 -2
- package/src/generate-eval/certify.ts +1 -1
- package/src/humaneval-gate.mts +1 -1
- package/src/humaneval-repair-gate.mts +1 -1
- package/src/research-shot.ts +1 -1
- package/src/resolve-client.ts +1 -1
- package/src/router-executor.ts +1 -1
- package/src/run-benchmarks-report.ts +1 -1
- package/src/run-benchmarks.test.mts +1 -1
- package/src/run-benchmarks.ts +2 -2
- package/src/sandbox-run.ts +3 -3
- package/src/search-bench/bridge.ts +1 -1
- package/src/search-bench/parametric-check.mts +1 -1
- package/src/search-bench/run.mts +1 -1
- package/src/search-tool.ts +1 -1
- package/src/swe-arena/fixtures/factory/loops-28/calibration.md +1 -1
- package/src/swe-arena/fixtures/gen1-salvage/cand1-76a8590.diff +1 -1
- package/src/swe-bench-env.ts +1 -1
- package/src/swe-emit-patch.mts +2 -2
- package/src/swe-improve.mts +2 -2
- package/src/swe-local-proof.mts +2 -2
- package/src/swe-repro-calibrate.mts +1 -1
- package/src/swe-self-improve.mts +1 -1
- package/src/swe-stream.mts +2 -2
- package/src/swe-structural.mts +2 -2
- package/src/tb-container-executor.test.mts +1 -1
- package/src/worker-blender.ts +1 -1
- package/src/worker-browser.ts +1 -1
- package/src/worker-build123d.ts +1 -1
- package/src/worker-cad.ts +1 -1
- package/src/worker.ts +1 -1
- package/dist/cadbench-DpQWZHp4.js.map +0 -1
- package/dist/cadgenbench-DRhczfsG.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-bench",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Benchmark adapters and execution for agent-runtime across coding, tool-use, RAG, memory, browser, and terminal tasks.",
|
|
6
6
|
"repository": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@tangle-network/agent-eval": "0.
|
|
28
|
+
"@tangle-network/agent-eval": "0.135.2",
|
|
29
29
|
"@tangle-network/agent-interface": "0.36.0",
|
|
30
|
-
"@tangle-network/agent-knowledge": "6.1.
|
|
30
|
+
"@tangle-network/agent-knowledge": "6.1.11",
|
|
31
31
|
"@tangle-network/sandbox": "0.15.2",
|
|
32
|
-
"@tangle-network/agent-runtime": "0.
|
|
32
|
+
"@tangle-network/agent-runtime": "0.109.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@arethetypeswrong/cli": "0.18.5",
|
|
@@ -69,11 +69,12 @@
|
|
|
69
69
|
"run-benchmarks": "tsx src/run-benchmarks-cli.mts",
|
|
70
70
|
"gate-report": "tsx src/corpus-report.mts corpus/finsearch.jsonl",
|
|
71
71
|
"terminal-compare": "tsx src/terminal-compare.ts",
|
|
72
|
-
"test": "node scripts/run-package-tests.mjs",
|
|
72
|
+
"test": "node scripts/run-package-tests.mjs && node --test scripts/wait-for-published-dependencies.test.mjs",
|
|
73
73
|
"typecheck:public": "tsc -p tsconfig.public.json",
|
|
74
74
|
"verify:package": "pnpm run verify:package:static && node scripts/verify-packed-consumer.mjs",
|
|
75
75
|
"verify:package:local-runtime": "pnpm run verify:package:static && node scripts/verify-packed-consumer.mjs --local-runtime",
|
|
76
76
|
"verify:package:static": "pnpm run build && publint && attw --pack --profile esm-only .",
|
|
77
|
+
"wait:published-dependencies": "node scripts/wait-for-published-dependencies.mjs",
|
|
77
78
|
"verify:pier": "tsx scripts/verify-pier-pair.mts"
|
|
78
79
|
}
|
|
79
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process'
|
|
2
|
-
import { mkdtemp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { access, mkdtemp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
@@ -9,9 +9,10 @@ const execFileAsync = promisify(execFile)
|
|
|
9
9
|
const benchDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
10
10
|
const repoRoot = path.resolve(benchDir, '..')
|
|
11
11
|
const scratch = await mkdtemp(path.join(tmpdir(), 'agent-bench-consumer-'))
|
|
12
|
-
const args =
|
|
13
|
-
const useLocalRuntime = args
|
|
14
|
-
|
|
12
|
+
const args = process.argv.slice(2)
|
|
13
|
+
const useLocalRuntime = removeFlag(args, '--local-runtime')
|
|
14
|
+
const suppliedTarball = removeOption(args, '--tarball')
|
|
15
|
+
if (args.length > 0) throw new Error(`unknown arguments: ${args.join(', ')}`)
|
|
15
16
|
|
|
16
17
|
const TYPESCRIPT_5 = '5.9.3'
|
|
17
18
|
const TYPESCRIPT_6 = '6.0.3'
|
|
@@ -105,18 +106,24 @@ writeFileSync(
|
|
|
105
106
|
{ mode: 0o755 },
|
|
106
107
|
)
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
let tarball
|
|
110
|
+
if (suppliedTarball) {
|
|
111
|
+
tarball = path.resolve(suppliedTarball)
|
|
112
|
+
await access(tarball)
|
|
113
|
+
} else {
|
|
114
|
+
// Build explicitly so verification cannot inherit a machine-level
|
|
115
|
+
// ignore-scripts setting and accidentally pack stale or missing output.
|
|
116
|
+
await run('pnpm', ['build'], benchDir)
|
|
117
|
+
await run('pnpm', ['pack', '--pack-destination', packDir], benchDir, {
|
|
118
|
+
...process.env,
|
|
119
|
+
npm_config_ignore_scripts: 'true',
|
|
120
|
+
})
|
|
121
|
+
const packedFiles = (await readdir(packDir)).filter((name) => name.endsWith('.tgz'))
|
|
122
|
+
if (packedFiles.length !== 1) {
|
|
123
|
+
throw new Error(`expected one packed agent-bench tarball, found ${packedFiles.length}`)
|
|
124
|
+
}
|
|
125
|
+
tarball = path.join(packDir, packedFiles[0])
|
|
118
126
|
}
|
|
119
|
-
const tarball = path.join(packDir, packedFiles[0])
|
|
120
127
|
await run('tar', ['-xzf', tarball, '-C', unpackDir], benchDir)
|
|
121
128
|
const runtimePackage = await resolveRuntimePackage(runtimePackDir)
|
|
122
129
|
const packedManifest = JSON.parse(
|
|
@@ -300,3 +307,19 @@ function requiredPackedDevelopmentDependency(packageJson, name) {
|
|
|
300
307
|
}
|
|
301
308
|
return version
|
|
302
309
|
}
|
|
310
|
+
|
|
311
|
+
function removeFlag(args, flag) {
|
|
312
|
+
const index = args.indexOf(flag)
|
|
313
|
+
if (index === -1) return false
|
|
314
|
+
args.splice(index, 1)
|
|
315
|
+
return true
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function removeOption(args, option) {
|
|
319
|
+
const index = args.indexOf(option)
|
|
320
|
+
if (index === -1) return undefined
|
|
321
|
+
const value = args[index + 1]
|
|
322
|
+
if (!value || value.startsWith('--')) throw new Error(`${option} requires a value`)
|
|
323
|
+
args.splice(index, 2)
|
|
324
|
+
return value
|
|
325
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
|
+
import { mkdtemp, readFile, readdir, rm } from 'node:fs/promises'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { promisify } from 'node:util'
|
|
7
|
+
|
|
8
|
+
const execFileAsync = promisify(execFile)
|
|
9
|
+
const benchDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
10
|
+
const localDependencyProtocol = /^(?:catalog|file|link|patch|portal|workspace):/
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_TIMEOUT_MS = 20 * 60_000
|
|
13
|
+
export const DEFAULT_INTERVAL_MS = 15_000
|
|
14
|
+
|
|
15
|
+
export function collectRequiredTangleDependencies(packageJson) {
|
|
16
|
+
const dependencies = new Map()
|
|
17
|
+
const sections = [
|
|
18
|
+
['dependencies', packageJson.dependencies],
|
|
19
|
+
['peerDependencies', packageJson.peerDependencies],
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
for (const [section, entries] of sections) {
|
|
23
|
+
for (const [name, spec] of Object.entries(entries ?? {})) {
|
|
24
|
+
if (!name.startsWith('@tangle-network/')) continue
|
|
25
|
+
if (
|
|
26
|
+
section === 'peerDependencies' &&
|
|
27
|
+
packageJson.peerDependenciesMeta?.[name]?.optional === true
|
|
28
|
+
) {
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
if (
|
|
32
|
+
typeof spec !== 'string' ||
|
|
33
|
+
spec.length === 0 ||
|
|
34
|
+
localDependencyProtocol.test(spec)
|
|
35
|
+
) {
|
|
36
|
+
throw new Error(`${packageJson.name} has no published ${name} dependency version`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const previous = dependencies.get(name)
|
|
40
|
+
if (previous && previous !== spec) {
|
|
41
|
+
throw new Error(`${packageJson.name} declares conflicting versions for ${name}`)
|
|
42
|
+
}
|
|
43
|
+
dependencies.set(name, spec)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return [...dependencies]
|
|
48
|
+
.map(([name, spec]) => ({ name, spec }))
|
|
49
|
+
.sort((left, right) => left.name.localeCompare(right.name))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function waitForPublishedDependencies(
|
|
53
|
+
dependencies,
|
|
54
|
+
{
|
|
55
|
+
timeoutMs = DEFAULT_TIMEOUT_MS,
|
|
56
|
+
intervalMs = DEFAULT_INTERVAL_MS,
|
|
57
|
+
probe = probeNpm,
|
|
58
|
+
sleep = (milliseconds) =>
|
|
59
|
+
new Promise((resolveSleep) => setTimeout(resolveSleep, milliseconds)),
|
|
60
|
+
now = Date.now,
|
|
61
|
+
report = console.log,
|
|
62
|
+
} = {},
|
|
63
|
+
) {
|
|
64
|
+
requirePositiveInteger('timeoutMs', timeoutMs)
|
|
65
|
+
requirePositiveInteger('intervalMs', intervalMs)
|
|
66
|
+
if (dependencies.length === 0) {
|
|
67
|
+
throw new Error('agent-bench has no required published @tangle-network dependencies')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const startedAt = now()
|
|
71
|
+
const deadline = startedAt + timeoutMs
|
|
72
|
+
let attempts = 0
|
|
73
|
+
let pending = dependencies.map((dependency) => ({ dependency, detail: 'not checked' }))
|
|
74
|
+
|
|
75
|
+
report(
|
|
76
|
+
`Waiting up to ${formatDuration(timeoutMs)} for ${dependencies.length} published dependencies`,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
while (true) {
|
|
80
|
+
if (attempts > 0 && now() >= deadline) {
|
|
81
|
+
throw timeoutError(timeoutMs, attempts, pending)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
attempts += 1
|
|
85
|
+
const results = await Promise.all(
|
|
86
|
+
pending.map(async ({ dependency }) => {
|
|
87
|
+
try {
|
|
88
|
+
const result = await probe(dependency, {
|
|
89
|
+
timeoutMs: Math.max(1, deadline - now()),
|
|
90
|
+
})
|
|
91
|
+
return result.available
|
|
92
|
+
? undefined
|
|
93
|
+
: { dependency, detail: result.detail ?? 'not available' }
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return {
|
|
96
|
+
dependency,
|
|
97
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
)
|
|
102
|
+
pending = results.filter((result) => result !== undefined)
|
|
103
|
+
|
|
104
|
+
if (pending.length === 0) {
|
|
105
|
+
return { attempts, elapsedMs: now() - startedAt }
|
|
106
|
+
}
|
|
107
|
+
if (now() >= deadline) {
|
|
108
|
+
throw timeoutError(timeoutMs, attempts, pending)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const delayMs = Math.min(intervalMs, deadline - now())
|
|
112
|
+
report(
|
|
113
|
+
`Attempt ${attempts}: ${pending.length}/${dependencies.length} unavailable: ${pending
|
|
114
|
+
.map(({ dependency }) => `${dependency.name}@${dependency.spec}`)
|
|
115
|
+
.join(', ')}. Retrying in ${formatDuration(delayMs)}`,
|
|
116
|
+
)
|
|
117
|
+
await sleep(delayMs)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function probeNpm(dependency, { timeoutMs }) {
|
|
122
|
+
try {
|
|
123
|
+
const { stdout } = await execFileAsync(
|
|
124
|
+
'npm',
|
|
125
|
+
[
|
|
126
|
+
'view',
|
|
127
|
+
`${dependency.name}@${dependency.spec}`,
|
|
128
|
+
'version',
|
|
129
|
+
'--json',
|
|
130
|
+
'--prefer-online',
|
|
131
|
+
],
|
|
132
|
+
{
|
|
133
|
+
env: { ...process.env, npm_config_color: 'false' },
|
|
134
|
+
maxBuffer: 1024 * 1024,
|
|
135
|
+
timeout: Math.min(30_000, timeoutMs),
|
|
136
|
+
},
|
|
137
|
+
)
|
|
138
|
+
const version = JSON.parse(stdout)
|
|
139
|
+
const available =
|
|
140
|
+
(typeof version === 'string' && version.length > 0) ||
|
|
141
|
+
(Array.isArray(version) && version.length > 0)
|
|
142
|
+
return available
|
|
143
|
+
? { available: true }
|
|
144
|
+
: { available: false, detail: 'npm returned no matching version' }
|
|
145
|
+
} catch (error) {
|
|
146
|
+
return { available: false, detail: summarizeCommandError(error) }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function readPackedBenchManifest() {
|
|
151
|
+
const scratch = await mkdtemp(path.join(tmpdir(), 'agent-bench-published-dependencies-'))
|
|
152
|
+
try {
|
|
153
|
+
await execFileAsync('pnpm', ['pack', '--pack-destination', scratch], {
|
|
154
|
+
cwd: benchDir,
|
|
155
|
+
env: { ...process.env, npm_config_ignore_scripts: 'true' },
|
|
156
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
157
|
+
timeout: 120_000,
|
|
158
|
+
})
|
|
159
|
+
const tarballs = (await readdir(scratch)).filter((name) => name.endsWith('.tgz'))
|
|
160
|
+
if (tarballs.length !== 1) {
|
|
161
|
+
throw new Error(`expected one packed agent-bench tarball, found ${tarballs.length}`)
|
|
162
|
+
}
|
|
163
|
+
const { stdout } = await execFileAsync(
|
|
164
|
+
'tar',
|
|
165
|
+
['-xOzf', path.join(scratch, tarballs[0]), 'package/package.json'],
|
|
166
|
+
{ maxBuffer: 1024 * 1024, timeout: 30_000 },
|
|
167
|
+
)
|
|
168
|
+
return JSON.parse(stdout)
|
|
169
|
+
} finally {
|
|
170
|
+
await rm(scratch, { recursive: true, force: true })
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function timeoutError(timeoutMs, attempts, pending) {
|
|
175
|
+
const details = pending
|
|
176
|
+
.map(
|
|
177
|
+
({ dependency, detail }) =>
|
|
178
|
+
`- ${dependency.name}@${dependency.spec}: ${firstLine(detail)}`,
|
|
179
|
+
)
|
|
180
|
+
.join('\n')
|
|
181
|
+
return new Error(
|
|
182
|
+
`Timed out after ${formatDuration(timeoutMs)} and ${attempts} attempts waiting for ${pending.length} published dependencies:\n${details}`,
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function summarizeCommandError(error) {
|
|
187
|
+
if (!(error instanceof Error)) return String(error)
|
|
188
|
+
const stderr = typeof error.stderr === 'string' ? error.stderr.trim() : ''
|
|
189
|
+
return firstLine(stderr || error.message)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function firstLine(value) {
|
|
193
|
+
return String(value).split(/\r?\n/, 1)[0]
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function formatDuration(milliseconds) {
|
|
197
|
+
if (milliseconds >= 60_000 && milliseconds % 60_000 === 0) {
|
|
198
|
+
return `${milliseconds / 60_000}m`
|
|
199
|
+
}
|
|
200
|
+
if (milliseconds >= 1_000 && milliseconds % 1_000 === 0) {
|
|
201
|
+
return `${milliseconds / 1_000}s`
|
|
202
|
+
}
|
|
203
|
+
return `${milliseconds}ms`
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function requirePositiveInteger(name, value) {
|
|
207
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
208
|
+
throw new Error(`${name} must be a positive integer`)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function readPositiveInteger(name, fallback) {
|
|
213
|
+
const value = process.env[name]
|
|
214
|
+
if (value === undefined) return fallback
|
|
215
|
+
const parsed = Number(value)
|
|
216
|
+
requirePositiveInteger(name, parsed)
|
|
217
|
+
return parsed
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async function main() {
|
|
221
|
+
const packageJson = await readPackedBenchManifest()
|
|
222
|
+
const dependencies = collectRequiredTangleDependencies(packageJson)
|
|
223
|
+
const result = await waitForPublishedDependencies(dependencies, {
|
|
224
|
+
timeoutMs: readPositiveInteger(
|
|
225
|
+
'BENCH_PUBLISH_WAIT_TIMEOUT_MS',
|
|
226
|
+
DEFAULT_TIMEOUT_MS,
|
|
227
|
+
),
|
|
228
|
+
intervalMs: readPositiveInteger(
|
|
229
|
+
'BENCH_PUBLISH_WAIT_INTERVAL_MS',
|
|
230
|
+
DEFAULT_INTERVAL_MS,
|
|
231
|
+
),
|
|
232
|
+
})
|
|
233
|
+
console.log(
|
|
234
|
+
`Published dependencies ready after ${result.attempts} attempt(s) in ${formatDuration(result.elapsedMs)}: ${dependencies
|
|
235
|
+
.map(({ name, spec }) => `${name}@${spec}`)
|
|
236
|
+
.join(', ')}`,
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (path.resolve(process.argv[1] ?? '') === fileURLToPath(import.meta.url)) {
|
|
241
|
+
main().catch((error) => {
|
|
242
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
243
|
+
process.exitCode = 1
|
|
244
|
+
})
|
|
245
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import test from 'node:test'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
collectRequiredTangleDependencies,
|
|
6
|
+
waitForPublishedDependencies,
|
|
7
|
+
} from './wait-for-published-dependencies.mjs'
|
|
8
|
+
|
|
9
|
+
test('collects required published Tangle dependencies from a packed manifest', () => {
|
|
10
|
+
const dependencies = collectRequiredTangleDependencies({
|
|
11
|
+
name: '@tangle-network/agent-bench',
|
|
12
|
+
dependencies: {
|
|
13
|
+
'@tangle-network/agent-runtime': '0.109.2',
|
|
14
|
+
'@tangle-network/agent-eval': '0.135.2',
|
|
15
|
+
undici: '^7.0.0',
|
|
16
|
+
},
|
|
17
|
+
peerDependencies: {
|
|
18
|
+
'@tangle-network/agent-interface': '>=0.36.0 <0.37.0',
|
|
19
|
+
'@tangle-network/optional-peer': '1.0.0',
|
|
20
|
+
},
|
|
21
|
+
peerDependenciesMeta: {
|
|
22
|
+
'@tangle-network/optional-peer': { optional: true },
|
|
23
|
+
},
|
|
24
|
+
devDependencies: {
|
|
25
|
+
'@tangle-network/dev-only': '1.0.0',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
assert.deepEqual(dependencies, [
|
|
30
|
+
{ name: '@tangle-network/agent-eval', spec: '0.135.2' },
|
|
31
|
+
{ name: '@tangle-network/agent-interface', spec: '>=0.36.0 <0.37.0' },
|
|
32
|
+
{ name: '@tangle-network/agent-runtime', spec: '0.109.2' },
|
|
33
|
+
])
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('retries only unavailable dependencies until all are published', async () => {
|
|
37
|
+
const dependencies = [
|
|
38
|
+
{ name: '@tangle-network/already-published', spec: '1.0.0' },
|
|
39
|
+
{ name: '@tangle-network/publishes-later', spec: '2.0.0' },
|
|
40
|
+
]
|
|
41
|
+
const calls = new Map()
|
|
42
|
+
const reports = []
|
|
43
|
+
let currentTime = 0
|
|
44
|
+
|
|
45
|
+
const result = await waitForPublishedDependencies(dependencies, {
|
|
46
|
+
timeoutMs: 100,
|
|
47
|
+
intervalMs: 25,
|
|
48
|
+
now: () => currentTime,
|
|
49
|
+
sleep: async (milliseconds) => {
|
|
50
|
+
currentTime += milliseconds
|
|
51
|
+
},
|
|
52
|
+
probe: async ({ name }) => {
|
|
53
|
+
const count = (calls.get(name) ?? 0) + 1
|
|
54
|
+
calls.set(name, count)
|
|
55
|
+
return {
|
|
56
|
+
available: name.endsWith('already-published') || count >= 3,
|
|
57
|
+
detail: 'not published yet',
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
report: (message) => reports.push(message),
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
assert.deepEqual(result, { attempts: 3, elapsedMs: 50 })
|
|
64
|
+
assert.equal(calls.get('@tangle-network/already-published'), 1)
|
|
65
|
+
assert.equal(calls.get('@tangle-network/publishes-later'), 3)
|
|
66
|
+
assert.equal(reports.length, 3)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('fails at the deadline and names every dependency still missing', async () => {
|
|
70
|
+
const dependencies = [
|
|
71
|
+
{ name: '@tangle-network/never-published', spec: '9.9.9' },
|
|
72
|
+
{ name: '@tangle-network/also-missing', spec: '8.8.8' },
|
|
73
|
+
]
|
|
74
|
+
let currentTime = 0
|
|
75
|
+
|
|
76
|
+
await assert.rejects(
|
|
77
|
+
waitForPublishedDependencies(dependencies, {
|
|
78
|
+
timeoutMs: 100,
|
|
79
|
+
intervalMs: 40,
|
|
80
|
+
now: () => currentTime,
|
|
81
|
+
sleep: async (milliseconds) => {
|
|
82
|
+
currentTime += milliseconds
|
|
83
|
+
},
|
|
84
|
+
probe: async () => ({ available: false, detail: 'npm error code E404' }),
|
|
85
|
+
report: () => {},
|
|
86
|
+
}),
|
|
87
|
+
(error) => {
|
|
88
|
+
assert.match(error.message, /Timed out after 100ms and 3 attempts/)
|
|
89
|
+
assert.match(error.message, /@tangle-network\/never-published@9\.9\.9/)
|
|
90
|
+
assert.match(error.message, /@tangle-network\/also-missing@8\.8\.8/)
|
|
91
|
+
assert.match(error.message, /npm error code E404/)
|
|
92
|
+
return true
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
assert.equal(currentTime, 100)
|
|
96
|
+
})
|
package/src/aec-gate.mts
CHANGED
|
@@ -22,7 +22,7 @@ import { resolveAdapter } from './adapters'
|
|
|
22
22
|
import type { BenchmarkAdapter, BenchTask } from './benchmarks/types'
|
|
23
23
|
import { type AttemptRecord, appendRunRecord, buildRunRecordFromAttempts } from './corpus'
|
|
24
24
|
import { composeStrategies } from './directives'
|
|
25
|
-
import { type RouterConfig, routerChatWithUsage } from '@tangle-network/agent-runtime/
|
|
25
|
+
import { type RouterConfig, routerChatWithUsage } from '@tangle-network/agent-runtime/kernel'
|
|
26
26
|
import { pool } from './stats.mts'
|
|
27
27
|
|
|
28
28
|
function must(name: string): string {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { readFile } from 'node:fs/promises'
|
|
11
11
|
import { join } from 'node:path'
|
|
12
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
12
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
13
13
|
import { benchRoot } from './_harness'
|
|
14
14
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
15
15
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { spawn } from 'node:child_process'
|
|
23
23
|
import { join } from 'node:path'
|
|
24
24
|
import { createInterface } from 'node:readline'
|
|
25
|
-
import { type OutputAdapter, routerToolLoop, type ToolSpec } from '@tangle-network/agent-runtime/
|
|
25
|
+
import { type OutputAdapter, routerToolLoop, type ToolSpec } from '@tangle-network/agent-runtime/kernel'
|
|
26
26
|
import { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPython } from './_harness'
|
|
27
27
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
28
28
|
|
package/src/benchmarks/bfcl.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { readFile, stat } from 'node:fs/promises'
|
|
13
13
|
import { join } from 'node:path'
|
|
14
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
14
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
15
15
|
import { benchRoot } from './_harness'
|
|
16
16
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import { join } from 'node:path'
|
|
25
25
|
import { readFile } from 'node:fs/promises'
|
|
26
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
26
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
27
27
|
import { benchRoot, preflightVenvImports, runVenvScriptStdin, venvPythonAt } from './_harness'
|
|
28
28
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
29
29
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { join } from 'node:path'
|
|
13
13
|
import { access, readFile, stat } from 'node:fs/promises'
|
|
14
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
14
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
15
15
|
import { benchRoot, runVenvPython, runVenvScriptStdin } from './_harness'
|
|
16
16
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
32
32
|
import { join } from 'node:path'
|
|
33
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
33
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
34
34
|
import { benchRoot, runVenvScriptStdin } from './_harness'
|
|
35
35
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
36
36
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import { join } from 'node:path'
|
|
27
27
|
import { readFile } from 'node:fs/promises'
|
|
28
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
28
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
29
29
|
import { benchRoot, preflightVenvImports, runVenvScriptStdin } from './_harness'
|
|
30
30
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
31
31
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises'
|
|
2
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
2
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
3
3
|
import type { BenchScore, BenchTask, LoadOptions } from './types'
|
|
4
4
|
|
|
5
5
|
export const FINAL_ANSWER_SENTINEL = 'FINAL ANSWER:'
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { readFile, stat } from 'node:fs/promises'
|
|
11
11
|
import { resolve } from 'node:path'
|
|
12
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
12
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
13
13
|
import { runVenvPython } from './_harness'
|
|
14
14
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
15
15
|
|
package/src/benchmarks/toollm.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { readFile } from 'node:fs/promises'
|
|
11
11
|
import { join } from 'node:path'
|
|
12
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
12
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
13
13
|
import { benchRoot } from './_harness'
|
|
14
14
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
15
15
|
|
package/src/benchmarks/types.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from the benchmark's published evaluation harness.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
11
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
12
12
|
|
|
13
13
|
export interface BenchTask {
|
|
14
14
|
/** Stable benchmark instance id. */
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { access, readFile, stat } from 'node:fs/promises'
|
|
11
11
|
import { join, resolve } from 'node:path'
|
|
12
|
-
import type { OutputAdapter } from '@tangle-network/agent-runtime/
|
|
12
|
+
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
13
13
|
import { benchRoot, runVenvPython } from './_harness'
|
|
14
14
|
import type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
|
31
31
|
import { tmpdir } from 'node:os'
|
|
32
32
|
import { join } from 'node:path'
|
|
33
33
|
import { promisify } from 'node:util'
|
|
34
|
-
import { acquireSandbox } from '@tangle-network/agent-runtime/
|
|
34
|
+
import { acquireSandbox } from '@tangle-network/agent-runtime/kernel'
|
|
35
35
|
import { Sandbox } from '@tangle-network/sandbox'
|
|
36
36
|
import { composeStrategies } from './directives'
|
|
37
37
|
import { type AttemptRecord, appendRunRecord, buildRunRecordFromAttempts } from './corpus'
|
|
@@ -36,7 +36,7 @@ import { execFileSync } from 'node:child_process'
|
|
|
36
36
|
import { existsSync, readFileSync } from 'node:fs'
|
|
37
37
|
import { composeStrategies } from './directives'
|
|
38
38
|
import { type AttemptRecord, appendRunRecord, buildRunRecordFromAttempts } from './corpus'
|
|
39
|
-
import { type RouterConfig, routerChatWithUsage } from '@tangle-network/agent-runtime/
|
|
39
|
+
import { type RouterConfig, routerChatWithUsage } from '@tangle-network/agent-runtime/kernel'
|
|
40
40
|
import { selfConsistencySelect, verifierGroundedSelect } from './selector'
|
|
41
41
|
import { type PairedLift, pairedLift, pool } from './stats.mts'
|
|
42
42
|
|
package/src/cloud-loop.mts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* env MODEL=gpt-4.1 ROUNDS=3 pnpm exec tsx src/cloud-loop.mts
|
|
31
31
|
*/
|
|
32
32
|
import { createChatClient } from '@tangle-network/agent-eval'
|
|
33
|
-
import { observe, openSandboxRun } from '@tangle-network/agent-runtime/
|
|
33
|
+
import { observe, openSandboxRun } from '@tangle-network/agent-runtime/kernel'
|
|
34
34
|
import { Sandbox } from '@tangle-network/sandbox'
|
|
35
35
|
import { answerOutput, sandboxAgentRun } from './sandbox-run'
|
|
36
36
|
|
package/src/commit0-env-run.mts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { readFileSync } from 'node:fs'
|
|
12
12
|
import { join } from 'node:path'
|
|
13
|
-
import { adaptiveRefine, printBenchmarkReport, refine, runBenchmark, sample, type Strategy } from '@tangle-network/agent-runtime/
|
|
13
|
+
import { adaptiveRefine, printBenchmarkReport, refine, runBenchmark, sample, type Strategy } from '@tangle-network/agent-runtime/kernel'
|
|
14
14
|
import { type Commit0Row, createCommit0Environment, rowToTask } from './commit0-env'
|
|
15
15
|
|
|
16
16
|
function must(name: string): string {
|
package/src/commit0-env.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { mkdtempSync, rmSync } from 'node:fs'
|
|
|
20
20
|
import { tmpdir } from 'node:os'
|
|
21
21
|
import { join } from 'node:path'
|
|
22
22
|
import { promisify } from 'node:util'
|
|
23
|
-
import type { AgenticSurface, AgenticTask, AgenticTool, ArtifactHandle, SurfaceScore } from '@tangle-network/agent-runtime/
|
|
23
|
+
import type { AgenticSurface, AgenticTask, AgenticTool, ArtifactHandle, SurfaceScore } from '@tangle-network/agent-runtime/kernel'
|
|
24
24
|
|
|
25
25
|
const exec = promisify(execFile)
|
|
26
26
|
|
package/src/commit0-gate.mts
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
type Deliverable,
|
|
58
58
|
openSandboxRun,
|
|
59
59
|
type SandboxRun,
|
|
60
|
-
} from '@tangle-network/agent-runtime/
|
|
60
|
+
} from '@tangle-network/agent-runtime/kernel'
|
|
61
61
|
import { Sandbox } from '@tangle-network/sandbox'
|
|
62
62
|
import { createCommit0Adapter } from './benchmarks/commit0'
|
|
63
63
|
import type { BenchTask } from './benchmarks/types'
|