@vercel/agent-eval 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/agents/claude-code/agent.d.ts +30 -0
- package/dist/lib/agents/claude-code/agent.d.ts.map +1 -0
- package/dist/lib/agents/claude-code/agent.js +80 -0
- package/dist/lib/agents/claude-code/agent.js.map +1 -0
- package/dist/lib/agents/claude-code/run.mjs +217 -0
- package/dist/lib/agents/codex/agent.d.ts +61 -0
- package/dist/lib/agents/codex/agent.d.ts.map +1 -0
- package/dist/lib/agents/codex/agent.js +221 -0
- package/dist/lib/agents/codex/agent.js.map +1 -0
- package/dist/lib/agents/codex/run.mjs +365 -0
- package/dist/lib/agents/cursor/agent.d.ts +32 -0
- package/dist/lib/agents/cursor/agent.d.ts.map +1 -0
- package/dist/lib/agents/cursor/agent.js +86 -0
- package/dist/lib/agents/cursor/agent.js.map +1 -0
- package/dist/lib/agents/cursor/run.mjs +183 -0
- package/dist/lib/agents/eval-helper.mjs +222 -0
- package/dist/lib/agents/gemini/agent.d.ts +27 -0
- package/dist/lib/agents/gemini/agent.d.ts.map +1 -0
- package/dist/lib/agents/gemini/agent.js +69 -0
- package/dist/lib/agents/gemini/agent.js.map +1 -0
- package/dist/lib/agents/gemini/run.mjs +180 -0
- package/dist/lib/agents/index.js +5 -5
- package/dist/lib/agents/index.js.map +1 -1
- package/dist/lib/agents/opencode/agent.d.ts +68 -0
- package/dist/lib/agents/opencode/agent.d.ts.map +1 -0
- package/dist/lib/agents/opencode/agent.js +165 -0
- package/dist/lib/agents/opencode/agent.js.map +1 -0
- package/dist/lib/agents/opencode/run.mjs +308 -0
- package/dist/lib/agents/plugin/contract.d.ts +157 -0
- package/dist/lib/agents/plugin/contract.d.ts.map +1 -0
- package/dist/lib/agents/plugin/contract.js +22 -0
- package/dist/lib/agents/plugin/contract.js.map +1 -0
- package/dist/lib/agents/plugin/orchestrator.d.ts +22 -0
- package/dist/lib/agents/plugin/orchestrator.d.ts.map +1 -0
- package/dist/lib/agents/plugin/orchestrator.js +286 -0
- package/dist/lib/agents/plugin/orchestrator.js.map +1 -0
- package/dist/lib/agents/shared.d.ts +7 -1
- package/dist/lib/agents/shared.d.ts.map +1 -1
- package/dist/lib/agents/shared.js +30 -3
- package/dist/lib/agents/shared.js.map +1 -1
- package/package.json +2 -2
- package/dist/lib/agents/claude-code.d.ts +0 -23
- package/dist/lib/agents/claude-code.d.ts.map +0 -1
- package/dist/lib/agents/claude-code.js +0 -300
- package/dist/lib/agents/claude-code.js.map +0 -1
- package/dist/lib/agents/codex.d.ts +0 -23
- package/dist/lib/agents/codex.d.ts.map +0 -1
- package/dist/lib/agents/codex.js +0 -364
- package/dist/lib/agents/codex.js.map +0 -1
- package/dist/lib/agents/cursor.d.ts +0 -10
- package/dist/lib/agents/cursor.d.ts.map +0 -1
- package/dist/lib/agents/cursor.js +0 -207
- package/dist/lib/agents/cursor.js.map +0 -1
- package/dist/lib/agents/gemini.d.ts +0 -10
- package/dist/lib/agents/gemini.d.ts.map +0 -1
- package/dist/lib/agents/gemini.js +0 -208
- package/dist/lib/agents/gemini.js.map +0 -1
- package/dist/lib/agents/opencode.d.ts +0 -46
- package/dist/lib/agents/opencode.d.ts.map +0 -1
- package/dist/lib/agents/opencode.js +0 -365
- package/dist/lib/agents/opencode.js.map +0 -1
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gemini CLI agent implementation.
|
|
3
|
-
* Uses direct Google Gemini API access.
|
|
4
|
-
*/
|
|
5
|
-
import { createSandbox, collectLocalFiles, splitTestFiles, verifyNoTestFiles, } from '../sandbox.js';
|
|
6
|
-
import { runValidation, captureGeneratedFiles, createVitestConfig, GEMINI_DIRECT, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, } from './shared.js';
|
|
7
|
-
/**
|
|
8
|
-
* Extract transcript from Gemini stream-json output.
|
|
9
|
-
* When run with --output-format stream-json, Gemini outputs JSONL (newline-delimited JSON).
|
|
10
|
-
*/
|
|
11
|
-
function extractTranscriptFromOutput(output) {
|
|
12
|
-
if (!output || !output.trim()) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
// The --output-format stream-json output contains JSON events, one per line
|
|
16
|
-
// Filter to only include lines that look like JSON objects
|
|
17
|
-
const lines = output.split('\n').filter(line => {
|
|
18
|
-
const trimmed = line.trim();
|
|
19
|
-
return trimmed.startsWith('{') && trimmed.endsWith('}');
|
|
20
|
-
});
|
|
21
|
-
if (lines.length === 0) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return lines.join('\n');
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create Gemini CLI agent with direct API authentication.
|
|
28
|
-
*/
|
|
29
|
-
export function createGeminiAgent() {
|
|
30
|
-
return {
|
|
31
|
-
name: 'gemini',
|
|
32
|
-
displayName: 'Gemini CLI',
|
|
33
|
-
getApiKeyEnvVar() {
|
|
34
|
-
return GEMINI_DIRECT.apiKeyEnvVar;
|
|
35
|
-
},
|
|
36
|
-
getDefaultModel() {
|
|
37
|
-
return 'gemini-3-pro-preview';
|
|
38
|
-
},
|
|
39
|
-
async run(fixturePath, options) {
|
|
40
|
-
const startTime = Date.now();
|
|
41
|
-
let sandbox = null;
|
|
42
|
-
let agentOutput = '';
|
|
43
|
-
let transcript;
|
|
44
|
-
let aborted = false;
|
|
45
|
-
let sandboxStopped = false;
|
|
46
|
-
// Handle abort signal
|
|
47
|
-
const abortHandler = () => {
|
|
48
|
-
aborted = true;
|
|
49
|
-
if (sandbox && !sandboxStopped) {
|
|
50
|
-
sandboxStopped = true;
|
|
51
|
-
sandbox.stop().catch(() => { });
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
if (options.signal) {
|
|
55
|
-
if (options.signal.aborted) {
|
|
56
|
-
return {
|
|
57
|
-
success: false,
|
|
58
|
-
output: '',
|
|
59
|
-
error: 'Aborted before start',
|
|
60
|
-
duration: 0,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
options.signal.addEventListener('abort', abortHandler);
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
// Collect files from fixture
|
|
67
|
-
const allFiles = await collectLocalFiles(fixturePath);
|
|
68
|
-
const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
|
|
69
|
-
// Check for abort before expensive operations
|
|
70
|
-
if (aborted) {
|
|
71
|
-
return {
|
|
72
|
-
success: false,
|
|
73
|
-
output: '',
|
|
74
|
-
error: 'Aborted',
|
|
75
|
-
duration: Date.now() - startTime,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// Create sandbox
|
|
79
|
-
sandbox = await createSandbox({
|
|
80
|
-
timeout: options.timeout,
|
|
81
|
-
runtime: 'node24',
|
|
82
|
-
backend: options.sandbox,
|
|
83
|
-
});
|
|
84
|
-
// Check for abort after sandbox creation (abort may have fired during create)
|
|
85
|
-
if (aborted) {
|
|
86
|
-
return {
|
|
87
|
-
success: false,
|
|
88
|
-
output: '',
|
|
89
|
-
error: 'Aborted',
|
|
90
|
-
duration: Date.now() - startTime,
|
|
91
|
-
sandboxId: sandbox.sandboxId,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
// Upload workspace files (excluding tests)
|
|
95
|
-
await sandbox.uploadFiles(workspaceFiles);
|
|
96
|
-
await initGitAndCommit(sandbox);
|
|
97
|
-
// Run setup function if provided
|
|
98
|
-
if (options.setup) {
|
|
99
|
-
await options.setup(sandbox);
|
|
100
|
-
}
|
|
101
|
-
const neutralWorkspace = await prepareNeutralWorkspace(sandbox);
|
|
102
|
-
// Install dependencies
|
|
103
|
-
let installResult = await sandbox.runCommand('npm', ['install']);
|
|
104
|
-
if (installResult.exitCode !== 0) {
|
|
105
|
-
installResult = await sandbox.runCommand('npm', ['install']);
|
|
106
|
-
}
|
|
107
|
-
if (installResult.exitCode !== 0) {
|
|
108
|
-
const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
|
|
109
|
-
throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
|
|
110
|
-
}
|
|
111
|
-
// Install Gemini CLI globally
|
|
112
|
-
const cliInstall = await sandbox.runCommand('npm', [
|
|
113
|
-
'install',
|
|
114
|
-
'-g',
|
|
115
|
-
'@google/gemini-cli',
|
|
116
|
-
]);
|
|
117
|
-
if (cliInstall.exitCode !== 0) {
|
|
118
|
-
throw new Error(`Gemini CLI install failed: ${cliInstall.stderr}`);
|
|
119
|
-
}
|
|
120
|
-
// Verify no test files in sandbox
|
|
121
|
-
await verifyNoTestFiles(sandbox);
|
|
122
|
-
// Run Gemini CLI with direct API access
|
|
123
|
-
// Using stream-json format for detailed event transcript (similar to Codex's --json)
|
|
124
|
-
const geminiArgs = [
|
|
125
|
-
'--prompt',
|
|
126
|
-
options.prompt,
|
|
127
|
-
];
|
|
128
|
-
if (options.model) {
|
|
129
|
-
geminiArgs.push('--model', options.model);
|
|
130
|
-
}
|
|
131
|
-
geminiArgs.push('--approval-mode', 'yolo', '--output-format', 'stream-json');
|
|
132
|
-
const geminiResult = await sandbox.runCommand('gemini', geminiArgs, {
|
|
133
|
-
env: {
|
|
134
|
-
[GEMINI_DIRECT.apiKeyEnvVar]: options.apiKey,
|
|
135
|
-
...neutralWorkspace.env,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
agentOutput = geminiResult.stdout + geminiResult.stderr;
|
|
139
|
-
transcript = extractTranscriptFromOutput(agentOutput);
|
|
140
|
-
if (geminiResult.exitCode !== 0) {
|
|
141
|
-
// Extract meaningful error from output (last few lines usually contain the error)
|
|
142
|
-
const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
|
|
143
|
-
return {
|
|
144
|
-
success: false,
|
|
145
|
-
output: agentOutput,
|
|
146
|
-
transcript,
|
|
147
|
-
error: errorLines || `Gemini CLI exited with code ${geminiResult.exitCode}`,
|
|
148
|
-
duration: Date.now() - startTime,
|
|
149
|
-
sandboxId: sandbox.sandboxId,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
// Upload test files for validation
|
|
153
|
-
await sandbox.uploadFiles(testFiles);
|
|
154
|
-
// Create vitest config for EVAL.ts/tsx
|
|
155
|
-
await createVitestConfig(sandbox);
|
|
156
|
-
// Inject transcript context so EVAL.ts tests can assert on agent behavior
|
|
157
|
-
await injectTranscriptContext(sandbox, transcript, 'gemini', options.model);
|
|
158
|
-
// Run validation scripts
|
|
159
|
-
const validationResults = await runValidation(sandbox, options.scripts ?? []);
|
|
160
|
-
// Capture generated files
|
|
161
|
-
const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
|
|
162
|
-
return {
|
|
163
|
-
success: validationResults.allPassed,
|
|
164
|
-
output: agentOutput,
|
|
165
|
-
transcript,
|
|
166
|
-
duration: Date.now() - startTime,
|
|
167
|
-
testResult: validationResults.test,
|
|
168
|
-
scriptsResults: validationResults.scripts,
|
|
169
|
-
sandboxId: sandbox.sandboxId,
|
|
170
|
-
generatedFiles,
|
|
171
|
-
deletedFiles,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
// Check if this was an abort
|
|
176
|
-
if (aborted) {
|
|
177
|
-
return {
|
|
178
|
-
success: false,
|
|
179
|
-
output: agentOutput,
|
|
180
|
-
transcript,
|
|
181
|
-
error: 'Aborted',
|
|
182
|
-
duration: Date.now() - startTime,
|
|
183
|
-
sandboxId: sandbox?.sandboxId,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
success: false,
|
|
188
|
-
output: agentOutput,
|
|
189
|
-
transcript,
|
|
190
|
-
error: error instanceof Error ? error.message : String(error),
|
|
191
|
-
duration: Date.now() - startTime,
|
|
192
|
-
sandboxId: sandbox?.sandboxId,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
// Clean up abort listener
|
|
197
|
-
if (options.signal) {
|
|
198
|
-
options.signal.removeEventListener('abort', abortHandler);
|
|
199
|
-
}
|
|
200
|
-
if (sandbox && !sandboxStopped) {
|
|
201
|
-
sandboxStopped = true;
|
|
202
|
-
await sandbox.stop();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=gemini.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/lib/agents/gemini.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAKrB;;;GAGG;AACH,SAAS,2BAA2B,CAAC,MAAc;IACjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,4EAA4E;IAC5E,2DAA2D;IAC3D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAA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
|
|
5
|
-
import type { Agent } from './types.js';
|
|
6
|
-
export declare function extractObservedModelFromOpenCodeOutput(output: string): string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Extract the session id from the `--format json` event stream.
|
|
9
|
-
* Every emitted event carries a `sessionID` field.
|
|
10
|
-
*/
|
|
11
|
-
export declare function extractSessionIdFromTranscript(transcript: string | undefined): string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Extract the observed model from `opencode export <sessionID>` output.
|
|
14
|
-
* Assistant messages carry `providerID` and `modelID` in their info.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extractObservedModelFromSessionExport(exportOutput: string): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Additional provider configuration for models not yet available in the
|
|
19
|
-
* default Vercel AI Gateway (e.g., early access / unreleased models).
|
|
20
|
-
*/
|
|
21
|
-
export interface OpenCodeProviderConfig {
|
|
22
|
-
npm?: string;
|
|
23
|
-
options?: Record<string, unknown>;
|
|
24
|
-
models?: Record<string, {
|
|
25
|
-
name?: string;
|
|
26
|
-
tool_call?: boolean;
|
|
27
|
-
reasoning?: boolean;
|
|
28
|
-
attachment?: boolean;
|
|
29
|
-
temperature?: boolean;
|
|
30
|
-
limit?: {
|
|
31
|
-
context: number;
|
|
32
|
-
output: number;
|
|
33
|
-
};
|
|
34
|
-
}>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Generate OpenCode config file content.
|
|
38
|
-
* Configures the Vercel AI Gateway provider, plus any additional providers.
|
|
39
|
-
*/
|
|
40
|
-
export declare function generateOpenCodeConfig(extraProviders?: Record<string, OpenCodeProviderConfig>, apiKey?: string, timeoutMs?: number, webResearch?: boolean): string;
|
|
41
|
-
/**
|
|
42
|
-
* Create OpenCode agent with Vercel AI Gateway authentication.
|
|
43
|
-
* Note: OpenCode only supports Vercel AI Gateway, not direct provider APIs.
|
|
44
|
-
*/
|
|
45
|
-
export declare function createOpenCodeAgent(): Agent;
|
|
46
|
-
//# sourceMappingURL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@@ -1,365 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode CLI agent implementation.
|
|
3
|
-
* Uses Vercel AI Gateway for model access.
|
|
4
|
-
*/
|
|
5
|
-
import { createSandbox, collectLocalFiles, splitTestFiles, verifyNoTestFiles, } from '../sandbox.js';
|
|
6
|
-
import { runValidation, captureGeneratedFiles, createVitestConfig, AI_GATEWAY, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, } from './shared.js';
|
|
7
|
-
/**
|
|
8
|
-
* Extract transcript from OpenCode JSON output.
|
|
9
|
-
* When run with --format json, OpenCode outputs JSON events to stdout.
|
|
10
|
-
*/
|
|
11
|
-
function extractTranscriptFromOutput(output) {
|
|
12
|
-
if (!output || !output.trim()) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
// The --format json output contains JSON events, one per line
|
|
16
|
-
// Filter to only include lines that look like JSON objects
|
|
17
|
-
const lines = output.split('\n').filter(line => {
|
|
18
|
-
const trimmed = line.trim();
|
|
19
|
-
return trimmed.startsWith('{') && trimmed.endsWith('}');
|
|
20
|
-
});
|
|
21
|
-
if (lines.length === 0) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return lines.join('\n');
|
|
25
|
-
}
|
|
26
|
-
export function extractObservedModelFromOpenCodeOutput(output) {
|
|
27
|
-
let observedModel;
|
|
28
|
-
for (const line of output.split('\n')) {
|
|
29
|
-
if (!line.includes('service=llm') || !line.includes('small=false') || !line.includes('agent=build')) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
const providerMatch = line.match(/providerID=([^\s]+)/);
|
|
33
|
-
const modelMatch = line.match(/modelID=([^\s]+)/);
|
|
34
|
-
const providerID = providerMatch?.[1];
|
|
35
|
-
const modelID = modelMatch?.[1];
|
|
36
|
-
if (providerID && modelID) {
|
|
37
|
-
observedModel = `${providerID}/${modelID}`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return observedModel;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Extract the session id from the `--format json` event stream.
|
|
44
|
-
* Every emitted event carries a `sessionID` field.
|
|
45
|
-
*/
|
|
46
|
-
export function extractSessionIdFromTranscript(transcript) {
|
|
47
|
-
if (!transcript) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
for (const line of transcript.split('\n')) {
|
|
51
|
-
try {
|
|
52
|
-
const event = JSON.parse(line);
|
|
53
|
-
if (typeof event.sessionID === 'string' && event.sessionID) {
|
|
54
|
-
return event.sessionID;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
// Skip non-JSON lines
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Extract the observed model from `opencode export <sessionID>` output.
|
|
65
|
-
* Assistant messages carry `providerID` and `modelID` in their info.
|
|
66
|
-
*/
|
|
67
|
-
export function extractObservedModelFromSessionExport(exportOutput) {
|
|
68
|
-
const start = exportOutput.indexOf('{');
|
|
69
|
-
if (start === -1) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
let parsed;
|
|
73
|
-
try {
|
|
74
|
-
parsed = JSON.parse(exportOutput.slice(start));
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
const messages = parsed.messages;
|
|
80
|
-
if (!Array.isArray(messages)) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
for (const message of messages) {
|
|
84
|
-
const info = message.info;
|
|
85
|
-
if (info?.role !== 'assistant') {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (typeof info.providerID === 'string' && info.providerID &&
|
|
89
|
-
typeof info.modelID === 'string' && info.modelID) {
|
|
90
|
-
return `${info.providerID}/${info.modelID}`;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Generate OpenCode config file content.
|
|
97
|
-
* Configures the Vercel AI Gateway provider, plus any additional providers.
|
|
98
|
-
*/
|
|
99
|
-
export function generateOpenCodeConfig(extraProviders, apiKey, timeoutMs, webResearch) {
|
|
100
|
-
const vercelBase = {
|
|
101
|
-
options: {
|
|
102
|
-
apiKey: apiKey || '{env:AI_GATEWAY_API_KEY}',
|
|
103
|
-
...(timeoutMs ? { timeout: timeoutMs } : {}),
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
const { vercel: vercelExtra, ...otherProviders } = extraProviders || {};
|
|
107
|
-
const providers = {
|
|
108
|
-
vercel: {
|
|
109
|
-
...vercelBase,
|
|
110
|
-
...vercelExtra,
|
|
111
|
-
options: { ...vercelBase.options, ...vercelExtra?.options },
|
|
112
|
-
},
|
|
113
|
-
...otherProviders,
|
|
114
|
-
};
|
|
115
|
-
return JSON.stringify({
|
|
116
|
-
$schema: 'https://opencode.ai/config.json',
|
|
117
|
-
provider: providers,
|
|
118
|
-
permission: {
|
|
119
|
-
write: 'allow',
|
|
120
|
-
edit: 'allow',
|
|
121
|
-
bash: 'allow',
|
|
122
|
-
// OpenCode has no native web search; Exa-backed search is enabled via
|
|
123
|
-
// OPENCODE_ENABLE_EXA=1 alongside these tool permissions.
|
|
124
|
-
...(webResearch ? { webfetch: 'allow', websearch: 'allow' } : {}),
|
|
125
|
-
},
|
|
126
|
-
}, null, 2);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Create OpenCode agent with Vercel AI Gateway authentication.
|
|
130
|
-
* Note: OpenCode only supports Vercel AI Gateway, not direct provider APIs.
|
|
131
|
-
*/
|
|
132
|
-
export function createOpenCodeAgent() {
|
|
133
|
-
return {
|
|
134
|
-
name: 'vercel-ai-gateway/opencode',
|
|
135
|
-
displayName: 'OpenCode (Vercel AI Gateway)',
|
|
136
|
-
getApiKeyEnvVar() {
|
|
137
|
-
return AI_GATEWAY.apiKeyEnvVar;
|
|
138
|
-
},
|
|
139
|
-
getDefaultModel() {
|
|
140
|
-
return 'vercel/anthropic/claude-sonnet-4';
|
|
141
|
-
},
|
|
142
|
-
async run(fixturePath, options) {
|
|
143
|
-
const startTime = Date.now();
|
|
144
|
-
let sandbox = null;
|
|
145
|
-
let agentOutput = '';
|
|
146
|
-
let transcript;
|
|
147
|
-
let aborted = false;
|
|
148
|
-
let sandboxStopped = false;
|
|
149
|
-
// Handle abort signal
|
|
150
|
-
const abortHandler = () => {
|
|
151
|
-
aborted = true;
|
|
152
|
-
if (sandbox && !sandboxStopped) {
|
|
153
|
-
sandboxStopped = true;
|
|
154
|
-
sandbox.stop().catch(() => { });
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
if (options.signal) {
|
|
158
|
-
if (options.signal.aborted) {
|
|
159
|
-
return {
|
|
160
|
-
success: false,
|
|
161
|
-
output: '',
|
|
162
|
-
error: 'Aborted before start',
|
|
163
|
-
duration: 0,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
options.signal.addEventListener('abort', abortHandler);
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
// Collect files from fixture
|
|
170
|
-
const allFiles = await collectLocalFiles(fixturePath);
|
|
171
|
-
const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
|
|
172
|
-
// Check for abort before expensive operations
|
|
173
|
-
if (aborted) {
|
|
174
|
-
return {
|
|
175
|
-
success: false,
|
|
176
|
-
output: '',
|
|
177
|
-
error: 'Aborted',
|
|
178
|
-
duration: Date.now() - startTime,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
// Create sandbox
|
|
182
|
-
sandbox = await createSandbox({
|
|
183
|
-
timeout: options.timeout,
|
|
184
|
-
runtime: 'node24',
|
|
185
|
-
backend: options.sandbox,
|
|
186
|
-
});
|
|
187
|
-
// Check for abort after sandbox creation (abort may have fired during create)
|
|
188
|
-
if (aborted) {
|
|
189
|
-
return {
|
|
190
|
-
success: false,
|
|
191
|
-
output: '',
|
|
192
|
-
error: 'Aborted',
|
|
193
|
-
duration: Date.now() - startTime,
|
|
194
|
-
sandboxId: sandbox.sandboxId,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
// Upload workspace files (excluding tests)
|
|
198
|
-
await sandbox.uploadFiles(workspaceFiles);
|
|
199
|
-
await initGitAndCommit(sandbox);
|
|
200
|
-
// Run setup function if provided
|
|
201
|
-
if (options.setup) {
|
|
202
|
-
await options.setup(sandbox);
|
|
203
|
-
}
|
|
204
|
-
const neutralWorkspace = await prepareNeutralWorkspace(sandbox);
|
|
205
|
-
// Install dependencies
|
|
206
|
-
let installResult = await sandbox.runCommand('npm', ['install']);
|
|
207
|
-
if (installResult.exitCode !== 0) {
|
|
208
|
-
installResult = await sandbox.runCommand('npm', ['install']);
|
|
209
|
-
}
|
|
210
|
-
if (installResult.exitCode !== 0) {
|
|
211
|
-
const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
|
|
212
|
-
throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
|
|
213
|
-
}
|
|
214
|
-
// Install OpenCode CLI
|
|
215
|
-
const binaryUrl = options.agentOptions?.binaryUrl;
|
|
216
|
-
const extraProviders = options.agentOptions?.extraProviders;
|
|
217
|
-
if (binaryUrl) {
|
|
218
|
-
// Download custom binary (e.g., patched build for unreleased models)
|
|
219
|
-
const cliInstall = await sandbox.runCommand('bash', [
|
|
220
|
-
'-c',
|
|
221
|
-
`mkdir -p $HOME/.local/bin && curl -fsSL "${binaryUrl}" -o $HOME/.local/bin/opencode && chmod +x $HOME/.local/bin/opencode`,
|
|
222
|
-
]);
|
|
223
|
-
if (cliInstall.exitCode !== 0) {
|
|
224
|
-
throw new Error(`OpenCode CLI install failed: ${cliInstall.stdout} ${cliInstall.stderr}`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
const cliInstall = await sandbox.runCommand('npm', [
|
|
229
|
-
'install',
|
|
230
|
-
'-g',
|
|
231
|
-
'opencode-ai',
|
|
232
|
-
]);
|
|
233
|
-
if (cliInstall.exitCode !== 0) {
|
|
234
|
-
throw new Error(`OpenCode CLI install failed: ${cliInstall.stderr}`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
// Create OpenCode config file in the project directory
|
|
238
|
-
const configContent = generateOpenCodeConfig(extraProviders, options.apiKey, options.timeout, options.webResearch);
|
|
239
|
-
await sandbox.writeFiles({
|
|
240
|
-
'opencode.json': configContent,
|
|
241
|
-
});
|
|
242
|
-
// Verify no test files in sandbox
|
|
243
|
-
await verifyNoTestFiles(sandbox);
|
|
244
|
-
// Run OpenCode CLI using run mode for non-interactive execution.
|
|
245
|
-
// Use --format json for structured output (transcript). Native-default
|
|
246
|
-
// runs also print logs, which lets older OpenCode versions report the
|
|
247
|
-
// CLI-selected model without a follow-up export call.
|
|
248
|
-
const opencodeArgs = [
|
|
249
|
-
'run',
|
|
250
|
-
options.prompt,
|
|
251
|
-
'--format',
|
|
252
|
-
'json',
|
|
253
|
-
];
|
|
254
|
-
if (options.model) {
|
|
255
|
-
opencodeArgs.push('--model', options.model);
|
|
256
|
-
}
|
|
257
|
-
else if (options.modelPolicy === 'native-default') {
|
|
258
|
-
opencodeArgs.push('--print-logs', '--log-level', 'INFO');
|
|
259
|
-
}
|
|
260
|
-
const opencodeResult = await sandbox.runCommand('opencode', opencodeArgs, {
|
|
261
|
-
env: {
|
|
262
|
-
[AI_GATEWAY.apiKeyEnvVar]: options.apiKey,
|
|
263
|
-
// Exa-backed websearch is gated behind this env var in the
|
|
264
|
-
// OpenCode CLI; the matching tool permissions are written into
|
|
265
|
-
// opencode.json by generateOpenCodeConfig.
|
|
266
|
-
...(options.webResearch ? { OPENCODE_ENABLE_EXA: '1' } : {}),
|
|
267
|
-
...neutralWorkspace.env,
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
agentOutput = opencodeResult.stdout + opencodeResult.stderr;
|
|
271
|
-
transcript = extractTranscriptFromOutput(agentOutput);
|
|
272
|
-
// Resolve the model OpenCode actually used. The `--format json` events
|
|
273
|
-
// never include it, so first try scraping the printed logs (works on
|
|
274
|
-
// OpenCode <= 1.16.x), then fall back to `opencode export <sessionID>`,
|
|
275
|
-
// whose assistant messages carry providerID/modelID (OpenCode 1.17.0
|
|
276
|
-
// changed the log format, which broke the scrape). Observation must
|
|
277
|
-
// never fail the run.
|
|
278
|
-
let observedModel = extractObservedModelFromOpenCodeOutput(agentOutput);
|
|
279
|
-
if (!observedModel) {
|
|
280
|
-
const sessionId = extractSessionIdFromTranscript(transcript);
|
|
281
|
-
if (sessionId) {
|
|
282
|
-
try {
|
|
283
|
-
const exportResult = await sandbox.runCommand('opencode', ['export', sessionId]);
|
|
284
|
-
if (exportResult.exitCode === 0) {
|
|
285
|
-
observedModel = extractObservedModelFromSessionExport(exportResult.stdout);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
catch {
|
|
289
|
-
// Leave observedModel undefined
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
if (opencodeResult.exitCode !== 0) {
|
|
294
|
-
// Extract meaningful error from output (last few lines usually contain the error)
|
|
295
|
-
const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
|
|
296
|
-
return {
|
|
297
|
-
success: false,
|
|
298
|
-
output: agentOutput,
|
|
299
|
-
transcript,
|
|
300
|
-
error: errorLines || `OpenCode CLI exited with code ${opencodeResult.exitCode}`,
|
|
301
|
-
duration: Date.now() - startTime,
|
|
302
|
-
sandboxId: sandbox.sandboxId,
|
|
303
|
-
observedModel,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
if (options.validation !== 'none') {
|
|
307
|
-
// Upload test files for validation
|
|
308
|
-
await sandbox.uploadFiles(testFiles);
|
|
309
|
-
// Create vitest config for EVAL.ts/tsx
|
|
310
|
-
await createVitestConfig(sandbox);
|
|
311
|
-
// Inject transcript context so EVAL.ts tests can assert on agent behavior
|
|
312
|
-
await injectTranscriptContext(sandbox, transcript, 'vercel-ai-gateway/opencode', options.model);
|
|
313
|
-
}
|
|
314
|
-
// Run validation scripts
|
|
315
|
-
const validationResults = await runValidation(sandbox, options.scripts ?? [], options.validation);
|
|
316
|
-
// Capture generated files
|
|
317
|
-
const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
|
|
318
|
-
return {
|
|
319
|
-
success: validationResults.allPassed,
|
|
320
|
-
output: agentOutput,
|
|
321
|
-
transcript,
|
|
322
|
-
duration: Date.now() - startTime,
|
|
323
|
-
testResult: validationResults.test,
|
|
324
|
-
scriptsResults: validationResults.scripts,
|
|
325
|
-
sandboxId: sandbox.sandboxId,
|
|
326
|
-
generatedFiles,
|
|
327
|
-
deletedFiles,
|
|
328
|
-
observedModel,
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
catch (error) {
|
|
332
|
-
// Check if this was an abort
|
|
333
|
-
if (aborted) {
|
|
334
|
-
return {
|
|
335
|
-
success: false,
|
|
336
|
-
output: agentOutput,
|
|
337
|
-
transcript,
|
|
338
|
-
error: 'Aborted',
|
|
339
|
-
duration: Date.now() - startTime,
|
|
340
|
-
sandboxId: sandbox?.sandboxId,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
return {
|
|
344
|
-
success: false,
|
|
345
|
-
output: agentOutput,
|
|
346
|
-
transcript,
|
|
347
|
-
error: error instanceof Error ? error.message : String(error),
|
|
348
|
-
duration: Date.now() - startTime,
|
|
349
|
-
sandboxId: sandbox?.sandboxId,
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
finally {
|
|
353
|
-
// Clean up abort listener
|
|
354
|
-
if (options.signal) {
|
|
355
|
-
options.signal.removeEventListener('abort', abortHandler);
|
|
356
|
-
}
|
|
357
|
-
if (sandbox && !sandboxStopped) {
|
|
358
|
-
sandboxStopped = true;
|
|
359
|
-
await sandbox.stop();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
//# sourceMappingURL=opencode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../src/lib/agents/opencode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAKrB;;;GAGG;AACH,SAAS,2BAA2B,CAAC,MAAc;IACjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,8DAA8D;IAC9D,2DAA2D;IAC3D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,MAAc;IACnE,IAAI,aAAiC,CAAC;IAEtC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CA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