jiva-core 0.3.47 → 0.3.48-dev.0fd3c65
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 +31 -1
- package/dist/code/agent.d.ts +13 -0
- package/dist/code/agent.d.ts.map +1 -1
- package/dist/code/agent.js +81 -7
- package/dist/code/agent.js.map +1 -1
- package/dist/code/benchmark/agent-factory.d.ts +18 -0
- package/dist/code/benchmark/agent-factory.d.ts.map +1 -0
- package/dist/code/benchmark/agent-factory.js +21 -0
- package/dist/code/benchmark/agent-factory.js.map +1 -0
- package/dist/code/benchmark/fixtures.d.ts +28 -0
- package/dist/code/benchmark/fixtures.d.ts.map +1 -0
- package/dist/code/benchmark/fixtures.js +177 -0
- package/dist/code/benchmark/fixtures.js.map +1 -0
- package/dist/code/benchmark/index.d.ts +16 -0
- package/dist/code/benchmark/index.d.ts.map +1 -0
- package/dist/code/benchmark/index.js +14 -0
- package/dist/code/benchmark/index.js.map +1 -0
- package/dist/code/benchmark/microcrm/assets/api.test.mjs +254 -0
- package/dist/code/benchmark/microcrm/assets/app.full.reference.mjs +267 -0
- package/dist/code/benchmark/microcrm/assets/app.reference.mjs +191 -0
- package/dist/code/benchmark/microcrm/assets/bulk.test.mjs +63 -0
- package/dist/code/benchmark/microcrm/assets/idempotency.test.mjs +64 -0
- package/dist/code/benchmark/microcrm/assets/query.test.mjs +96 -0
- package/dist/code/benchmark/microcrm/assets/stats.test.mjs +67 -0
- package/dist/code/benchmark/microcrm/index.d.ts +23 -0
- package/dist/code/benchmark/microcrm/index.d.ts.map +1 -0
- package/dist/code/benchmark/microcrm/index.js +72 -0
- package/dist/code/benchmark/microcrm/index.js.map +1 -0
- package/dist/code/benchmark/microcrm/spec.d.ts +13 -0
- package/dist/code/benchmark/microcrm/spec.d.ts.map +1 -0
- package/dist/code/benchmark/microcrm/spec.js +115 -0
- package/dist/code/benchmark/microcrm/spec.js.map +1 -0
- package/dist/code/benchmark/orchestrator-factory.d.ts +36 -0
- package/dist/code/benchmark/orchestrator-factory.d.ts.map +1 -0
- package/dist/code/benchmark/orchestrator-factory.js +57 -0
- package/dist/code/benchmark/orchestrator-factory.js.map +1 -0
- package/dist/code/benchmark/report.d.ts +8 -0
- package/dist/code/benchmark/report.d.ts.map +1 -0
- package/dist/code/benchmark/report.js +103 -0
- package/dist/code/benchmark/report.js.map +1 -0
- package/dist/code/benchmark/runner.d.ts +29 -0
- package/dist/code/benchmark/runner.d.ts.map +1 -0
- package/dist/code/benchmark/runner.js +219 -0
- package/dist/code/benchmark/runner.js.map +1 -0
- package/dist/code/benchmark/suites.d.ts +19 -0
- package/dist/code/benchmark/suites.d.ts.map +1 -0
- package/dist/code/benchmark/suites.js +48 -0
- package/dist/code/benchmark/suites.js.map +1 -0
- package/dist/code/benchmark/tasks.d.ts +16 -0
- package/dist/code/benchmark/tasks.d.ts.map +1 -0
- package/dist/code/benchmark/tasks.js +153 -0
- package/dist/code/benchmark/tasks.js.map +1 -0
- package/dist/code/benchmark/tests.d.ts +17 -0
- package/dist/code/benchmark/tests.d.ts.map +1 -0
- package/dist/code/benchmark/tests.js +234 -0
- package/dist/code/benchmark/tests.js.map +1 -0
- package/dist/code/benchmark/types.d.ts +161 -0
- package/dist/code/benchmark/types.d.ts.map +1 -0
- package/dist/code/benchmark/types.js +11 -0
- package/dist/code/benchmark/types.js.map +1 -0
- package/dist/code/benchmark/verify.d.ts +21 -0
- package/dist/code/benchmark/verify.d.ts.map +1 -0
- package/dist/code/benchmark/verify.js +108 -0
- package/dist/code/benchmark/verify.js.map +1 -0
- package/dist/code/tools/edit.d.ts.map +1 -1
- package/dist/code/tools/edit.js +12 -3
- package/dist/code/tools/edit.js.map +1 -1
- package/dist/code/tools/write.d.ts.map +1 -1
- package/dist/code/tools/write.js +13 -3
- package/dist/code/tools/write.js.map +1 -1
- package/dist/core/agent-interface.d.ts +5 -0
- package/dist/core/agent-interface.d.ts.map +1 -1
- package/dist/interfaces/cli/index.js +125 -0
- package/dist/interfaces/cli/index.js.map +1 -1
- package/dist/interfaces/cli/repl.d.ts.map +1 -1
- package/dist/interfaces/cli/repl.js +41 -15
- package/dist/interfaces/cli/repl.js.map +1 -1
- package/dist/interfaces/cli/setup-wizard.d.ts.map +1 -1
- package/dist/interfaces/cli/setup-wizard.js +2 -1
- package/dist/interfaces/cli/setup-wizard.js.map +1 -1
- package/dist/interfaces/http/index.d.ts.map +1 -1
- package/dist/interfaces/http/index.js +2 -0
- package/dist/interfaces/http/index.js.map +1 -1
- package/dist/interfaces/http/routes/benchmark.d.ts +14 -0
- package/dist/interfaces/http/routes/benchmark.d.ts.map +1 -0
- package/dist/interfaces/http/routes/benchmark.js +130 -0
- package/dist/interfaces/http/routes/benchmark.js.map +1 -0
- package/dist/models/model-client.d.ts +2 -1
- package/dist/models/model-client.d.ts.map +1 -1
- package/dist/models/model-client.js.map +1 -1
- package/package.json +2 -2
- package/scripts/bench-selftest.mjs +112 -0
- package/scripts/copy-benchmark-assets.mjs +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/code/benchmark/report.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC;AAED,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;A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;QACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,MAAM,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;YACpF,IAAI,CAAC,CAAC,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmark runner — drives CodeAgent through the suite in isolated workspaces
|
|
3
|
+
* and collects deterministic pass/fail plus diagnostic metrics.
|
|
4
|
+
*
|
|
5
|
+
* Each task (default mode):
|
|
6
|
+
* 1. mkdtemp an isolated workspace and write the scaffold (golden baseline +
|
|
7
|
+
* cumulative tests + any planted bug).
|
|
8
|
+
* 2. Build a fresh minimal CodeAgent pointed at it.
|
|
9
|
+
* 3. Run agent.chat(prompt) under a wall-clock timeout.
|
|
10
|
+
* 4. Run the deterministic verifier (node --test + tamper check).
|
|
11
|
+
* 5. Record metrics and tear everything down.
|
|
12
|
+
*
|
|
13
|
+
* In `continuous` mode the agent's own workspace is carried forward between
|
|
14
|
+
* tiers: only the new test files (and planted source the agent hasn't written
|
|
15
|
+
* yet) are overlaid, so cascading failures surface the way a real session would.
|
|
16
|
+
*/
|
|
17
|
+
import type { ModelOrchestrator } from '../../models/orchestrator.js';
|
|
18
|
+
import type { BenchmarkTask, RunnerOptions, ProgressEvents, SuiteResult } from './types.js';
|
|
19
|
+
export declare class BenchmarkRunner {
|
|
20
|
+
private orchestrator;
|
|
21
|
+
constructor(orchestrator: ModelOrchestrator);
|
|
22
|
+
/** Run a selected set of tasks. `tasks` must already be filtered/ordered by tier. */
|
|
23
|
+
run(tasks: BenchmarkTask[], options?: RunnerOptions, progress?: ProgressEvents): Promise<SuiteResult>;
|
|
24
|
+
private runTask;
|
|
25
|
+
private aggregate;
|
|
26
|
+
}
|
|
27
|
+
/** Convenience entry point used by both the CLI command and the HTTP route. */
|
|
28
|
+
export declare function runBenchmark(orchestrator: ModelOrchestrator, tasks: BenchmarkTask[], options?: RunnerOptions, progress?: ProgressEvents): Promise<SuiteResult>;
|
|
29
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/code/benchmark/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAItE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EAEd,WAAW,EACZ,MAAM,YAAY,CAAC;AAmBpB,qBAAa,eAAe;IACd,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,iBAAiB;IAEnD,qFAAqF;IAC/E,GAAG,CACP,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,GAAE,aAAkB,EAC3B,QAAQ,GAAE,cAAmB,GAC5B,OAAO,CAAC,WAAW,CAAC;YA2DT,OAAO;IAmGrB,OAAO,CAAC,SAAS;CAkClB;AAED,+EAA+E;AAC/E,wBAAsB,YAAY,CAChC,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,GAAE,aAAkB,EAC3B,QAAQ,GAAE,cAAmB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAKtB"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmark runner — drives CodeAgent through the suite in isolated workspaces
|
|
3
|
+
* and collects deterministic pass/fail plus diagnostic metrics.
|
|
4
|
+
*
|
|
5
|
+
* Each task (default mode):
|
|
6
|
+
* 1. mkdtemp an isolated workspace and write the scaffold (golden baseline +
|
|
7
|
+
* cumulative tests + any planted bug).
|
|
8
|
+
* 2. Build a fresh minimal CodeAgent pointed at it.
|
|
9
|
+
* 3. Run agent.chat(prompt) under a wall-clock timeout.
|
|
10
|
+
* 4. Run the deterministic verifier (node --test + tamper check).
|
|
11
|
+
* 5. Record metrics and tear everything down.
|
|
12
|
+
*
|
|
13
|
+
* In `continuous` mode the agent's own workspace is carried forward between
|
|
14
|
+
* tiers: only the new test files (and planted source the agent hasn't written
|
|
15
|
+
* yet) are overlaid, so cascading failures surface the way a real session would.
|
|
16
|
+
*/
|
|
17
|
+
import { mkdtemp, mkdir, writeFile, rm, access } from 'fs/promises';
|
|
18
|
+
import { tmpdir } from 'os';
|
|
19
|
+
import { join, dirname } from 'path';
|
|
20
|
+
import { logger } from '../../utils/logger.js';
|
|
21
|
+
import { buildBenchmarkAgent } from './agent-factory.js';
|
|
22
|
+
import { runNodeTests } from './verify.js';
|
|
23
|
+
async function exists(path) {
|
|
24
|
+
try {
|
|
25
|
+
await access(path);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function writeWorkspaceFile(workspaceDir, relPath, content) {
|
|
33
|
+
const abs = join(workspaceDir, relPath);
|
|
34
|
+
await mkdir(dirname(abs), { recursive: true });
|
|
35
|
+
await writeFile(abs, content, 'utf-8');
|
|
36
|
+
}
|
|
37
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
38
|
+
export class BenchmarkRunner {
|
|
39
|
+
orchestrator;
|
|
40
|
+
constructor(orchestrator) {
|
|
41
|
+
this.orchestrator = orchestrator;
|
|
42
|
+
}
|
|
43
|
+
/** Run a selected set of tasks. `tasks` must already be filtered/ordered by tier. */
|
|
44
|
+
async run(tasks, options = {}, progress = {}) {
|
|
45
|
+
const startedAt = new Date().toISOString();
|
|
46
|
+
const results = [];
|
|
47
|
+
let carriedWorkspace;
|
|
48
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
49
|
+
const task = tasks[i];
|
|
50
|
+
progress.onTaskStart?.(task, i, tasks.length);
|
|
51
|
+
const maxIterations = options.maxIterations ?? task.maxIterations;
|
|
52
|
+
const timeoutMs = options.timeoutMs ?? task.timeoutMs;
|
|
53
|
+
// Resolve the workspace and write the scaffold.
|
|
54
|
+
let workspaceDir;
|
|
55
|
+
let ephemeral = false;
|
|
56
|
+
if (options.continuous && carriedWorkspace) {
|
|
57
|
+
workspaceDir = carriedWorkspace;
|
|
58
|
+
// Overlay new tests always; overlay planted source only where absent.
|
|
59
|
+
for (const [rel, content] of Object.entries(task.scaffold)) {
|
|
60
|
+
const isTest = rel.startsWith('test/');
|
|
61
|
+
const isPkg = rel === 'package.json';
|
|
62
|
+
if (isTest || isPkg || !(await exists(join(workspaceDir, rel)))) {
|
|
63
|
+
await writeWorkspaceFile(workspaceDir, rel, content);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
workspaceDir = await mkdtemp(join(tmpdir(), `jiva-bench-${task.id}-`));
|
|
69
|
+
ephemeral = !options.continuous;
|
|
70
|
+
for (const [rel, content] of Object.entries(task.scaffold)) {
|
|
71
|
+
await writeWorkspaceFile(workspaceDir, rel, content);
|
|
72
|
+
}
|
|
73
|
+
if (options.continuous)
|
|
74
|
+
carriedWorkspace = workspaceDir;
|
|
75
|
+
}
|
|
76
|
+
// Snapshot the protected test files (from the task's own scaffold) for the tamper check.
|
|
77
|
+
const protectedFiles = {};
|
|
78
|
+
for (const p of task.protectedPaths) {
|
|
79
|
+
protectedFiles[p] = task.scaffold[p] ?? '';
|
|
80
|
+
}
|
|
81
|
+
const result = await this.runTask(task, workspaceDir, maxIterations, timeoutMs, protectedFiles, !!options.lspEnabled);
|
|
82
|
+
results.push(result);
|
|
83
|
+
progress.onTaskDone?.(result, i, tasks.length);
|
|
84
|
+
// Clean up ephemeral (non-continuous) workspaces unless asked to keep them.
|
|
85
|
+
if (ephemeral && !options.keepWorkspaces) {
|
|
86
|
+
await rm(workspaceDir, { recursive: true, force: true }).catch(() => { });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Clean up the carried-forward workspace at the very end.
|
|
90
|
+
if (options.continuous && carriedWorkspace && !options.keepWorkspaces) {
|
|
91
|
+
await rm(carriedWorkspace, { recursive: true, force: true }).catch(() => { });
|
|
92
|
+
}
|
|
93
|
+
const finishedAt = new Date().toISOString();
|
|
94
|
+
return this.aggregate(tasks, results, startedAt, finishedAt, options);
|
|
95
|
+
}
|
|
96
|
+
async runTask(task, workspaceDir, maxIterations, timeoutMs, protectedFiles, lspEnabled) {
|
|
97
|
+
const agent = await buildBenchmarkAgent({
|
|
98
|
+
orchestrator: this.orchestrator,
|
|
99
|
+
workspaceDir,
|
|
100
|
+
maxIterations,
|
|
101
|
+
lspEnabled,
|
|
102
|
+
});
|
|
103
|
+
const base = {
|
|
104
|
+
id: task.id,
|
|
105
|
+
tier: task.tier,
|
|
106
|
+
title: task.title,
|
|
107
|
+
capability: task.capability,
|
|
108
|
+
kind: task.kind,
|
|
109
|
+
};
|
|
110
|
+
const start = Date.now();
|
|
111
|
+
let iterations = 0;
|
|
112
|
+
let toolsUsed = [];
|
|
113
|
+
let timedOut = false;
|
|
114
|
+
let agentError;
|
|
115
|
+
let truncationEvents = 0;
|
|
116
|
+
try {
|
|
117
|
+
const chatPromise = agent.chat(task.prompt);
|
|
118
|
+
const raced = await Promise.race([
|
|
119
|
+
chatPromise.then((r) => ({ kind: 'ok', r })),
|
|
120
|
+
delay(timeoutMs).then(() => ({ kind: 'timeout' })),
|
|
121
|
+
]);
|
|
122
|
+
if (raced.kind === 'ok') {
|
|
123
|
+
iterations = raced.r.iterations;
|
|
124
|
+
toolsUsed = raced.r.toolsUsed;
|
|
125
|
+
truncationEvents = raced.r.truncationEvents ?? 0;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
timedOut = true;
|
|
129
|
+
agent.stop();
|
|
130
|
+
chatPromise.catch(() => { }); // swallow the late rejection/resolution
|
|
131
|
+
iterations = maxIterations;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
agentError = err instanceof Error ? err.message : String(err);
|
|
136
|
+
}
|
|
137
|
+
const wallTimeMs = Date.now() - start;
|
|
138
|
+
let tokenUsage;
|
|
139
|
+
try {
|
|
140
|
+
tokenUsage = agent.getTokenUsage();
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
tokenUsage = undefined;
|
|
144
|
+
}
|
|
145
|
+
// Verify regardless — the agent may have completed the files even on timeout.
|
|
146
|
+
const verify = await runNodeTests(workspaceDir, protectedFiles, 60_000);
|
|
147
|
+
await agent.cleanup().catch(() => { });
|
|
148
|
+
const passed = verify.passed && !agentError;
|
|
149
|
+
let reason;
|
|
150
|
+
if (!passed) {
|
|
151
|
+
if (agentError)
|
|
152
|
+
reason = 'agent-error';
|
|
153
|
+
else if (timedOut && !verify.passed)
|
|
154
|
+
reason = 'timeout';
|
|
155
|
+
else
|
|
156
|
+
reason = verify.reason;
|
|
157
|
+
}
|
|
158
|
+
const outputLimited = !passed && truncationEvents > 0;
|
|
159
|
+
const notes = [
|
|
160
|
+
agentError ? `agent error: ${agentError}` : '',
|
|
161
|
+
timedOut ? `timed out after ${timeoutMs}ms` : '',
|
|
162
|
+
outputLimited ? `hit output-token limit ${truncationEvents}×` : '',
|
|
163
|
+
verify.output ? `verifier: ${verify.output.split('\n').slice(-6).join(' ').slice(0, 300)}` : '',
|
|
164
|
+
]
|
|
165
|
+
.filter(Boolean)
|
|
166
|
+
.join(' | ');
|
|
167
|
+
return {
|
|
168
|
+
...base,
|
|
169
|
+
passed,
|
|
170
|
+
reason,
|
|
171
|
+
iterations,
|
|
172
|
+
hitMaxIterations: iterations >= maxIterations,
|
|
173
|
+
toolsUsed,
|
|
174
|
+
tokenUsage,
|
|
175
|
+
wallTimeMs,
|
|
176
|
+
testsPassed: verify.testsPassed,
|
|
177
|
+
testsFailed: verify.testsFailed,
|
|
178
|
+
failingTests: verify.failingTests,
|
|
179
|
+
truncationEvents,
|
|
180
|
+
outputLimited,
|
|
181
|
+
notes: notes || undefined,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
aggregate(tasks, results, startedAt, finishedAt, options) {
|
|
185
|
+
const passed = results.filter((r) => r.passed).length;
|
|
186
|
+
const highestTierPassed = results.filter((r) => r.passed).reduce((m, r) => Math.max(m, r.tier), 0);
|
|
187
|
+
const totalWallTimeMs = results.reduce((s, r) => s + r.wallTimeMs, 0);
|
|
188
|
+
const totalTokens = results.reduce((s, r) => s + (r.tokenUsage?.totalTokens ?? 0), 0);
|
|
189
|
+
const totalTestsPassed = results.reduce((s, r) => s + r.testsPassed, 0);
|
|
190
|
+
const totalTestsRun = results.reduce((s, r) => s + r.testsPassed + r.testsFailed, 0);
|
|
191
|
+
const scorePct = totalTestsRun > 0 ? Math.round((totalTestsPassed / totalTestsRun) * 100) : 0;
|
|
192
|
+
return {
|
|
193
|
+
startedAt,
|
|
194
|
+
finishedAt,
|
|
195
|
+
suiteId: options.suiteId,
|
|
196
|
+
suiteName: options.suiteName,
|
|
197
|
+
scoring: options.scoring,
|
|
198
|
+
model: options.model,
|
|
199
|
+
totalTasks: tasks.length,
|
|
200
|
+
passed,
|
|
201
|
+
failed: results.length - passed,
|
|
202
|
+
highestTierPassed,
|
|
203
|
+
totalTestsPassed,
|
|
204
|
+
totalTestsRun,
|
|
205
|
+
scorePct,
|
|
206
|
+
totalWallTimeMs,
|
|
207
|
+
totalTokens: totalTokens || undefined,
|
|
208
|
+
tasks: results,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** Convenience entry point used by both the CLI command and the HTTP route. */
|
|
213
|
+
export async function runBenchmark(orchestrator, tasks, options = {}, progress = {}) {
|
|
214
|
+
if (tasks.length === 0) {
|
|
215
|
+
logger.warn('[benchmark] no tasks selected');
|
|
216
|
+
}
|
|
217
|
+
return new BenchmarkRunner(orchestrator).run(tasks, options, progress);
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/code/benchmark/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OA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AAC/E,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,YAA+B,EAC/B,KAAsB,EACtB,UAAyB,EAAE,EAC3B,WAA2B,EAAE;IAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmark suite registry.
|
|
3
|
+
*
|
|
4
|
+
* Three tiers of suites with distinct purposes (see docs/guides/benchmark-suite.md):
|
|
5
|
+
* - taskstore (baseline) — gating: does code mode work at all? Most usable configs ~100%.
|
|
6
|
+
* - microcrm (capability)— scored: build a Node+SQLite REST API to spec; differentiates
|
|
7
|
+
* models and configurations by pass-rate.
|
|
8
|
+
* - frontier (future) — scored: ~50 tests, even an optimal config only ~30-40%; full
|
|
9
|
+
* pass needs a frontier model.
|
|
10
|
+
*/
|
|
11
|
+
import type { BenchmarkSuite } from './types.js';
|
|
12
|
+
export declare const BENCHMARK_SUITES: BenchmarkSuite[];
|
|
13
|
+
/** Default suite when none is specified (preserves prior `jiva benchmark` behaviour). */
|
|
14
|
+
export declare const DEFAULT_SUITE_ID = "taskstore";
|
|
15
|
+
export declare function getSuite(id: string): BenchmarkSuite | undefined;
|
|
16
|
+
export declare function listSuiteMetadata(): Array<Pick<BenchmarkSuite, 'id' | 'name' | 'description' | 'level' | 'scoring'> & {
|
|
17
|
+
taskCount: number;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=suites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.d.ts","sourceRoot":"","sources":["../../../src/code/benchmark/suites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAqB5C,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE/D;AAED,wBAAgB,iBAAiB,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAS5I"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmark suite registry.
|
|
3
|
+
*
|
|
4
|
+
* Three tiers of suites with distinct purposes (see docs/guides/benchmark-suite.md):
|
|
5
|
+
* - taskstore (baseline) — gating: does code mode work at all? Most usable configs ~100%.
|
|
6
|
+
* - microcrm (capability)— scored: build a Node+SQLite REST API to spec; differentiates
|
|
7
|
+
* models and configurations by pass-rate.
|
|
8
|
+
* - frontier (future) — scored: ~50 tests, even an optimal config only ~30-40%; full
|
|
9
|
+
* pass needs a frontier model.
|
|
10
|
+
*/
|
|
11
|
+
import { BENCHMARK_TASKS } from './tasks.js';
|
|
12
|
+
import { MICROCRM_TASKS } from './microcrm/index.js';
|
|
13
|
+
export const BENCHMARK_SUITES = [
|
|
14
|
+
{
|
|
15
|
+
id: 'taskstore',
|
|
16
|
+
name: 'Taskstore (baseline)',
|
|
17
|
+
description: 'TDD smoke/regression suite over an evolving in-memory library. Binary pass/fail, tasks ' +
|
|
18
|
+
'build on one another. Confirms a model + config can do code mode at all.',
|
|
19
|
+
level: 'baseline',
|
|
20
|
+
scoring: 'gating',
|
|
21
|
+
tasks: BENCHMARK_TASKS,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'microcrm',
|
|
25
|
+
name: 'micro-CRM API (capability)',
|
|
26
|
+
description: 'Build a Node + SQLite REST API to a fixed spec, graded by the fraction of spec tests ' +
|
|
27
|
+
'passed. Differentiates models and configurations; use it to find the optimal setup.',
|
|
28
|
+
level: 'capability',
|
|
29
|
+
scoring: 'scored',
|
|
30
|
+
tasks: MICROCRM_TASKS,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
/** Default suite when none is specified (preserves prior `jiva benchmark` behaviour). */
|
|
34
|
+
export const DEFAULT_SUITE_ID = 'taskstore';
|
|
35
|
+
export function getSuite(id) {
|
|
36
|
+
return BENCHMARK_SUITES.find((s) => s.id === id);
|
|
37
|
+
}
|
|
38
|
+
export function listSuiteMetadata() {
|
|
39
|
+
return BENCHMARK_SUITES.map(({ id, name, description, level, scoring, tasks }) => ({
|
|
40
|
+
id,
|
|
41
|
+
name,
|
|
42
|
+
description,
|
|
43
|
+
level,
|
|
44
|
+
scoring,
|
|
45
|
+
taskCount: tasks.length,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=suites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.js","sourceRoot":"","sources":["../../../src/code/benchmark/suites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IAChD;QACE,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,yFAAyF;YACzF,0EAA0E;QAC5E,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,eAAe;KACvB;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,4BAA4B;QAClC,WAAW,EACT,uFAAuF;YACvF,qFAAqF;QACvF,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,cAAc;KACtB;CACF,CAAC;AAEF,yFAAyF;AACzF,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C,MAAM,UAAU,QAAQ,CAAC,EAAU;IACjC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACjF,EAAE;QACF,IAAI;QACJ,WAAW;QACX,KAAK;QACL,OAAO;QACP,SAAS,EAAE,KAAK,CAAC,MAAM;KACxB,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The benchmark suite — 8 TDD-style coding tasks of increasing complexity over a
|
|
3
|
+
* single evolving `taskstore` library. Tier 1 is a from-scratch one-liner; tier 8
|
|
4
|
+
* is a long-horizon cross-module debug that stresses iteration count and output
|
|
5
|
+
* length — the regime where rate-limited or short-output models fall down.
|
|
6
|
+
*/
|
|
7
|
+
import type { BenchmarkTask } from './types.js';
|
|
8
|
+
export declare const BENCHMARK_TASKS: BenchmarkTask[];
|
|
9
|
+
/** Lightweight metadata for listing endpoints (no scaffold/test payloads). */
|
|
10
|
+
export declare function listTaskMetadata(tasks: BenchmarkTask[]): Array<Pick<BenchmarkTask, 'id' | 'tier' | 'title' | 'capability' | 'kind'>>;
|
|
11
|
+
/** Resolve which tasks to run from a suite's task list, given runner filters. */
|
|
12
|
+
export declare function selectTasks(tasks: BenchmarkTask[], opts: {
|
|
13
|
+
maxTier?: number;
|
|
14
|
+
taskIds?: string[];
|
|
15
|
+
}): BenchmarkTask[];
|
|
16
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/code/benchmark/tasks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,YAAY,CAAC;AA+I1D,eAAO,MAAM,eAAe,EAAE,aAAa,EAWxC,CAAC;AAEJ,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EAAE,GACrB,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,CAE7E;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,aAAa,EAAE,CASnH"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The benchmark suite — 8 TDD-style coding tasks of increasing complexity over a
|
|
3
|
+
* single evolving `taskstore` library. Tier 1 is a from-scratch one-liner; tier 8
|
|
4
|
+
* is a long-horizon cross-module debug that stresses iteration count and output
|
|
5
|
+
* length — the regime where rate-limited or short-output models fall down.
|
|
6
|
+
*/
|
|
7
|
+
import { PACKAGE_JSON, scaffoldSrc } from './fixtures.js';
|
|
8
|
+
import { cumulativeTests, cumulativeTestPaths } from './tests.js';
|
|
9
|
+
const COMMON_RULES = `
|
|
10
|
+
Rules:
|
|
11
|
+
- The workspace is a Node ES-module project. Run the test suite with: node --test
|
|
12
|
+
- Make ALL tests pass. Do not stop until "node --test" reports zero failures.
|
|
13
|
+
- You MUST NOT modify, delete or move anything under the test/ directory.
|
|
14
|
+
- Keep existing passing tests green — only change source files under src/.`;
|
|
15
|
+
function buildScaffold(tier) {
|
|
16
|
+
return {
|
|
17
|
+
'package.json': PACKAGE_JSON,
|
|
18
|
+
...scaffoldSrc(tier),
|
|
19
|
+
...cumulativeTests(tier),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const SPECS = [
|
|
23
|
+
{
|
|
24
|
+
id: 't01-create',
|
|
25
|
+
tier: 1,
|
|
26
|
+
title: 'Create createTask from scratch',
|
|
27
|
+
capability: 'Write a new file',
|
|
28
|
+
kind: 'scratch',
|
|
29
|
+
instruction: 'Create src/index.js exporting a function `createTask(title)` that returns an object ' +
|
|
30
|
+
'`{ title, done: false }` and throws an Error when the title is empty or only whitespace.',
|
|
31
|
+
maxIterations: 15,
|
|
32
|
+
timeoutMs: 120_000,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 't02-extend-crud',
|
|
36
|
+
tier: 2,
|
|
37
|
+
title: 'Add addTask / removeTask / listTasks',
|
|
38
|
+
capability: 'Read & extend an existing file',
|
|
39
|
+
kind: 'extend',
|
|
40
|
+
instruction: 'src/index.js already has createTask. Add and export `addTask(list, title)` (returns a NEW ' +
|
|
41
|
+
'list with an appended task that has a unique incrementing numeric `id` starting at 1, without ' +
|
|
42
|
+
'mutating the input), `removeTask(list, id)` (returns a new list without that task), and ' +
|
|
43
|
+
'`listTasks(list)` (returns all tasks).',
|
|
44
|
+
maxIterations: 20,
|
|
45
|
+
timeoutMs: 180_000,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 't03-bugfix-toggle',
|
|
49
|
+
tier: 3,
|
|
50
|
+
title: 'Fix the toggleTask bug',
|
|
51
|
+
capability: 'Diagnose & fix a targeted bug',
|
|
52
|
+
kind: 'bugfix',
|
|
53
|
+
instruction: 'src/index.js contains a `toggleTask(list, id)` function that is supposed to flip the `done` ' +
|
|
54
|
+
'flag of the task whose `id` matches, but the tests are failing. Find and fix the bug. ' +
|
|
55
|
+
'Do not rewrite unrelated code.',
|
|
56
|
+
maxIterations: 20,
|
|
57
|
+
timeoutMs: 180_000,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 't04-feature-priority',
|
|
61
|
+
tier: 4,
|
|
62
|
+
title: 'Add task priorities',
|
|
63
|
+
capability: 'Multi-function feature',
|
|
64
|
+
kind: 'extend',
|
|
65
|
+
instruction: 'Add priority support to src/index.js. New tasks must default to priority "normal". Export ' +
|
|
66
|
+
'`setPriority(list, id, priority)` that updates the matching task (allowed values: "low", ' +
|
|
67
|
+
'"normal", "high"; throw on anything else) and `tasksByPriority(list, priority)` that filters ' +
|
|
68
|
+
'tasks by priority.',
|
|
69
|
+
maxIterations: 25,
|
|
70
|
+
timeoutMs: 240_000,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 't05-refactor-split',
|
|
74
|
+
tier: 5,
|
|
75
|
+
title: 'Split into model / query modules',
|
|
76
|
+
capability: 'Multi-file refactor without regressions',
|
|
77
|
+
kind: 'refactor',
|
|
78
|
+
instruction: 'Refactor the single src/index.js into three files WITHOUT changing behaviour: ' +
|
|
79
|
+
'`src/model.js` exporting the mutation functions (createTask, addTask, removeTask, toggleTask, ' +
|
|
80
|
+
'setPriority), `src/query.js` exporting the read functions (listTasks, tasksByPriority), and ' +
|
|
81
|
+
'`src/index.js` re-exporting everything from both so the existing public API is unchanged. ' +
|
|
82
|
+
'All previously passing tests must remain green.',
|
|
83
|
+
maxIterations: 30,
|
|
84
|
+
timeoutMs: 300_000,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 't06-algorithm-sort',
|
|
88
|
+
tier: 6,
|
|
89
|
+
title: 'Implement sortTasks with edge cases',
|
|
90
|
+
capability: 'Algorithmic reasoning & edge cases',
|
|
91
|
+
kind: 'extend',
|
|
92
|
+
instruction: 'Add and export `sortTasks(list, { by })` (currently only `by: "due"` is supported — throw on ' +
|
|
93
|
+
'anything else). It returns a NEW array sorted by the `due` field (an ISO date string) ascending. ' +
|
|
94
|
+
'Tasks whose `due` is null or undefined must sort to the end, and the sort must be stable for ' +
|
|
95
|
+
'tasks with equal due dates. Put it in the appropriate module and re-export it from src/index.js.',
|
|
96
|
+
maxIterations: 30,
|
|
97
|
+
timeoutMs: 300_000,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: 't07-storage-roundtrip',
|
|
101
|
+
tier: 7,
|
|
102
|
+
title: 'Add JSON serialize / deserialize',
|
|
103
|
+
capability: 'New module + serialization',
|
|
104
|
+
kind: 'extend',
|
|
105
|
+
instruction: 'Create `src/storage.js` exporting `serialize(list)` (returns a JSON string) and ' +
|
|
106
|
+
'`deserialize(str)` (parses it back into a task list, throwing if the parsed value is not an ' +
|
|
107
|
+
'array). A serialize→deserialize round-trip must preserve every field of every task. Re-export ' +
|
|
108
|
+
'both from src/index.js.',
|
|
109
|
+
maxIterations: 30,
|
|
110
|
+
timeoutMs: 300_000,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 't08-debug-id-collision',
|
|
114
|
+
tier: 8,
|
|
115
|
+
title: 'Debug the id-collision integration bug',
|
|
116
|
+
capability: 'Long-horizon cross-module debugging',
|
|
117
|
+
kind: 'bugfix',
|
|
118
|
+
instruction: 'The integration tests in test/t08.test.mjs are failing: after a task is removed (or a list is ' +
|
|
119
|
+
'restored from storage) and a new task is added, the new task can collide with an existing id. ' +
|
|
120
|
+
'Run the tests, read the failure, find the root cause across the source modules, and fix it so ' +
|
|
121
|
+
'ids are always unique. Do not weaken or change any test.',
|
|
122
|
+
maxIterations: 40,
|
|
123
|
+
timeoutMs: 420_000,
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
export const BENCHMARK_TASKS = SPECS.map((s) => ({
|
|
127
|
+
id: s.id,
|
|
128
|
+
tier: s.tier,
|
|
129
|
+
title: s.title,
|
|
130
|
+
capability: s.capability,
|
|
131
|
+
kind: s.kind,
|
|
132
|
+
prompt: `${s.instruction}\n${COMMON_RULES}`,
|
|
133
|
+
scaffold: buildScaffold(s.tier),
|
|
134
|
+
protectedPaths: cumulativeTestPaths(s.tier),
|
|
135
|
+
maxIterations: s.maxIterations,
|
|
136
|
+
timeoutMs: s.timeoutMs,
|
|
137
|
+
}));
|
|
138
|
+
/** Lightweight metadata for listing endpoints (no scaffold/test payloads). */
|
|
139
|
+
export function listTaskMetadata(tasks) {
|
|
140
|
+
return tasks.map(({ id, tier, title, capability, kind }) => ({ id, tier, title, capability, kind }));
|
|
141
|
+
}
|
|
142
|
+
/** Resolve which tasks to run from a suite's task list, given runner filters. */
|
|
143
|
+
export function selectTasks(tasks, opts) {
|
|
144
|
+
if (opts.taskIds && opts.taskIds.length > 0) {
|
|
145
|
+
const set = new Set(opts.taskIds);
|
|
146
|
+
return tasks.filter((t) => set.has(t.id));
|
|
147
|
+
}
|
|
148
|
+
if (typeof opts.maxTier === 'number') {
|
|
149
|
+
return tasks.filter((t) => t.tier <= opts.maxTier);
|
|
150
|
+
}
|
|
151
|
+
return [...tasks];
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/code/benchmark/tasks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,YAAY,GAAG;;;;;2EAKsD,CAAC;AAE5E,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO;QACL,cAAc,EAAE,YAAY;QAC5B,GAAG,WAAW,CAAC,IAAI,CAAC;QACpB,GAAG,eAAe,CAAC,IAAI,CAAC;KACzB,CAAC;AACJ,CAAC;AAaD,MAAM,KAAK,GAAe;IACxB;QACE,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,gCAAgC;QACvC,UAAU,EAAE,kBAAkB;QAC9B,IAAI,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AEJ,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAC9B,KAAsB;IAEtB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACvG,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,WAAW,CAAC,KAAsB,EAAE,IAA8C;IAChG,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,OAAQ,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cumulative node:test files for the benchmark suite.
|
|
3
|
+
*
|
|
4
|
+
* Tier N's workspace contains every test file test1..testN, so the verifier
|
|
5
|
+
* catches regressions in earlier tiers (critical for the tier-5 refactor and
|
|
6
|
+
* the tier-8 debug task). All tests import the library through `../src/index.js`
|
|
7
|
+
* except the tier-5 structural test, which deliberately imports the split
|
|
8
|
+
* modules to force the refactor.
|
|
9
|
+
*
|
|
10
|
+
* The agent must NOT modify any of these files (see BenchmarkTask.protectedPaths).
|
|
11
|
+
*/
|
|
12
|
+
import type { TaskFile } from './types.js';
|
|
13
|
+
/** All test files for tiers 1..tier (cumulative). */
|
|
14
|
+
export declare function cumulativeTests(tier: number): TaskFile;
|
|
15
|
+
/** Paths of all test files for tiers 1..tier (the protected set). */
|
|
16
|
+
export declare function cumulativeTestPaths(tier: number): string[];
|
|
17
|
+
//# sourceMappingURL=tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../src/code/benchmark/tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmN3C,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAOtD;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1D"}
|