@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,300 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code 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, ANTHROPIC_DIRECT, initGitAndCommit, injectTranscriptContext, prepareNeutralWorkspace, } from './shared.js';
|
|
7
|
-
/**
|
|
8
|
-
* Capture the Claude Code transcript from the sandbox.
|
|
9
|
-
* Claude Code stores transcripts at ~/.claude/projects/-{workdir}/{session-id}.jsonl
|
|
10
|
-
*/
|
|
11
|
-
async function captureTranscript(sandbox) {
|
|
12
|
-
try {
|
|
13
|
-
// Get the working directory to construct the transcript path
|
|
14
|
-
const workdir = sandbox.getWorkingDirectory();
|
|
15
|
-
// Claude Code uses the path with slashes replaced by dashes
|
|
16
|
-
const projectPath = workdir.replace(/\//g, '-');
|
|
17
|
-
const claudeProjectDir = `~/.claude/projects/${projectPath}`;
|
|
18
|
-
// Find the most recent .jsonl file (the transcript)
|
|
19
|
-
const findResult = await sandbox.runShell(`ls -t ${claudeProjectDir}/*.jsonl 2>/dev/null | head -1`);
|
|
20
|
-
if (findResult.exitCode !== 0 || !findResult.stdout.trim()) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
const transcriptPath = findResult.stdout.trim();
|
|
24
|
-
const content = await sandbox.readFile(transcriptPath);
|
|
25
|
-
return content || undefined;
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// Transcript capture is best-effort
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function extractObservedModelFromClaudeTranscript(transcript) {
|
|
33
|
-
if (!transcript)
|
|
34
|
-
return undefined;
|
|
35
|
-
let observedModel;
|
|
36
|
-
for (const line of transcript.split('\n')) {
|
|
37
|
-
if (!line.trim())
|
|
38
|
-
continue;
|
|
39
|
-
try {
|
|
40
|
-
const event = JSON.parse(line);
|
|
41
|
-
if (typeof event.message?.model === 'string') {
|
|
42
|
-
observedModel = event.message.model;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Ignore non-JSON transcript lines.
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return observedModel;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Build the Claude Code CLI argument list.
|
|
53
|
-
*
|
|
54
|
-
* Exported for tests because the argument order is regression-sensitive:
|
|
55
|
-
* `--allowedTools` is variadic, so its tools MUST be passed as a single
|
|
56
|
-
* comma-separated value. Passing them as separate tokens makes the CLI
|
|
57
|
-
* consume the trailing positional prompt as another tool name, which broke
|
|
58
|
-
* every run when #141 used the space-separated form.
|
|
59
|
-
*/
|
|
60
|
-
export function buildClaudeCodeCliArgs(options) {
|
|
61
|
-
const cliArgs = ['--print'];
|
|
62
|
-
if (options.model) {
|
|
63
|
-
cliArgs.push('--model', options.model);
|
|
64
|
-
}
|
|
65
|
-
cliArgs.push('--dangerously-skip-permissions');
|
|
66
|
-
const effort = options.agentOptions?.effort;
|
|
67
|
-
if (effort) {
|
|
68
|
-
cliArgs.push('--effort', effort);
|
|
69
|
-
}
|
|
70
|
-
if (options.webResearch) {
|
|
71
|
-
cliArgs.push('--allowedTools', 'WebSearch,WebFetch');
|
|
72
|
-
}
|
|
73
|
-
cliArgs.push(options.prompt);
|
|
74
|
-
return cliArgs;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Create Claude Code agent with specified authentication method.
|
|
78
|
-
*/
|
|
79
|
-
export function createClaudeCodeAgent({ useVercelAiGateway }) {
|
|
80
|
-
return {
|
|
81
|
-
name: useVercelAiGateway ? 'vercel-ai-gateway/claude-code' : 'claude-code',
|
|
82
|
-
displayName: useVercelAiGateway ? 'Claude Code (Vercel AI Gateway)' : 'Claude Code',
|
|
83
|
-
getApiKeyEnvVar() {
|
|
84
|
-
if (useVercelAiGateway)
|
|
85
|
-
return AI_GATEWAY.apiKeyEnvVar;
|
|
86
|
-
if (process.env.CLAUDE_CODE_OAUTH_TOKEN)
|
|
87
|
-
return 'CLAUDE_CODE_OAUTH_TOKEN';
|
|
88
|
-
return ANTHROPIC_DIRECT.apiKeyEnvVar;
|
|
89
|
-
},
|
|
90
|
-
getDefaultModel() {
|
|
91
|
-
return 'opus';
|
|
92
|
-
},
|
|
93
|
-
async run(fixturePath, options) {
|
|
94
|
-
const startTime = Date.now();
|
|
95
|
-
let sandbox = null;
|
|
96
|
-
let agentOutput = '';
|
|
97
|
-
let transcript;
|
|
98
|
-
let aborted = false;
|
|
99
|
-
let sandboxStopped = false;
|
|
100
|
-
let hasReturned = false;
|
|
101
|
-
const captureTranscriptBestEffort = async () => {
|
|
102
|
-
if (!sandbox || sandboxStopped || transcript)
|
|
103
|
-
return;
|
|
104
|
-
transcript = await captureTranscript(sandbox);
|
|
105
|
-
};
|
|
106
|
-
// Handle abort signal
|
|
107
|
-
const abortHandler = () => {
|
|
108
|
-
aborted = true;
|
|
109
|
-
if (sandbox && !sandboxStopped) {
|
|
110
|
-
sandboxStopped = true;
|
|
111
|
-
sandbox.stop().catch(() => { });
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
if (options.signal) {
|
|
115
|
-
if (options.signal.aborted) {
|
|
116
|
-
hasReturned = true;
|
|
117
|
-
return {
|
|
118
|
-
success: false,
|
|
119
|
-
output: '',
|
|
120
|
-
error: 'Aborted before start',
|
|
121
|
-
duration: 0,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
options.signal.addEventListener('abort', abortHandler);
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
// Collect files from fixture
|
|
128
|
-
const allFiles = await collectLocalFiles(fixturePath);
|
|
129
|
-
const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
|
|
130
|
-
// Check for abort before expensive operations
|
|
131
|
-
if (aborted) {
|
|
132
|
-
hasReturned = true;
|
|
133
|
-
return {
|
|
134
|
-
success: false,
|
|
135
|
-
output: '',
|
|
136
|
-
error: 'Aborted',
|
|
137
|
-
duration: Date.now() - startTime,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
// Create sandbox
|
|
141
|
-
sandbox = await createSandbox({
|
|
142
|
-
timeout: options.timeout,
|
|
143
|
-
runtime: 'node24',
|
|
144
|
-
backend: options.sandbox,
|
|
145
|
-
});
|
|
146
|
-
// Check for abort after sandbox creation (abort may have fired during create)
|
|
147
|
-
if (aborted) {
|
|
148
|
-
hasReturned = true;
|
|
149
|
-
return {
|
|
150
|
-
success: false,
|
|
151
|
-
output: '',
|
|
152
|
-
error: 'Aborted',
|
|
153
|
-
duration: Date.now() - startTime,
|
|
154
|
-
sandboxId: sandbox.sandboxId,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
// Upload workspace files (excluding tests)
|
|
158
|
-
await sandbox.uploadFiles(workspaceFiles);
|
|
159
|
-
await initGitAndCommit(sandbox);
|
|
160
|
-
// Run setup function if provided
|
|
161
|
-
if (options.setup) {
|
|
162
|
-
await options.setup(sandbox);
|
|
163
|
-
}
|
|
164
|
-
const neutralWorkspace = await prepareNeutralWorkspace(sandbox);
|
|
165
|
-
// Install dependencies
|
|
166
|
-
let installResult = await sandbox.runCommand('npm', ['install']);
|
|
167
|
-
if (installResult.exitCode !== 0) {
|
|
168
|
-
installResult = await sandbox.runCommand('npm', ['install']);
|
|
169
|
-
}
|
|
170
|
-
if (installResult.exitCode !== 0) {
|
|
171
|
-
const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
|
|
172
|
-
throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
|
|
173
|
-
}
|
|
174
|
-
// Install Claude Code CLI globally
|
|
175
|
-
const cliPackage = options.agentOptions?.cliPackage || '@anthropic-ai/claude-code';
|
|
176
|
-
const cliInstall = await sandbox.runCommand('npm', [
|
|
177
|
-
'install',
|
|
178
|
-
'-g',
|
|
179
|
-
cliPackage,
|
|
180
|
-
]);
|
|
181
|
-
if (cliInstall.exitCode !== 0) {
|
|
182
|
-
throw new Error(`Claude Code install failed: ${cliInstall.stderr}`);
|
|
183
|
-
}
|
|
184
|
-
// Verify no test files in sandbox
|
|
185
|
-
await verifyNoTestFiles(sandbox);
|
|
186
|
-
// Build sandbox environment based on authentication method.
|
|
187
|
-
// Note: options.apiKey is always resolved from process.env[getApiKeyEnvVar()]
|
|
188
|
-
// by the CLI (cli.ts), so the env-var check here is consistent with getApiKeyEnvVar().
|
|
189
|
-
let claudeEnv;
|
|
190
|
-
if (useVercelAiGateway) {
|
|
191
|
-
claudeEnv = {
|
|
192
|
-
ANTHROPIC_BASE_URL: AI_GATEWAY.baseUrl,
|
|
193
|
-
ANTHROPIC_AUTH_TOKEN: options.apiKey,
|
|
194
|
-
ANTHROPIC_API_KEY: '',
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
else if (process.env.CLAUDE_CODE_OAUTH_TOKEN) {
|
|
198
|
-
claudeEnv = {
|
|
199
|
-
CLAUDE_CODE_OAUTH_TOKEN: options.apiKey,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
claudeEnv = {
|
|
204
|
-
ANTHROPIC_API_KEY: options.apiKey,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
// Build CLI arguments
|
|
208
|
-
const cliArgs = buildClaudeCodeCliArgs(options);
|
|
209
|
-
// Run Claude Code with appropriate authentication
|
|
210
|
-
const claudeResult = await sandbox.runCommand('claude', cliArgs, {
|
|
211
|
-
env: { ...claudeEnv, ...neutralWorkspace.env },
|
|
212
|
-
});
|
|
213
|
-
agentOutput = claudeResult.stdout + claudeResult.stderr;
|
|
214
|
-
if (claudeResult.exitCode !== 0) {
|
|
215
|
-
await captureTranscriptBestEffort();
|
|
216
|
-
const observedModel = extractObservedModelFromClaudeTranscript(transcript);
|
|
217
|
-
// Extract meaningful error from output (last few lines usually contain the error)
|
|
218
|
-
const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
|
|
219
|
-
hasReturned = true;
|
|
220
|
-
return {
|
|
221
|
-
success: false,
|
|
222
|
-
output: agentOutput,
|
|
223
|
-
transcript,
|
|
224
|
-
error: errorLines || `Claude Code exited with code ${claudeResult.exitCode}`,
|
|
225
|
-
duration: Date.now() - startTime,
|
|
226
|
-
sandboxId: sandbox.sandboxId,
|
|
227
|
-
observedModel,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
// Capture transcript before validation when available
|
|
231
|
-
await captureTranscriptBestEffort();
|
|
232
|
-
const observedModel = extractObservedModelFromClaudeTranscript(transcript);
|
|
233
|
-
if (options.validation !== 'none') {
|
|
234
|
-
// Upload test files for validation
|
|
235
|
-
await sandbox.uploadFiles(testFiles);
|
|
236
|
-
// Create vitest config for EVAL.ts/tsx
|
|
237
|
-
await createVitestConfig(sandbox);
|
|
238
|
-
// Inject transcript context so EVAL.ts tests can assert on agent behavior
|
|
239
|
-
await injectTranscriptContext(sandbox, transcript, 'claude-code', options.model);
|
|
240
|
-
}
|
|
241
|
-
// Run validation scripts
|
|
242
|
-
const validationResults = await runValidation(sandbox, options.scripts ?? [], options.validation);
|
|
243
|
-
// Capture generated files
|
|
244
|
-
const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
|
|
245
|
-
hasReturned = true;
|
|
246
|
-
return {
|
|
247
|
-
success: validationResults.allPassed,
|
|
248
|
-
output: agentOutput,
|
|
249
|
-
transcript,
|
|
250
|
-
duration: Date.now() - startTime,
|
|
251
|
-
testResult: validationResults.test,
|
|
252
|
-
scriptsResults: validationResults.scripts,
|
|
253
|
-
sandboxId: sandbox.sandboxId,
|
|
254
|
-
generatedFiles,
|
|
255
|
-
deletedFiles,
|
|
256
|
-
observedModel,
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
catch (error) {
|
|
260
|
-
await captureTranscriptBestEffort();
|
|
261
|
-
// Check if this was an abort
|
|
262
|
-
if (aborted) {
|
|
263
|
-
hasReturned = true;
|
|
264
|
-
return {
|
|
265
|
-
success: false,
|
|
266
|
-
output: agentOutput,
|
|
267
|
-
transcript,
|
|
268
|
-
error: 'Aborted',
|
|
269
|
-
duration: Date.now() - startTime,
|
|
270
|
-
sandboxId: sandbox?.sandboxId,
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
hasReturned = true;
|
|
274
|
-
return {
|
|
275
|
-
success: false,
|
|
276
|
-
output: agentOutput,
|
|
277
|
-
transcript,
|
|
278
|
-
error: error instanceof Error ? error.message : String(error),
|
|
279
|
-
duration: Date.now() - startTime,
|
|
280
|
-
sandboxId: sandbox?.sandboxId,
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
finally {
|
|
284
|
-
// If we're about to return and sandbox is still up, try one final transcript capture.
|
|
285
|
-
if (hasReturned) {
|
|
286
|
-
await captureTranscriptBestEffort();
|
|
287
|
-
}
|
|
288
|
-
// Clean up abort listener
|
|
289
|
-
if (options.signal) {
|
|
290
|
-
options.signal.removeEventListener('abort', abortHandler);
|
|
291
|
-
}
|
|
292
|
-
if (sandbox && !sandboxStopped) {
|
|
293
|
-
sandboxStopped = true;
|
|
294
|
-
await sandbox.stop();
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
//# sourceMappingURL=claude-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/lib/agents/claude-code.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,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAKrB;;;GAGG;AACH,KAAK,UAAU,iBAAiB,CAAC,OAAmB;IAClD,IAAI,CAAC;QACH,6DAA6D;QAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAC9C,4DAA4D;QAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChD,MAAM,gBAAgB,GAAG,sBAAsB,WAAW,EAAE,CAAC;QAE7D,oDAAoD;QACpD,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,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E,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;oBAChC,SAAS,EAAE,OAAO,EAAE,SAAS;iBAC9B,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,sFAAsF;gBACtF,IAAI,WAAW,EAAE,CAAC;oBAChB,MAAM,2BAA2B,EAAE,CAAC;gBACtC,CAAC;gBACD,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;AACF,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI Codex CLI agent implementation.
|
|
3
|
-
* Uses Vercel AI Gateway for model access.
|
|
4
|
-
*/
|
|
5
|
-
import type { Agent } from './types.js';
|
|
6
|
-
export declare function extractCodexThreadId(output: string): string | undefined;
|
|
7
|
-
export declare function extractObservedModelFromCodexSession(transcript: string | undefined): string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Generate Codex profile config content.
|
|
10
|
-
*
|
|
11
|
-
* `reasoningEffort` and `model_verbosity` are written into the profile so a
|
|
12
|
-
* fresh `codex exec` doesn't pick up the CLI defaults of `"low"`, which are
|
|
13
|
-
* rejected by `gpt-5.2-codex`. Defaults to `"medium"` when `reasoningEffort`
|
|
14
|
-
* is omitted.
|
|
15
|
-
*/
|
|
16
|
-
export declare function generateCodexConfig(model: string | undefined, useVercelAiGateway: boolean, reasoningEffort?: string, webResearch?: boolean): string;
|
|
17
|
-
/**
|
|
18
|
-
* Create Codex agent with specified authentication method.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createCodexAgent({ useVercelAiGateway }: {
|
|
21
|
-
useVercelAiGateway: boolean;
|
|
22
|
-
}): Agent;
|
|
23
|
-
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/codex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,YAAY,CAAC;AAwEzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcvE;AAED,wBAAgB,oCAAoC,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAqBvG;AAuCD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,EACxB,WAAW,CAAC,EAAE,OAAO,GACpB,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,EAAE;IAAE,kBAAkB,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAqO/F"}
|