@vercel/agent-eval 0.0.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/README.md +370 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +166 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agents/claude-code.d.ts +12 -0
- package/dist/lib/agents/claude-code.d.ts.map +1 -0
- package/dist/lib/agents/claude-code.js +203 -0
- package/dist/lib/agents/claude-code.js.map +1 -0
- package/dist/lib/agents/codex.d.ts +12 -0
- package/dist/lib/agents/codex.d.ts.map +1 -0
- package/dist/lib/agents/codex.js +247 -0
- package/dist/lib/agents/codex.js.map +1 -0
- package/dist/lib/agents/index.d.ts +7 -0
- package/dist/lib/agents/index.d.ts.map +1 -0
- package/dist/lib/agents/index.js +14 -0
- package/dist/lib/agents/index.js.map +1 -0
- package/dist/lib/agents/registry.d.ts +23 -0
- package/dist/lib/agents/registry.d.ts.map +1 -0
- package/dist/lib/agents/registry.js +35 -0
- package/dist/lib/agents/registry.js.map +1 -0
- package/dist/lib/agents/shared.d.ts +47 -0
- package/dist/lib/agents/shared.d.ts.map +1 -0
- package/dist/lib/agents/shared.js +99 -0
- package/dist/lib/agents/shared.js.map +1 -0
- package/dist/lib/agents/types.d.ts +69 -0
- package/dist/lib/agents/types.d.ts.map +1 -0
- package/dist/lib/agents/types.js +5 -0
- package/dist/lib/agents/types.js.map +1 -0
- package/dist/lib/config.d.ts +34 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +117 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/fixture.d.ts +52 -0
- package/dist/lib/fixture.d.ts.map +1 -0
- package/dist/lib/fixture.js +175 -0
- package/dist/lib/fixture.js.map +1 -0
- package/dist/lib/init.d.ts +21 -0
- package/dist/lib/init.d.ts.map +1 -0
- package/dist/lib/init.js +250 -0
- package/dist/lib/init.js.map +1 -0
- package/dist/lib/results.d.ts +54 -0
- package/dist/lib/results.d.ts.map +1 -0
- package/dist/lib/results.js +186 -0
- package/dist/lib/results.js.map +1 -0
- package/dist/lib/runner.d.ts +43 -0
- package/dist/lib/runner.d.ts.map +1 -0
- package/dist/lib/runner.js +142 -0
- package/dist/lib/runner.js.map +1 -0
- package/dist/lib/sandbox.d.ts +117 -0
- package/dist/lib/sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox.js +248 -0
- package/dist/lib/sandbox.js.map +1 -0
- package/dist/lib/types.d.ts +166 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +14 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +6 -0
- package/dist/test-setup.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experiment runner - orchestrates running evals against agent.
|
|
3
|
+
* All evals and attempts run concurrently for maximum throughput.
|
|
4
|
+
* With earlyExit, in-flight attempts are aborted when one passes.
|
|
5
|
+
*/
|
|
6
|
+
import { getAgent } from './agents/index.js';
|
|
7
|
+
import { agentResultToEvalRunData, createEvalSummary, createExperimentResults, saveResults, formatResultsTable, formatRunResult, createProgressDisplay, } from './results.js';
|
|
8
|
+
/**
|
|
9
|
+
* Run an experiment - execute all evals with configured runs concurrently.
|
|
10
|
+
* With earlyExit enabled, remaining attempts for a fixture are aborted once one passes.
|
|
11
|
+
*/
|
|
12
|
+
export async function runExperiment(options) {
|
|
13
|
+
const { config, fixtures, apiKey, resultsDir, experimentName, onProgress, verbose } = options;
|
|
14
|
+
const startedAt = new Date();
|
|
15
|
+
// Get the agent from registry
|
|
16
|
+
const agent = getAgent(config.agent);
|
|
17
|
+
const log = (msg) => {
|
|
18
|
+
if (onProgress) {
|
|
19
|
+
onProgress(msg);
|
|
20
|
+
}
|
|
21
|
+
else if (verbose) {
|
|
22
|
+
console.log(msg);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// Create AbortController per fixture for earlyExit
|
|
26
|
+
const abortControllers = new Map();
|
|
27
|
+
for (const fixture of fixtures) {
|
|
28
|
+
abortControllers.set(fixture.name, new AbortController());
|
|
29
|
+
}
|
|
30
|
+
// Build list of all attempts to run
|
|
31
|
+
const attempts = [];
|
|
32
|
+
for (const fixture of fixtures) {
|
|
33
|
+
for (let i = 0; i < config.runs; i++) {
|
|
34
|
+
attempts.push({ fixture, runIndex: i });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
log(`Starting ${attempts.length} eval attempts concurrently (${fixtures.length} evals × ${config.runs} runs)`);
|
|
38
|
+
// Run a single attempt
|
|
39
|
+
const runAttempt = async (attempt) => {
|
|
40
|
+
const { fixture, runIndex } = attempt;
|
|
41
|
+
const controller = abortControllers.get(fixture.name);
|
|
42
|
+
// Check if already aborted before starting
|
|
43
|
+
if (controller.signal.aborted) {
|
|
44
|
+
return {
|
|
45
|
+
fixtureName: fixture.name,
|
|
46
|
+
runIndex,
|
|
47
|
+
runData: {
|
|
48
|
+
result: { status: 'failed', error: 'Aborted', duration: 0 },
|
|
49
|
+
},
|
|
50
|
+
aborted: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
log(createProgressDisplay(fixture.name, runIndex + 1, config.runs));
|
|
54
|
+
const agentResult = await agent.run(fixture.path, {
|
|
55
|
+
prompt: fixture.prompt,
|
|
56
|
+
model: config.model,
|
|
57
|
+
timeout: config.timeout * 1000,
|
|
58
|
+
apiKey,
|
|
59
|
+
setup: config.setup,
|
|
60
|
+
scripts: config.scripts,
|
|
61
|
+
signal: config.earlyExit ? controller.signal : undefined,
|
|
62
|
+
});
|
|
63
|
+
// Check if this was aborted
|
|
64
|
+
if (agentResult.error === 'Aborted' || agentResult.error === 'Aborted before start') {
|
|
65
|
+
return {
|
|
66
|
+
fixtureName: fixture.name,
|
|
67
|
+
runIndex,
|
|
68
|
+
runData: {
|
|
69
|
+
result: { status: 'failed', error: 'Aborted', duration: agentResult.duration / 1000 },
|
|
70
|
+
},
|
|
71
|
+
aborted: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const runData = agentResultToEvalRunData(agentResult);
|
|
75
|
+
log(formatRunResult(fixture.name, runIndex + 1, config.runs, runData.result));
|
|
76
|
+
// If this attempt passed and earlyExit is enabled, abort remaining attempts
|
|
77
|
+
if (config.earlyExit && runData.result.status === 'passed') {
|
|
78
|
+
log(`Early exit: ${fixture.name} passed on run ${runIndex + 1}, aborting remaining attempts`);
|
|
79
|
+
controller.abort();
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
fixtureName: fixture.name,
|
|
83
|
+
runIndex,
|
|
84
|
+
runData,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
// Run all attempts concurrently
|
|
88
|
+
const results = await Promise.all(attempts.map(runAttempt));
|
|
89
|
+
// Group results by fixture, excluding aborted results
|
|
90
|
+
const resultsByFixture = new Map();
|
|
91
|
+
for (const fixture of fixtures) {
|
|
92
|
+
resultsByFixture.set(fixture.name, []);
|
|
93
|
+
}
|
|
94
|
+
for (const result of results) {
|
|
95
|
+
if (!result.aborted) {
|
|
96
|
+
resultsByFixture.get(result.fixtureName).push(result);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Build eval summaries, respecting earlyExit
|
|
100
|
+
const evalSummaries = [];
|
|
101
|
+
for (const fixture of fixtures) {
|
|
102
|
+
const fixtureResults = resultsByFixture.get(fixture.name);
|
|
103
|
+
// Sort by run index to process in order
|
|
104
|
+
fixtureResults.sort((a, b) => a.runIndex - b.runIndex);
|
|
105
|
+
const runDataList = [];
|
|
106
|
+
for (const result of fixtureResults) {
|
|
107
|
+
runDataList.push(result.runData);
|
|
108
|
+
// With earlyExit, stop counting after first pass
|
|
109
|
+
if (config.earlyExit && result.runData.result.status === 'passed') {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const summary = createEvalSummary(fixture.name, runDataList);
|
|
114
|
+
evalSummaries.push(summary);
|
|
115
|
+
}
|
|
116
|
+
const completedAt = new Date();
|
|
117
|
+
const experimentResults = createExperimentResults(config, evalSummaries, startedAt, completedAt);
|
|
118
|
+
// Save results to disk
|
|
119
|
+
const outputDir = saveResults(experimentResults, {
|
|
120
|
+
resultsDir,
|
|
121
|
+
experimentName,
|
|
122
|
+
});
|
|
123
|
+
log(`\nResults saved to: ${outputDir}`);
|
|
124
|
+
log(formatResultsTable(experimentResults));
|
|
125
|
+
return experimentResults;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Run a single eval (for testing/debugging).
|
|
129
|
+
*/
|
|
130
|
+
export async function runSingleEval(fixture, options) {
|
|
131
|
+
const agent = getAgent(options.agent ?? 'vercel-ai-gateway/claude-code');
|
|
132
|
+
const agentResult = await agent.run(fixture.path, {
|
|
133
|
+
prompt: fixture.prompt,
|
|
134
|
+
model: options.model,
|
|
135
|
+
timeout: options.timeout * 1000,
|
|
136
|
+
apiKey: options.apiKey,
|
|
137
|
+
setup: options.setup,
|
|
138
|
+
scripts: options.scripts,
|
|
139
|
+
});
|
|
140
|
+
return agentResultToEvalRunData(agentResult);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/lib/runner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAwCtB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAA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C,KAAK,IAAI,+BAA+B,CAAC,CAAC;IAEzE,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;QAChD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,IAAI;QAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel Sandbox integration for isolated eval execution.
|
|
3
|
+
*/
|
|
4
|
+
import { Sandbox as VercelSandbox } from '@vercel/sandbox';
|
|
5
|
+
import type { Sandbox } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Default timeout for sandbox operations (10 minutes).
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_SANDBOX_TIMEOUT = 600000;
|
|
10
|
+
/**
|
|
11
|
+
* Files to ignore when copying to sandbox.
|
|
12
|
+
* These are build artifacts and dependencies that shouldn't be uploaded.
|
|
13
|
+
* Note: This is a general-purpose pattern list used by collectLocalFiles().
|
|
14
|
+
* For eval-specific exclusions (PROMPT.md, EVAL.ts), see TEST_FILE_PATTERNS.
|
|
15
|
+
*/
|
|
16
|
+
export declare const IGNORED_PATTERNS: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Test/eval file patterns to withhold from agent during task execution.
|
|
19
|
+
* These files are uploaded AFTER the agent completes for validation.
|
|
20
|
+
* - PROMPT.md: Contains the task - agent receives this via CLI argument, not as a file
|
|
21
|
+
* - EVAL.ts: Validation tests - must be hidden so agent can't "cheat"
|
|
22
|
+
* - *.test.ts/tsx: Additional test files that shouldn't influence agent
|
|
23
|
+
*/
|
|
24
|
+
export declare const TEST_FILE_PATTERNS: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Options for creating a sandbox.
|
|
27
|
+
*/
|
|
28
|
+
export interface SandboxOptions {
|
|
29
|
+
/** Timeout in milliseconds */
|
|
30
|
+
timeout?: number;
|
|
31
|
+
/** Runtime environment */
|
|
32
|
+
runtime?: 'node20' | 'node24';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of running a command in the sandbox.
|
|
36
|
+
*/
|
|
37
|
+
export interface CommandResult {
|
|
38
|
+
stdout: string;
|
|
39
|
+
stderr: string;
|
|
40
|
+
exitCode: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* File to upload to sandbox.
|
|
44
|
+
*/
|
|
45
|
+
export interface SandboxFile {
|
|
46
|
+
path: string;
|
|
47
|
+
content: Buffer | string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Wrapper around Vercel Sandbox providing a cleaner API.
|
|
51
|
+
*/
|
|
52
|
+
export declare class SandboxManager implements Sandbox {
|
|
53
|
+
private sandbox;
|
|
54
|
+
private _workingDirectory;
|
|
55
|
+
constructor(sandbox: VercelSandbox);
|
|
56
|
+
/**
|
|
57
|
+
* Create a new sandbox instance.
|
|
58
|
+
*/
|
|
59
|
+
static create(options?: SandboxOptions): Promise<SandboxManager>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the sandbox ID.
|
|
62
|
+
*/
|
|
63
|
+
get sandboxId(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Run a command in the sandbox.
|
|
66
|
+
*/
|
|
67
|
+
runCommand(command: string, args?: string[], options?: {
|
|
68
|
+
env?: Record<string, string>;
|
|
69
|
+
}): Promise<CommandResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Run a shell command (through bash).
|
|
72
|
+
*/
|
|
73
|
+
runShell(command: string, env?: Record<string, string>): Promise<CommandResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Read a file from the sandbox.
|
|
76
|
+
*/
|
|
77
|
+
readFile(path: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Check if a file exists in the sandbox.
|
|
80
|
+
*/
|
|
81
|
+
fileExists(path: string): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Write files to the sandbox.
|
|
84
|
+
*/
|
|
85
|
+
writeFiles(files: Record<string, string>): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Upload files from local filesystem to sandbox.
|
|
88
|
+
*/
|
|
89
|
+
uploadFiles(files: SandboxFile[]): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Get the working directory.
|
|
92
|
+
*/
|
|
93
|
+
getWorkingDirectory(): string;
|
|
94
|
+
/**
|
|
95
|
+
* Stop and clean up the sandbox.
|
|
96
|
+
*/
|
|
97
|
+
stop(): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Collect files from a local directory for uploading to sandbox.
|
|
101
|
+
*/
|
|
102
|
+
export declare function collectLocalFiles(dir: string, options?: {
|
|
103
|
+
excludePatterns?: string[];
|
|
104
|
+
includePatterns?: string[];
|
|
105
|
+
}): Promise<SandboxFile[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Split files into workspace files (visible to agent) and test files (hidden until validation).
|
|
108
|
+
*/
|
|
109
|
+
export declare function splitTestFiles(files: SandboxFile[]): {
|
|
110
|
+
workspaceFiles: SandboxFile[];
|
|
111
|
+
testFiles: SandboxFile[];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Verify that no test files exist in the sandbox.
|
|
115
|
+
*/
|
|
116
|
+
export declare function verifyNoTestFiles(sandbox: SandboxManager): Promise<void>;
|
|
117
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/lib/sandbox.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,E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G,OAAO,CAAC,aAAa,CAAC;IAcrF;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ7C;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKhD;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAa9D;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAStD;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,GACL,OAAO,CAAC,WAAW,EAAE,CAAC,CA+DxB;AAmBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG;IACpD,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B,CAeA;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAS9E"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel Sandbox integration for isolated eval execution.
|
|
3
|
+
*/
|
|
4
|
+
import { Sandbox as VercelSandbox } from '@vercel/sandbox';
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
/**
|
|
8
|
+
* Default timeout for sandbox operations (10 minutes).
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_SANDBOX_TIMEOUT = 600000;
|
|
11
|
+
/**
|
|
12
|
+
* Files to ignore when copying to sandbox.
|
|
13
|
+
* These are build artifacts and dependencies that shouldn't be uploaded.
|
|
14
|
+
* Note: This is a general-purpose pattern list used by collectLocalFiles().
|
|
15
|
+
* For eval-specific exclusions (PROMPT.md, EVAL.ts), see TEST_FILE_PATTERNS.
|
|
16
|
+
*/
|
|
17
|
+
export const IGNORED_PATTERNS = [
|
|
18
|
+
'.git',
|
|
19
|
+
'.next',
|
|
20
|
+
'node_modules',
|
|
21
|
+
'.DS_Store',
|
|
22
|
+
'*.log',
|
|
23
|
+
'build',
|
|
24
|
+
'dist',
|
|
25
|
+
'pnpm-lock.yaml',
|
|
26
|
+
'package-lock.json',
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Test/eval file patterns to withhold from agent during task execution.
|
|
30
|
+
* These files are uploaded AFTER the agent completes for validation.
|
|
31
|
+
* - PROMPT.md: Contains the task - agent receives this via CLI argument, not as a file
|
|
32
|
+
* - EVAL.ts: Validation tests - must be hidden so agent can't "cheat"
|
|
33
|
+
* - *.test.ts/tsx: Additional test files that shouldn't influence agent
|
|
34
|
+
*/
|
|
35
|
+
export const TEST_FILE_PATTERNS = ['*.test.tsx', '*.test.ts', 'EVAL.ts', 'PROMPT.md'];
|
|
36
|
+
/**
|
|
37
|
+
* Wrapper around Vercel Sandbox providing a cleaner API.
|
|
38
|
+
*/
|
|
39
|
+
export class SandboxManager {
|
|
40
|
+
sandbox;
|
|
41
|
+
_workingDirectory = '/vercel/sandbox';
|
|
42
|
+
constructor(sandbox) {
|
|
43
|
+
this.sandbox = sandbox;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a new sandbox instance.
|
|
47
|
+
*/
|
|
48
|
+
static async create(options = {}) {
|
|
49
|
+
const timeout = options.timeout ?? DEFAULT_SANDBOX_TIMEOUT;
|
|
50
|
+
const runtime = options.runtime ?? 'node24';
|
|
51
|
+
const sandbox = await VercelSandbox.create({ runtime, timeout });
|
|
52
|
+
return new SandboxManager(sandbox);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the sandbox ID.
|
|
56
|
+
*/
|
|
57
|
+
get sandboxId() {
|
|
58
|
+
return this.sandbox.sandboxId;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Run a command in the sandbox.
|
|
62
|
+
*/
|
|
63
|
+
async runCommand(command, args = [], options = {}) {
|
|
64
|
+
const result = await this.sandbox.runCommand({
|
|
65
|
+
cmd: command,
|
|
66
|
+
args,
|
|
67
|
+
env: options.env,
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
stdout: await result.stdout(),
|
|
71
|
+
stderr: await result.stderr(),
|
|
72
|
+
exitCode: result.exitCode,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Run a shell command (through bash).
|
|
77
|
+
*/
|
|
78
|
+
async runShell(command, env) {
|
|
79
|
+
const result = await this.sandbox.runCommand({
|
|
80
|
+
cmd: 'bash',
|
|
81
|
+
args: ['-c', command],
|
|
82
|
+
env,
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
stdout: await result.stdout(),
|
|
86
|
+
stderr: await result.stderr(),
|
|
87
|
+
exitCode: result.exitCode,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Read a file from the sandbox.
|
|
92
|
+
*/
|
|
93
|
+
async readFile(path) {
|
|
94
|
+
const result = await this.runCommand('cat', [path]);
|
|
95
|
+
if (result.exitCode !== 0) {
|
|
96
|
+
throw new Error(`Failed to read file ${path}: ${result.stderr}`);
|
|
97
|
+
}
|
|
98
|
+
return result.stdout;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if a file exists in the sandbox.
|
|
102
|
+
*/
|
|
103
|
+
async fileExists(path) {
|
|
104
|
+
const result = await this.runCommand('test', ['-f', path]);
|
|
105
|
+
return result.exitCode === 0;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Write files to the sandbox.
|
|
109
|
+
*/
|
|
110
|
+
async writeFiles(files) {
|
|
111
|
+
const sandboxFiles = [];
|
|
112
|
+
for (const [path, content] of Object.entries(files)) {
|
|
113
|
+
sandboxFiles.push({
|
|
114
|
+
path,
|
|
115
|
+
content: Buffer.from(content, 'utf-8'),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
await this.sandbox.writeFiles(sandboxFiles);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Upload files from local filesystem to sandbox.
|
|
122
|
+
*/
|
|
123
|
+
async uploadFiles(files) {
|
|
124
|
+
const sandboxFiles = files.map((f) => ({
|
|
125
|
+
path: f.path,
|
|
126
|
+
content: typeof f.content === 'string' ? Buffer.from(f.content, 'utf-8') : f.content,
|
|
127
|
+
}));
|
|
128
|
+
await this.sandbox.writeFiles(sandboxFiles);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get the working directory.
|
|
132
|
+
*/
|
|
133
|
+
getWorkingDirectory() {
|
|
134
|
+
return this._workingDirectory;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Stop and clean up the sandbox.
|
|
138
|
+
*/
|
|
139
|
+
async stop() {
|
|
140
|
+
await this.sandbox.stop();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Collect files from a local directory for uploading to sandbox.
|
|
145
|
+
*/
|
|
146
|
+
export async function collectLocalFiles(dir, options = {}) {
|
|
147
|
+
const { readdirSync, statSync } = await import('fs');
|
|
148
|
+
const excludePatterns = options.excludePatterns ?? IGNORED_PATTERNS;
|
|
149
|
+
const includePatterns = options.includePatterns;
|
|
150
|
+
const files = [];
|
|
151
|
+
function shouldExclude(name, relativePath) {
|
|
152
|
+
for (const pattern of excludePatterns) {
|
|
153
|
+
if (pattern.startsWith('*.')) {
|
|
154
|
+
// Wildcard pattern
|
|
155
|
+
const ext = pattern.slice(1);
|
|
156
|
+
if (name.endsWith(ext)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (name === pattern || relativePath === pattern) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
function shouldInclude(name) {
|
|
167
|
+
if (!includePatterns) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
for (const pattern of includePatterns) {
|
|
171
|
+
if (pattern.startsWith('*.')) {
|
|
172
|
+
const ext = pattern.slice(1);
|
|
173
|
+
if (name.endsWith(ext)) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if (name === pattern) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
function walk(currentDir, relativePath = '') {
|
|
184
|
+
const entries = readdirSync(currentDir);
|
|
185
|
+
for (const entry of entries) {
|
|
186
|
+
const entryRelativePath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
187
|
+
const fullPath = join(currentDir, entry);
|
|
188
|
+
if (shouldExclude(entry, entryRelativePath)) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const stat = statSync(fullPath);
|
|
192
|
+
if (stat.isDirectory()) {
|
|
193
|
+
walk(fullPath, entryRelativePath);
|
|
194
|
+
}
|
|
195
|
+
else if (shouldInclude(entry)) {
|
|
196
|
+
const content = readFileSync(fullPath);
|
|
197
|
+
files.push({ path: entryRelativePath, content });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
walk(dir);
|
|
202
|
+
return files;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if a filename matches any of the test file patterns.
|
|
206
|
+
*/
|
|
207
|
+
function isTestFilePattern(filename) {
|
|
208
|
+
for (const pattern of TEST_FILE_PATTERNS) {
|
|
209
|
+
if (pattern.startsWith('*.')) {
|
|
210
|
+
const ext = pattern.slice(1);
|
|
211
|
+
if (filename.endsWith(ext)) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (filename === pattern) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Split files into workspace files (visible to agent) and test files (hidden until validation).
|
|
223
|
+
*/
|
|
224
|
+
export function splitTestFiles(files) {
|
|
225
|
+
const workspaceFiles = [];
|
|
226
|
+
const testFiles = [];
|
|
227
|
+
for (const file of files) {
|
|
228
|
+
const name = file.path.split('/').pop() ?? file.path;
|
|
229
|
+
if (isTestFilePattern(name)) {
|
|
230
|
+
testFiles.push(file);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
workspaceFiles.push(file);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return { workspaceFiles, testFiles };
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Verify that no test files exist in the sandbox.
|
|
240
|
+
*/
|
|
241
|
+
export async function verifyNoTestFiles(sandbox) {
|
|
242
|
+
const result = await sandbox.runShell("find . -path './node_modules' -prune -o \\( -name '*.test.tsx' -o -name '*.test.ts' -o -name 'EVAL.ts' \\) -print");
|
|
243
|
+
const foundTests = result.stdout.trim();
|
|
244
|
+
if (foundTests) {
|
|
245
|
+
throw new Error(`Test files found in sandbox before agent run: ${foundTests}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/lib/sandbox.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,YAAY,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