@vercel/agent-eval 1.1.1 → 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.
Files changed (61) hide show
  1. package/dist/lib/agents/claude-code/agent.d.ts +30 -0
  2. package/dist/lib/agents/claude-code/agent.d.ts.map +1 -0
  3. package/dist/lib/agents/claude-code/agent.js +80 -0
  4. package/dist/lib/agents/claude-code/agent.js.map +1 -0
  5. package/dist/lib/agents/claude-code/run.mjs +217 -0
  6. package/dist/lib/agents/codex/agent.d.ts +61 -0
  7. package/dist/lib/agents/codex/agent.d.ts.map +1 -0
  8. package/dist/lib/agents/codex/agent.js +221 -0
  9. package/dist/lib/agents/codex/agent.js.map +1 -0
  10. package/dist/lib/agents/codex/run.mjs +365 -0
  11. package/dist/lib/agents/cursor/agent.d.ts +32 -0
  12. package/dist/lib/agents/cursor/agent.d.ts.map +1 -0
  13. package/dist/lib/agents/cursor/agent.js +86 -0
  14. package/dist/lib/agents/cursor/agent.js.map +1 -0
  15. package/dist/lib/agents/cursor/run.mjs +183 -0
  16. package/dist/lib/agents/eval-helper.mjs +222 -0
  17. package/dist/lib/agents/gemini/agent.d.ts +27 -0
  18. package/dist/lib/agents/gemini/agent.d.ts.map +1 -0
  19. package/dist/lib/agents/gemini/agent.js +69 -0
  20. package/dist/lib/agents/gemini/agent.js.map +1 -0
  21. package/dist/lib/agents/gemini/run.mjs +180 -0
  22. package/dist/lib/agents/index.js +5 -5
  23. package/dist/lib/agents/index.js.map +1 -1
  24. package/dist/lib/agents/opencode/agent.d.ts +68 -0
  25. package/dist/lib/agents/opencode/agent.d.ts.map +1 -0
  26. package/dist/lib/agents/opencode/agent.js +165 -0
  27. package/dist/lib/agents/opencode/agent.js.map +1 -0
  28. package/dist/lib/agents/opencode/run.mjs +308 -0
  29. package/dist/lib/agents/plugin/contract.d.ts +157 -0
  30. package/dist/lib/agents/plugin/contract.d.ts.map +1 -0
  31. package/dist/lib/agents/plugin/contract.js +22 -0
  32. package/dist/lib/agents/plugin/contract.js.map +1 -0
  33. package/dist/lib/agents/plugin/orchestrator.d.ts +22 -0
  34. package/dist/lib/agents/plugin/orchestrator.d.ts.map +1 -0
  35. package/dist/lib/agents/plugin/orchestrator.js +286 -0
  36. package/dist/lib/agents/plugin/orchestrator.js.map +1 -0
  37. package/dist/lib/agents/shared.d.ts +7 -1
  38. package/dist/lib/agents/shared.d.ts.map +1 -1
  39. package/dist/lib/agents/shared.js +30 -3
  40. package/dist/lib/agents/shared.js.map +1 -1
  41. package/package.json +2 -2
  42. package/dist/lib/agents/claude-code.d.ts +0 -33
  43. package/dist/lib/agents/claude-code.d.ts.map +0 -1
  44. package/dist/lib/agents/claude-code.js +0 -310
  45. package/dist/lib/agents/claude-code.js.map +0 -1
  46. package/dist/lib/agents/codex.d.ts +0 -23
  47. package/dist/lib/agents/codex.d.ts.map +0 -1
  48. package/dist/lib/agents/codex.js +0 -364
  49. package/dist/lib/agents/codex.js.map +0 -1
  50. package/dist/lib/agents/cursor.d.ts +0 -10
  51. package/dist/lib/agents/cursor.d.ts.map +0 -1
  52. package/dist/lib/agents/cursor.js +0 -207
  53. package/dist/lib/agents/cursor.js.map +0 -1
  54. package/dist/lib/agents/gemini.d.ts +0 -10
  55. package/dist/lib/agents/gemini.d.ts.map +0 -1
  56. package/dist/lib/agents/gemini.js +0 -208
  57. package/dist/lib/agents/gemini.js.map +0 -1
  58. package/dist/lib/agents/opencode.d.ts +0 -46
  59. package/dist/lib/agents/opencode.d.ts.map +0 -1
  60. package/dist/lib/agents/opencode.js +0 -365
  61. package/dist/lib/agents/opencode.js.map +0 -1
@@ -1,364 +0,0 @@
1
- /**
2
- * OpenAI Codex 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, OPENAI_DIRECT, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, } from './shared.js';
7
- /**
8
- * Parse model string with optional query parameters.
9
- * e.g. "gpt-5.2-codex?reasoningEffort=high" → { model: "gpt-5.2-codex", reasoningEffort: "high" }
10
- */
11
- function parseModelString(model) {
12
- const qIndex = model.indexOf('?');
13
- if (qIndex === -1)
14
- return { model };
15
- const base = model.slice(0, qIndex);
16
- const query = model.slice(qIndex + 1);
17
- let reasoningEffort;
18
- for (const pair of query.split('&')) {
19
- const eqIndex = pair.indexOf('=');
20
- if (eqIndex === -1)
21
- continue;
22
- const key = pair.slice(0, eqIndex);
23
- const value = decodeURIComponent(pair.slice(eqIndex + 1));
24
- if (key === 'reasoningEffort') {
25
- reasoningEffort = value;
26
- }
27
- }
28
- return { model: base, reasoningEffort };
29
- }
30
- /**
31
- * Extract transcript from Codex JSON output.
32
- * When run with --json, Codex outputs JSONL to stdout with the full transcript.
33
- */
34
- function extractTranscriptFromOutput(output) {
35
- if (!output || !output.trim()) {
36
- return undefined;
37
- }
38
- // The --json output is already the transcript in JSONL format
39
- // Filter to only include lines that look like JSON objects
40
- const lines = output.split('\n').filter(line => {
41
- const trimmed = line.trim();
42
- return trimmed.startsWith('{') && trimmed.endsWith('}');
43
- });
44
- if (lines.length === 0) {
45
- return undefined;
46
- }
47
- return lines.join('\n');
48
- }
49
- export function extractCodexThreadId(output) {
50
- for (const line of output.split('\n')) {
51
- if (!line.trim())
52
- continue;
53
- try {
54
- const event = JSON.parse(line);
55
- if (event.type === 'thread.started' && typeof event.thread_id === 'string') {
56
- return event.thread_id;
57
- }
58
- }
59
- catch {
60
- // Ignore non-JSON output lines.
61
- }
62
- }
63
- return undefined;
64
- }
65
- export function extractObservedModelFromCodexSession(transcript) {
66
- if (!transcript)
67
- return undefined;
68
- let observedModel;
69
- for (const line of transcript.split('\n')) {
70
- if (!line.trim())
71
- continue;
72
- try {
73
- const event = JSON.parse(line);
74
- const model = event.payload?.model ?? event.payload?.collaboration_mode?.settings?.model;
75
- if (event.type === 'turn_context' && typeof model === 'string') {
76
- observedModel = model;
77
- }
78
- }
79
- catch {
80
- // Ignore non-JSON transcript lines.
81
- }
82
- }
83
- return observedModel;
84
- }
85
- async function captureCodexSessionTranscript(sandbox, threadId) {
86
- try {
87
- const escapedThreadId = threadId?.replace(/'/g, "'\\''");
88
- const command = escapedThreadId
89
- ? `find ~/.codex/sessions -type f -name '*${escapedThreadId}*.jsonl' -print 2>/dev/null | head -1`
90
- : `find ~/.codex/sessions -type f -name '*.jsonl' -print 2>/dev/null | sort | tail -1`;
91
- const findResult = await sandbox.runShell(command);
92
- if (findResult.exitCode !== 0 || !findResult.stdout.trim()) {
93
- return undefined;
94
- }
95
- return await sandbox.readFile(findResult.stdout.trim());
96
- }
97
- catch {
98
- return undefined;
99
- }
100
- }
101
- /**
102
- * Default reasoning effort and verbosity baked into the generated Codex
103
- * profile.
104
- *
105
- * The Codex CLI itself defaults both `model_reasoning_effort` and
106
- * `model_verbosity` to `"low"`, but the default Codex model
107
- * (`gpt-5.2-codex`) only accepts `"medium"` for both — so an out-of-the-box
108
- * `codex exec` against the AI Gateway fails with:
109
- * "Unsupported value: 'low' is not supported with the 'gpt-5.2-codex'
110
- * model. Supported values are: 'medium'."
111
- * (the error covers both the `reasoning.effort` and `text.verbosity` request
112
- * parameters, depending on which the model rejected first).
113
- *
114
- * `"medium"` is also a valid value for the non-codex GPT-5.x models, so it's
115
- * a safe default. Callers can override reasoning effort per-run via
116
- * `model: "gpt-5.2-codex?reasoningEffort=high"`.
117
- */
118
- const DEFAULT_REASONING_EFFORT = 'medium';
119
- const DEFAULT_MODEL_VERBOSITY = 'medium';
120
- /**
121
- * Generate Codex profile config content.
122
- *
123
- * `reasoningEffort` and `model_verbosity` are written into the profile so a
124
- * fresh `codex exec` doesn't pick up the CLI defaults of `"low"`, which are
125
- * rejected by `gpt-5.2-codex`. Defaults to `"medium"` when `reasoningEffort`
126
- * is omitted.
127
- */
128
- export function generateCodexConfig(model, useVercelAiGateway, reasoningEffort, webResearch) {
129
- // Opt-in web research. Note: through the AI Gateway (`wire_api =
130
- // "responses"`), no `web_search` items have been observed — Codex instead
131
- // researches via shell commands when it decides to. The setting is still
132
- // written so direct-OpenAI runs and future gateway support pick it up; it
133
- // is harmless when the server-side tool is unavailable.
134
- const toolsSection = webResearch ? `\n[tools]\nweb_search = true\n` : '';
135
- if (useVercelAiGateway) {
136
- // AI Gateway uses prefixed model names like "openai/gpt-5.2-codex".
137
- // Native-default runs intentionally omit model and reasoning overrides.
138
- const fullModel = model ? (model.includes('/') ? model : `openai/${model}`) : undefined;
139
- return `# Codex configuration for Vercel AI Gateway
140
- model_provider = "vercel"
141
- ${fullModel ? `model = "${fullModel}"\n` : ''}${model ? `model_reasoning_effort = "${reasoningEffort ?? DEFAULT_REASONING_EFFORT}"\nmodel_verbosity = "${DEFAULT_MODEL_VERBOSITY}"\n` : ''}
142
- [model_providers.vercel]
143
- name = "Vercel AI Gateway"
144
- base_url = "${AI_GATEWAY.openAiBaseUrl}"
145
- env_key = "${AI_GATEWAY.apiKeyEnvVar}"
146
- wire_api = "responses"
147
- ${toolsSection}`;
148
- }
149
- else {
150
- // Direct OpenAI API — use the built-in "openai" provider (no custom provider needed).
151
- // Native-default runs intentionally omit model and reasoning overrides.
152
- const directModel = model ? (model.includes('/') ? model.split('/').pop() : model) : undefined;
153
- return `# Direct OpenAI API configuration
154
- model_provider = "openai"
155
- ${directModel ? `model = "${directModel}"\n` : ''}${model ? `model_reasoning_effort = "${reasoningEffort ?? DEFAULT_REASONING_EFFORT}"\nmodel_verbosity = "${DEFAULT_MODEL_VERBOSITY}"\n` : ''}${toolsSection}`;
156
- }
157
- }
158
- /**
159
- * Create Codex agent with specified authentication method.
160
- */
161
- export function createCodexAgent({ useVercelAiGateway }) {
162
- return {
163
- name: useVercelAiGateway ? 'vercel-ai-gateway/codex' : 'codex',
164
- displayName: useVercelAiGateway ? 'OpenAI Codex (Vercel AI Gateway)' : 'OpenAI Codex',
165
- getApiKeyEnvVar() {
166
- return useVercelAiGateway ? AI_GATEWAY.apiKeyEnvVar : OPENAI_DIRECT.apiKeyEnvVar;
167
- },
168
- getDefaultModel() {
169
- return 'openai/gpt-5.2-codex';
170
- },
171
- async run(fixturePath, options) {
172
- const startTime = Date.now();
173
- let sandbox = null;
174
- let agentOutput = '';
175
- let transcript;
176
- let aborted = false;
177
- let sandboxStopped = false;
178
- // Handle abort signal
179
- const abortHandler = () => {
180
- aborted = true;
181
- if (sandbox && !sandboxStopped) {
182
- sandboxStopped = true;
183
- sandbox.stop().catch(() => { });
184
- }
185
- };
186
- if (options.signal) {
187
- if (options.signal.aborted) {
188
- return {
189
- success: false,
190
- output: '',
191
- error: 'Aborted before start',
192
- duration: 0,
193
- };
194
- }
195
- options.signal.addEventListener('abort', abortHandler);
196
- }
197
- try {
198
- // Collect files from fixture
199
- const allFiles = await collectLocalFiles(fixturePath);
200
- const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
201
- // Check for abort before expensive operations
202
- if (aborted) {
203
- return {
204
- success: false,
205
- output: '',
206
- error: 'Aborted',
207
- duration: Date.now() - startTime,
208
- };
209
- }
210
- // Create sandbox
211
- sandbox = await createSandbox({
212
- timeout: options.timeout,
213
- runtime: 'node24',
214
- backend: options.sandbox,
215
- });
216
- // Check for abort after sandbox creation (abort may have fired during create)
217
- if (aborted) {
218
- return {
219
- success: false,
220
- output: '',
221
- error: 'Aborted',
222
- duration: Date.now() - startTime,
223
- sandboxId: sandbox.sandboxId,
224
- };
225
- }
226
- // Upload workspace files (excluding tests)
227
- await sandbox.uploadFiles(workspaceFiles);
228
- await initGitAndCommit(sandbox);
229
- // Run setup function if provided
230
- if (options.setup) {
231
- await options.setup(sandbox);
232
- }
233
- const neutralWorkspace = await prepareNeutralWorkspace(sandbox);
234
- // Install dependencies
235
- let installResult = await sandbox.runCommand('npm', ['install']);
236
- if (installResult.exitCode !== 0) {
237
- installResult = await sandbox.runCommand('npm', ['install']);
238
- }
239
- if (installResult.exitCode !== 0) {
240
- const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
241
- throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
242
- }
243
- // Install Codex CLI globally
244
- const cliInstall = await sandbox.runCommand('npm', [
245
- 'install',
246
- '-g',
247
- '@openai/codex',
248
- ]);
249
- if (cliInstall.exitCode !== 0) {
250
- throw new Error(`Codex CLI install failed: ${cliInstall.stderr}`);
251
- }
252
- // Parse model string for query parameters (e.g. "gpt-5.2-codex?reasoningEffort=high").
253
- // Native-default runs intentionally leave the model undefined.
254
- const parsedModel = options.model ? parseModelString(options.model) : { model: undefined, reasoningEffort: undefined };
255
- const { model: baseModel, reasoningEffort } = parsedModel;
256
- // Create Codex profile config. Recent Codex CLI versions reject the old
257
- // top-level `profile = "default"` key in config.toml and instead load
258
- // `$CODEX_HOME/<profile>.config.toml` when `--profile <profile>` is set.
259
- // For explicit models, reasoning_effort is baked into the profile (rather
260
- // than passed via -c at runtime) so the value is visible in saved configs
261
- // and so the CLI's own default of "low" can't sneak through. For
262
- // native-default runs we omit these settings to match the CLI's behavior.
263
- await sandbox.runShell('mkdir -p ~/.codex');
264
- const configContent = generateCodexConfig(baseModel, useVercelAiGateway, reasoningEffort, options.webResearch);
265
- await sandbox.runShell(`cat > ~/.codex/default.config.toml << 'EOF'
266
- ${configContent}
267
- EOF`);
268
- // Verify no test files in sandbox
269
- await verifyNoTestFiles(sandbox);
270
- // Build Codex CLI command
271
- const envVarToSet = useVercelAiGateway ? AI_GATEWAY.apiKeyEnvVar : OPENAI_DIRECT.apiKeyEnvVar;
272
- const escapedPrompt = options.prompt.replace(/'/g, "'\\''");
273
- // Direct OpenAI API needs unprefixed model names (e.g. "gpt-5.2-codex" not "openai/gpt-5.2-codex")
274
- const cliModel = baseModel
275
- ? (useVercelAiGateway ? baseModel : (baseModel.includes('/') ? baseModel.split('/').pop() : baseModel))
276
- : undefined;
277
- const modelFlag = cliModel ? ` --model ${cliModel}` : '';
278
- // Pass reasoning effort and verbosity via -c too; CLI flags have the
279
- // highest precedence and we've observed Codex CLI silently falling back
280
- // to its "low" defaults for both fields even when the profile sets them.
281
- // Both default to "medium" for compatibility with gpt-5.2-codex.
282
- const effectiveReasoningEffort = baseModel ? (reasoningEffort ?? DEFAULT_REASONING_EFFORT) : undefined;
283
- const reasoningFlag = effectiveReasoningEffort ? ` -c model_reasoning_effort="${effectiveReasoningEffort}"` : '';
284
- const verbosityFlag = baseModel ? ` -c model_verbosity="${DEFAULT_MODEL_VERBOSITY}"` : '';
285
- // codex login sets up bearer auth for the CLI; the built-in openai provider requires it
286
- const codexResult = await sandbox.runShell(`echo '${options.apiKey}' | codex login --with-api-key && codex exec --profile default${modelFlag} --dangerously-bypass-approvals-and-sandbox --json --skip-git-repo-check${reasoningFlag}${verbosityFlag} '${escapedPrompt}'`, { [envVarToSet]: options.apiKey, ...neutralWorkspace.env });
287
- agentOutput = codexResult.stdout + codexResult.stderr;
288
- transcript = extractTranscriptFromOutput(agentOutput);
289
- const threadId = extractCodexThreadId(agentOutput);
290
- const sessionTranscript = await captureCodexSessionTranscript(sandbox, threadId);
291
- const observedModel = extractObservedModelFromCodexSession(sessionTranscript);
292
- if (codexResult.exitCode !== 0) {
293
- // Extract meaningful error from output (last few lines usually contain the error)
294
- const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
295
- return {
296
- success: false,
297
- output: agentOutput,
298
- transcript,
299
- error: errorLines || `Codex CLI exited with code ${codexResult.exitCode}`,
300
- duration: Date.now() - startTime,
301
- sandboxId: sandbox.sandboxId,
302
- observedModel,
303
- };
304
- }
305
- if (options.validation !== 'none') {
306
- // Upload test files for validation
307
- await sandbox.uploadFiles(testFiles);
308
- // Create vitest config for EVAL.ts/tsx
309
- await createVitestConfig(sandbox);
310
- // Inject transcript context so EVAL.ts tests can assert on agent behavior
311
- await injectTranscriptContext(sandbox, transcript, 'codex', options.model);
312
- }
313
- // Run validation scripts
314
- const validationResults = await runValidation(sandbox, options.scripts ?? [], options.validation);
315
- // Capture generated files
316
- const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
317
- return {
318
- success: validationResults.allPassed,
319
- output: agentOutput,
320
- transcript,
321
- duration: Date.now() - startTime,
322
- testResult: validationResults.test,
323
- scriptsResults: validationResults.scripts,
324
- sandboxId: sandbox.sandboxId,
325
- generatedFiles,
326
- deletedFiles,
327
- observedModel,
328
- };
329
- }
330
- catch (error) {
331
- // Check if this was an abort
332
- if (aborted) {
333
- return {
334
- success: false,
335
- output: agentOutput,
336
- transcript,
337
- error: 'Aborted',
338
- duration: Date.now() - startTime,
339
- sandboxId: sandbox?.sandboxId,
340
- };
341
- }
342
- return {
343
- success: false,
344
- output: agentOutput,
345
- transcript,
346
- error: error instanceof Error ? error.message : String(error),
347
- duration: Date.now() - startTime,
348
- sandboxId: sandbox?.sandboxId,
349
- };
350
- }
351
- finally {
352
- // Clean up abort listener
353
- if (options.signal) {
354
- options.signal.removeEventListener('abort', abortHandler);
355
- }
356
- if (sandbox && !sandboxStopped) {
357
- sandboxStopped = true;
358
- await sandbox.stop();
359
- }
360
- }
361
- },
362
- };
363
- }
364
- //# sourceMappingURL=codex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/lib/agents/codex.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,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAKrB;;;GAGG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,C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YAAY,CAAC,CAAC;gBAC5D,CAAC;gBACD,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC/B,cAAc,GAAG,IAAI,CAAC;oBACtB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACF,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Cursor CLI agent implementation.
3
- * Uses direct Cursor API access.
4
- */
5
- import type { Agent } from './types.js';
6
- /**
7
- * Create Cursor CLI agent with direct API authentication.
8
- */
9
- export declare function createCursorAgent(): Agent;
10
- //# sourceMappingURL=cursor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/cursor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,YAAY,CAAC;AA8CzE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,KAAK,CAiNzC"}
@@ -1,207 +0,0 @@
1
- /**
2
- * Cursor CLI agent implementation.
3
- * Uses direct Cursor API access.
4
- */
5
- import { createSandbox, collectLocalFiles, splitTestFiles, verifyNoTestFiles, } from '../sandbox.js';
6
- import { runValidation, captureGeneratedFiles, createVitestConfig, CURSOR_DIRECT, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, } from './shared.js';
7
- /**
8
- * Extract transcript from Cursor CLI stream-json output.
9
- * When run with --output-format stream-json, Cursor 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 Cursor CLI agent with direct API authentication.
28
- */
29
- export function createCursorAgent() {
30
- return {
31
- name: 'cursor',
32
- displayName: 'Cursor CLI',
33
- getApiKeyEnvVar() {
34
- return CURSOR_DIRECT.apiKeyEnvVar;
35
- },
36
- getDefaultModel() {
37
- return 'composer-1.5';
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 Cursor CLI globally using official installation script
112
- const cliInstall = await sandbox.runShell('curl https://cursor.com/install -fsSL | bash');
113
- if (cliInstall.exitCode !== 0) {
114
- throw new Error(`Cursor CLI install failed: ${cliInstall.stderr}`);
115
- }
116
- // Verify no test files in sandbox
117
- await verifyNoTestFiles(sandbox);
118
- // Run Cursor CLI with direct API access
119
- // --print: non-interactive mode (required for scripts/headless)
120
- // --force: auto-approve all tool operations
121
- // --output-format stream-json: structured JSONL transcript (only works with --print)
122
- const cursorArgs = [
123
- options.prompt,
124
- '--print',
125
- '--force',
126
- ];
127
- if (options.model) {
128
- cursorArgs.push('--model', options.model);
129
- }
130
- cursorArgs.push('--output-format', 'stream-json');
131
- const cursorResult = await sandbox.runCommand('agent', cursorArgs, {
132
- env: {
133
- [CURSOR_DIRECT.apiKeyEnvVar]: options.apiKey,
134
- ...neutralWorkspace.env,
135
- },
136
- });
137
- agentOutput = cursorResult.stdout + cursorResult.stderr;
138
- transcript = extractTranscriptFromOutput(agentOutput);
139
- if (cursorResult.exitCode !== 0) {
140
- // Extract meaningful error from output (last few lines usually contain the error)
141
- const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
142
- return {
143
- success: false,
144
- output: agentOutput,
145
- transcript,
146
- error: errorLines || `Cursor CLI exited with code ${cursorResult.exitCode}`,
147
- duration: Date.now() - startTime,
148
- sandboxId: sandbox.sandboxId,
149
- };
150
- }
151
- // Upload test files for validation
152
- await sandbox.uploadFiles(testFiles);
153
- // Create vitest config for EVAL.ts/tsx
154
- await createVitestConfig(sandbox);
155
- // Inject transcript context so EVAL.ts tests can assert on agent behavior
156
- await injectTranscriptContext(sandbox, transcript, 'cursor', options.model);
157
- // Run validation scripts
158
- const validationResults = await runValidation(sandbox, options.scripts ?? []);
159
- // Capture generated files
160
- const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
161
- return {
162
- success: validationResults.allPassed,
163
- output: agentOutput,
164
- transcript,
165
- duration: Date.now() - startTime,
166
- testResult: validationResults.test,
167
- scriptsResults: validationResults.scripts,
168
- sandboxId: sandbox.sandboxId,
169
- generatedFiles,
170
- deletedFiles,
171
- };
172
- }
173
- catch (error) {
174
- // Check if this was an abort
175
- if (aborted) {
176
- return {
177
- success: false,
178
- output: agentOutput,
179
- transcript,
180
- error: 'Aborted',
181
- duration: Date.now() - startTime,
182
- sandboxId: sandbox?.sandboxId,
183
- };
184
- }
185
- return {
186
- success: false,
187
- output: agentOutput,
188
- transcript,
189
- error: error instanceof Error ? error.message : String(error),
190
- duration: Date.now() - startTime,
191
- sandboxId: sandbox?.sandboxId,
192
- };
193
- }
194
- finally {
195
- // Clean up abort listener
196
- if (options.signal) {
197
- options.signal.removeEventListener('abort', abortHandler);
198
- }
199
- if (sandbox && !sandboxStopped) {
200
- sandboxStopped = true;
201
- await sandbox.stop();
202
- }
203
- }
204
- },
205
- };
206
- }
207
- //# sourceMappingURL=cursor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/lib/agents/cursor.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,2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ACT,0BAA0B;gBAC1B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;gBAC5D,CAAC;gBACD,IAAI,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC/B,cAAc,GAAG,IAAI,CAAC;oBACtB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Gemini CLI agent implementation.
3
- * Uses direct Google Gemini API access.
4
- */
5
- import type { Agent } from './types.js';
6
- /**
7
- * Create Gemini CLI agent with direct API authentication.
8
- */
9
- export declare function createGeminiAgent(): Agent;
10
- //# sourceMappingURL=gemini.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/gemini.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,YAAY,CAAC;AA8CzE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,KAAK,CAkNzC"}