agent-eval-opencode 0.10.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/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +590 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -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 +231 -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 +267 -0
- package/dist/lib/agents/codex.js.map +1 -0
- package/dist/lib/agents/cursor.d.ts +10 -0
- package/dist/lib/agents/cursor.d.ts.map +1 -0
- package/dist/lib/agents/cursor.js +204 -0
- package/dist/lib/agents/cursor.js.map +1 -0
- package/dist/lib/agents/gemini.d.ts +10 -0
- package/dist/lib/agents/gemini.d.ts.map +1 -0
- package/dist/lib/agents/gemini.js +207 -0
- package/dist/lib/agents/gemini.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 +20 -0
- package/dist/lib/agents/index.js.map +1 -0
- package/dist/lib/agents/opencode.d.ts +11 -0
- package/dist/lib/agents/opencode.d.ts.map +1 -0
- package/dist/lib/agents/opencode.js +245 -0
- package/dist/lib/agents/opencode.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 +83 -0
- package/dist/lib/agents/shared.d.ts.map +1 -0
- package/dist/lib/agents/shared.js +192 -0
- package/dist/lib/agents/shared.js.map +1 -0
- package/dist/lib/agents/types.d.ts +73 -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/classifier.d.ts +89 -0
- package/dist/lib/classifier.d.ts.map +1 -0
- package/dist/lib/classifier.js +285 -0
- package/dist/lib/classifier.js.map +1 -0
- package/dist/lib/config.d.ts +37 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +187 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/dashboard.d.ts +65 -0
- package/dist/lib/dashboard.d.ts.map +1 -0
- package/dist/lib/dashboard.js +237 -0
- package/dist/lib/dashboard.js.map +1 -0
- package/dist/lib/docker-sandbox.d.ts +92 -0
- package/dist/lib/docker-sandbox.d.ts.map +1 -0
- package/dist/lib/docker-sandbox.js +375 -0
- package/dist/lib/docker-sandbox.js.map +1 -0
- package/dist/lib/fingerprint.d.ts +15 -0
- package/dist/lib/fingerprint.d.ts.map +1 -0
- package/dist/lib/fingerprint.js +59 -0
- package/dist/lib/fingerprint.js.map +1 -0
- package/dist/lib/fixture.d.ts +55 -0
- package/dist/lib/fixture.d.ts.map +1 -0
- package/dist/lib/fixture.js +215 -0
- package/dist/lib/fixture.js.map +1 -0
- package/dist/lib/housekeeping.d.ts +26 -0
- package/dist/lib/housekeeping.d.ts.map +1 -0
- package/dist/lib/housekeeping.js +170 -0
- package/dist/lib/housekeeping.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 +275 -0
- package/dist/lib/init.js.map +1 -0
- package/dist/lib/o11y/index.d.ts +13 -0
- package/dist/lib/o11y/index.d.ts.map +1 -0
- package/dist/lib/o11y/index.js +13 -0
- package/dist/lib/o11y/index.js.map +1 -0
- package/dist/lib/o11y/parsers/claude-code.d.ts +18 -0
- package/dist/lib/o11y/parsers/claude-code.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/claude-code.js +343 -0
- package/dist/lib/o11y/parsers/claude-code.js.map +1 -0
- package/dist/lib/o11y/parsers/codex.d.ts +17 -0
- package/dist/lib/o11y/parsers/codex.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/codex.js +364 -0
- package/dist/lib/o11y/parsers/codex.js.map +1 -0
- package/dist/lib/o11y/parsers/cursor.d.ts +21 -0
- package/dist/lib/o11y/parsers/cursor.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/cursor.js +226 -0
- package/dist/lib/o11y/parsers/cursor.js.map +1 -0
- package/dist/lib/o11y/parsers/gemini.d.ts +21 -0
- package/dist/lib/o11y/parsers/gemini.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/gemini.js +241 -0
- package/dist/lib/o11y/parsers/gemini.js.map +1 -0
- package/dist/lib/o11y/parsers/index.d.ts +55 -0
- package/dist/lib/o11y/parsers/index.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/index.js +284 -0
- package/dist/lib/o11y/parsers/index.js.map +1 -0
- package/dist/lib/o11y/parsers/opencode.d.ts +17 -0
- package/dist/lib/o11y/parsers/opencode.d.ts.map +1 -0
- package/dist/lib/o11y/parsers/opencode.js +320 -0
- package/dist/lib/o11y/parsers/opencode.js.map +1 -0
- package/dist/lib/o11y/types.d.ts +113 -0
- package/dist/lib/o11y/types.d.ts.map +1 -0
- package/dist/lib/o11y/types.js +6 -0
- package/dist/lib/o11y/types.js.map +1 -0
- package/dist/lib/results.d.ts +91 -0
- package/dist/lib/results.d.ts.map +1 -0
- package/dist/lib/results.js +361 -0
- package/dist/lib/results.js.map +1 -0
- package/dist/lib/runner.d.ts +71 -0
- package/dist/lib/runner.d.ts.map +1 -0
- package/dist/lib/runner.js +267 -0
- package/dist/lib/runner.js.map +1 -0
- package/dist/lib/sandbox.d.ts +173 -0
- package/dist/lib/sandbox.d.ts.map +1 -0
- package/dist/lib/sandbox.js +337 -0
- package/dist/lib/sandbox.js.map +1 -0
- package/dist/lib/types.d.ts +258 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +15 -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 +72 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-eval
|
|
3
|
+
*
|
|
4
|
+
* Framework for testing AI coding agents in isolated sandboxes.
|
|
5
|
+
*/
|
|
6
|
+
export type { AgentType, ModelTier, EvalFilter, Sandbox, SetupFunction, ExperimentConfig, ResolvedExperimentConfig, EvalFixture, EvalRunResult, EvalRunData, EvalSummary, ProgressEvent, ExperimentResults, FailureType, Classification, } from './lib/types.js';
|
|
7
|
+
export { REQUIRED_EVAL_FILES, EXCLUDED_FILES } from './lib/types.js';
|
|
8
|
+
export { CONFIG_DEFAULTS, validateConfig, resolveConfig, loadConfig, resolveEvalNames, } from './lib/config.js';
|
|
9
|
+
export { FixtureValidationError, discoverFixtures, validateFixtureFiles, validatePackageJson, loadFixture, loadAllFixtures, getFixtureFiles, readFixtureFiles, } from './lib/fixture.js';
|
|
10
|
+
export type { SandboxOptions, CommandResult, SandboxFile, SandboxBackend, SandboxBackendInfo, } from './lib/sandbox.js';
|
|
11
|
+
export { SandboxManager, DEFAULT_SANDBOX_TIMEOUT, IGNORED_PATTERNS, TEST_FILE_PATTERNS, collectLocalFiles, splitTestFiles, verifyNoTestFiles, createSandbox, resolveBackend, getSandboxBackendInfo, } from './lib/sandbox.js';
|
|
12
|
+
export type { DockerSandboxOptions } from './lib/docker-sandbox.js';
|
|
13
|
+
export { DockerSandboxManager } from './lib/docker-sandbox.js';
|
|
14
|
+
export type { AgentRunOptions, AgentRunResult } from './lib/agents/types.js';
|
|
15
|
+
export { TRANSCRIPT_CONTEXT_DIR, TRANSCRIPT_CONTEXT_PATH } from './lib/agents/shared.js';
|
|
16
|
+
export type { Agent, ScriptResult } from './lib/agents/types.js';
|
|
17
|
+
export { getAgent, listAgents, registerAgent } from './lib/agents/index.js';
|
|
18
|
+
export type { SaveResultsOptions, ReusableResult } from './lib/results.js';
|
|
19
|
+
export { agentResultToEvalRunData, createEvalSummary, createExperimentResults, saveResults, formatResultsTable, formatRunResult, createProgressDisplay, scanReusableResults, } from './lib/results.js';
|
|
20
|
+
export { computeFingerprint } from './lib/fingerprint.js';
|
|
21
|
+
export { isClassifierEnabled, classifyFailure, classifyWithAI, isNonModelFailure, } from './lib/classifier.js';
|
|
22
|
+
export { housekeep } from './lib/housekeeping.js';
|
|
23
|
+
export type { RunExperimentOptions } from './lib/runner.js';
|
|
24
|
+
export { runExperiment, runSingleEval, StartRateLimiter } from './lib/runner.js';
|
|
25
|
+
export { Dashboard, createConsoleProgressHandler } from './lib/dashboard.js';
|
|
26
|
+
export type { InitOptions } from './lib/init.js';
|
|
27
|
+
export { initProject, getPostInitInstructions } from './lib/init.js';
|
|
28
|
+
export type { ToolName, TranscriptEvent, WebFetchInfo, FileOperationInfo, ShellCommandInfo, TranscriptSummary, Transcript, ParseableAgent, } from './lib/o11y/index.js';
|
|
29
|
+
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, } from './lib/o11y/index.js';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,cAAc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iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAG7E,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGrE,YAAY,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-eval
|
|
3
|
+
*
|
|
4
|
+
* Framework for testing AI coding agents in isolated sandboxes.
|
|
5
|
+
*/
|
|
6
|
+
// Re-export constants
|
|
7
|
+
export { REQUIRED_EVAL_FILES, EXCLUDED_FILES } from './lib/types.js';
|
|
8
|
+
// Re-export config utilities
|
|
9
|
+
export { CONFIG_DEFAULTS, validateConfig, resolveConfig, loadConfig, resolveEvalNames, } from './lib/config.js';
|
|
10
|
+
// Re-export fixture utilities
|
|
11
|
+
export { FixtureValidationError, discoverFixtures, validateFixtureFiles, validatePackageJson, loadFixture, loadAllFixtures, getFixtureFiles, readFixtureFiles, } from './lib/fixture.js';
|
|
12
|
+
export { SandboxManager, DEFAULT_SANDBOX_TIMEOUT, IGNORED_PATTERNS, TEST_FILE_PATTERNS, collectLocalFiles, splitTestFiles, verifyNoTestFiles, createSandbox, resolveBackend, getSandboxBackendInfo, } from './lib/sandbox.js';
|
|
13
|
+
export { DockerSandboxManager } from './lib/docker-sandbox.js';
|
|
14
|
+
// Re-export transcript context constants
|
|
15
|
+
export { TRANSCRIPT_CONTEXT_DIR, TRANSCRIPT_CONTEXT_PATH } from './lib/agents/shared.js';
|
|
16
|
+
export { getAgent, listAgents, registerAgent } from './lib/agents/index.js';
|
|
17
|
+
export { agentResultToEvalRunData, createEvalSummary, createExperimentResults, saveResults, formatResultsTable, formatRunResult, createProgressDisplay, scanReusableResults, } from './lib/results.js';
|
|
18
|
+
// Re-export fingerprinting
|
|
19
|
+
export { computeFingerprint } from './lib/fingerprint.js';
|
|
20
|
+
// Re-export classifier
|
|
21
|
+
export { isClassifierEnabled, classifyFailure, classifyWithAI, isNonModelFailure, } from './lib/classifier.js';
|
|
22
|
+
// Re-export housekeeping
|
|
23
|
+
export { housekeep } from './lib/housekeeping.js';
|
|
24
|
+
export { runExperiment, runSingleEval, StartRateLimiter } from './lib/runner.js';
|
|
25
|
+
// Re-export dashboard utilities
|
|
26
|
+
export { Dashboard, createConsoleProgressHandler } from './lib/dashboard.js';
|
|
27
|
+
export { initProject, getPostInitInstructions } from './lib/init.js';
|
|
28
|
+
export { parseTranscript, parseTranscriptSummary, loadTranscript, SUPPORTED_AGENTS, parseClaudeCodeTranscript, parseCodexTranscript, parseOpenCodeTranscript, } from './lib/o11y/index.js';
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErE,6BAA6B;AAC7B,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,GACjB,MAAM,iBAAi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B,EACzB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code agent implementation.
|
|
3
|
+
* Uses Vercel AI Gateway for model access.
|
|
4
|
+
*/
|
|
5
|
+
import type { Agent } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create Claude Code agent with specified authentication method.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createClaudeCodeAgent({ useVercelAiGateway }: {
|
|
10
|
+
useVercelAiGateway: boolean;
|
|
11
|
+
}): Agent;
|
|
12
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/claude-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,YAAY,CAAC;AAqDzE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,kBAAkB,EAAE,EAAE;IAAE,kBAAkB,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CA8NpG"}
|
|
@@ -0,0 +1,231 @@
|
|
|
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, } 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
|
+
/**
|
|
33
|
+
* Create Claude Code agent with specified authentication method.
|
|
34
|
+
*/
|
|
35
|
+
export function createClaudeCodeAgent({ useVercelAiGateway }) {
|
|
36
|
+
return {
|
|
37
|
+
name: useVercelAiGateway ? 'vercel-ai-gateway/claude-code' : 'claude-code',
|
|
38
|
+
displayName: useVercelAiGateway ? 'Claude Code (Vercel AI Gateway)' : 'Claude Code',
|
|
39
|
+
getApiKeyEnvVar() {
|
|
40
|
+
return useVercelAiGateway ? AI_GATEWAY.apiKeyEnvVar : ANTHROPIC_DIRECT.apiKeyEnvVar;
|
|
41
|
+
},
|
|
42
|
+
getDefaultModel() {
|
|
43
|
+
return 'opus';
|
|
44
|
+
},
|
|
45
|
+
async run(fixturePath, options) {
|
|
46
|
+
const startTime = Date.now();
|
|
47
|
+
let sandbox = null;
|
|
48
|
+
let agentOutput = '';
|
|
49
|
+
let transcript;
|
|
50
|
+
let aborted = false;
|
|
51
|
+
let sandboxStopped = false;
|
|
52
|
+
let hasReturned = false;
|
|
53
|
+
const captureTranscriptBestEffort = async () => {
|
|
54
|
+
if (!sandbox || sandboxStopped || transcript)
|
|
55
|
+
return;
|
|
56
|
+
transcript = await captureTranscript(sandbox);
|
|
57
|
+
};
|
|
58
|
+
// Handle abort signal
|
|
59
|
+
const abortHandler = () => {
|
|
60
|
+
aborted = true;
|
|
61
|
+
if (sandbox && !sandboxStopped) {
|
|
62
|
+
sandboxStopped = true;
|
|
63
|
+
sandbox.stop().catch(() => { });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
if (options.signal) {
|
|
67
|
+
if (options.signal.aborted) {
|
|
68
|
+
hasReturned = true;
|
|
69
|
+
return {
|
|
70
|
+
success: false,
|
|
71
|
+
output: '',
|
|
72
|
+
error: 'Aborted before start',
|
|
73
|
+
duration: 0,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
options.signal.addEventListener('abort', abortHandler);
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
// Collect files from fixture
|
|
80
|
+
const allFiles = await collectLocalFiles(fixturePath);
|
|
81
|
+
const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
|
|
82
|
+
// Check for abort before expensive operations
|
|
83
|
+
if (aborted) {
|
|
84
|
+
hasReturned = true;
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
output: '',
|
|
88
|
+
error: 'Aborted',
|
|
89
|
+
duration: Date.now() - startTime,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// Create sandbox
|
|
93
|
+
sandbox = await createSandbox({
|
|
94
|
+
timeout: options.timeout,
|
|
95
|
+
runtime: 'node24',
|
|
96
|
+
backend: options.sandbox,
|
|
97
|
+
});
|
|
98
|
+
// Check for abort after sandbox creation (abort may have fired during create)
|
|
99
|
+
if (aborted) {
|
|
100
|
+
hasReturned = true;
|
|
101
|
+
return {
|
|
102
|
+
success: false,
|
|
103
|
+
output: '',
|
|
104
|
+
error: 'Aborted',
|
|
105
|
+
duration: Date.now() - startTime,
|
|
106
|
+
sandboxId: sandbox.sandboxId,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Upload workspace files (excluding tests)
|
|
110
|
+
await sandbox.uploadFiles(workspaceFiles);
|
|
111
|
+
await initGitAndCommit(sandbox);
|
|
112
|
+
// Run setup function if provided
|
|
113
|
+
if (options.setup) {
|
|
114
|
+
await options.setup(sandbox);
|
|
115
|
+
}
|
|
116
|
+
// Install dependencies
|
|
117
|
+
let installResult = await sandbox.runCommand('npm', ['install']);
|
|
118
|
+
if (installResult.exitCode !== 0) {
|
|
119
|
+
installResult = await sandbox.runCommand('npm', ['install']);
|
|
120
|
+
}
|
|
121
|
+
if (installResult.exitCode !== 0) {
|
|
122
|
+
const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
|
|
123
|
+
throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
|
|
124
|
+
}
|
|
125
|
+
// Install Claude Code CLI globally
|
|
126
|
+
const cliInstall = await sandbox.runCommand('npm', [
|
|
127
|
+
'install',
|
|
128
|
+
'-g',
|
|
129
|
+
'@anthropic-ai/claude-code',
|
|
130
|
+
]);
|
|
131
|
+
if (cliInstall.exitCode !== 0) {
|
|
132
|
+
throw new Error(`Claude Code install failed: ${cliInstall.stderr}`);
|
|
133
|
+
}
|
|
134
|
+
// Verify no test files in sandbox
|
|
135
|
+
await verifyNoTestFiles(sandbox);
|
|
136
|
+
// Run Claude Code with appropriate authentication
|
|
137
|
+
const claudeResult = await sandbox.runCommand('claude', ['--print', '--model', options.model, '--dangerously-skip-permissions', options.prompt], {
|
|
138
|
+
env: useVercelAiGateway
|
|
139
|
+
? {
|
|
140
|
+
// AI Gateway configuration for Claude Code
|
|
141
|
+
ANTHROPIC_BASE_URL: AI_GATEWAY.baseUrl,
|
|
142
|
+
ANTHROPIC_AUTH_TOKEN: options.apiKey,
|
|
143
|
+
ANTHROPIC_API_KEY: '',
|
|
144
|
+
}
|
|
145
|
+
: {
|
|
146
|
+
// Direct Anthropic API
|
|
147
|
+
ANTHROPIC_API_KEY: options.apiKey,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
agentOutput = claudeResult.stdout + claudeResult.stderr;
|
|
151
|
+
if (claudeResult.exitCode !== 0) {
|
|
152
|
+
await captureTranscriptBestEffort();
|
|
153
|
+
// Extract meaningful error from output (last few lines usually contain the error)
|
|
154
|
+
const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
|
|
155
|
+
hasReturned = true;
|
|
156
|
+
return {
|
|
157
|
+
success: false,
|
|
158
|
+
output: agentOutput,
|
|
159
|
+
transcript,
|
|
160
|
+
error: errorLines || `Claude Code exited with code ${claudeResult.exitCode}`,
|
|
161
|
+
duration: Date.now() - startTime,
|
|
162
|
+
sandboxId: sandbox.sandboxId,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// Upload test files for validation
|
|
166
|
+
await sandbox.uploadFiles(testFiles);
|
|
167
|
+
// Create vitest config for EVAL.ts/tsx
|
|
168
|
+
await createVitestConfig(sandbox);
|
|
169
|
+
// Capture transcript before validation when available
|
|
170
|
+
await captureTranscriptBestEffort();
|
|
171
|
+
// Inject transcript context so EVAL.ts tests can assert on agent behavior
|
|
172
|
+
await injectTranscriptContext(sandbox, transcript, 'claude-code', options.model);
|
|
173
|
+
// Run validation scripts
|
|
174
|
+
const validationResults = await runValidation(sandbox, options.scripts ?? []);
|
|
175
|
+
// Capture generated files
|
|
176
|
+
const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
|
|
177
|
+
hasReturned = true;
|
|
178
|
+
return {
|
|
179
|
+
success: validationResults.allPassed,
|
|
180
|
+
output: agentOutput,
|
|
181
|
+
transcript,
|
|
182
|
+
duration: Date.now() - startTime,
|
|
183
|
+
testResult: validationResults.test,
|
|
184
|
+
scriptsResults: validationResults.scripts,
|
|
185
|
+
sandboxId: sandbox.sandboxId,
|
|
186
|
+
generatedFiles,
|
|
187
|
+
deletedFiles,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
await captureTranscriptBestEffort();
|
|
192
|
+
// Check if this was an abort
|
|
193
|
+
if (aborted) {
|
|
194
|
+
hasReturned = true;
|
|
195
|
+
return {
|
|
196
|
+
success: false,
|
|
197
|
+
output: agentOutput,
|
|
198
|
+
transcript,
|
|
199
|
+
error: 'Aborted',
|
|
200
|
+
duration: Date.now() - startTime,
|
|
201
|
+
sandboxId: sandbox?.sandboxId,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
hasReturned = true;
|
|
205
|
+
return {
|
|
206
|
+
success: false,
|
|
207
|
+
output: agentOutput,
|
|
208
|
+
transcript,
|
|
209
|
+
error: error instanceof Error ? error.message : String(error),
|
|
210
|
+
duration: Date.now() - startTime,
|
|
211
|
+
sandboxId: sandbox?.sandboxId,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
// If we're about to return and sandbox is still up, try one final transcript capture.
|
|
216
|
+
if (hasReturned) {
|
|
217
|
+
await captureTranscriptBestEffort();
|
|
218
|
+
}
|
|
219
|
+
// Clean up abort listener
|
|
220
|
+
if (options.signal) {
|
|
221
|
+
options.signal.removeEventListener('abort', abortHandler);
|
|
222
|
+
}
|
|
223
|
+
if (sandbox && !sandboxStopped) {
|
|
224
|
+
sandboxStopped = true;
|
|
225
|
+
await sandbox.stop();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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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AC;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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex CLI agent implementation.
|
|
3
|
+
* Uses Vercel AI Gateway for model access.
|
|
4
|
+
*/
|
|
5
|
+
import type { Agent } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create Codex agent with specified authentication method.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createCodexAgent({ useVercelAiGateway }: {
|
|
10
|
+
useVercelAiGateway: boolean;
|
|
11
|
+
}): Agent;
|
|
12
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AA8GzE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,EAAE;IAAE,kBAAkB,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CA0M/F"}
|
|
@@ -0,0 +1,267 @@
|
|
|
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, } 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
|
+
/**
|
|
50
|
+
* Generate Codex config.toml content.
|
|
51
|
+
*/
|
|
52
|
+
function generateCodexConfig(model, useVercelAiGateway) {
|
|
53
|
+
if (useVercelAiGateway) {
|
|
54
|
+
// AI Gateway uses prefixed model names like "openai/gpt-5.2-codex"
|
|
55
|
+
const fullModel = model.includes('/') ? model : `openai/${model}`;
|
|
56
|
+
return `# Codex configuration for Vercel AI Gateway
|
|
57
|
+
profile = "default"
|
|
58
|
+
|
|
59
|
+
[model_providers.vercel]
|
|
60
|
+
name = "Vercel AI Gateway"
|
|
61
|
+
base_url = "${AI_GATEWAY.openAiBaseUrl}"
|
|
62
|
+
env_key = "${AI_GATEWAY.apiKeyEnvVar}"
|
|
63
|
+
wire_api = "responses"
|
|
64
|
+
|
|
65
|
+
[profiles.default]
|
|
66
|
+
model_provider = "vercel"
|
|
67
|
+
model = "${fullModel}"
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Direct OpenAI API uses unprefixed model names like "gpt-5.2-codex"
|
|
72
|
+
const directModel = model.includes('/') ? model.split('/').pop() : model;
|
|
73
|
+
return `# Direct OpenAI API configuration
|
|
74
|
+
profile = "default"
|
|
75
|
+
|
|
76
|
+
[model_providers.openai]
|
|
77
|
+
name = "OpenAI"
|
|
78
|
+
base_url = "${OPENAI_DIRECT.baseUrl}"
|
|
79
|
+
env_key = "${OPENAI_DIRECT.apiKeyEnvVar}"
|
|
80
|
+
wire_api = "responses"
|
|
81
|
+
|
|
82
|
+
[profiles.default]
|
|
83
|
+
model_provider = "openai"
|
|
84
|
+
model = "${directModel}"
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create Codex agent with specified authentication method.
|
|
90
|
+
*/
|
|
91
|
+
export function createCodexAgent({ useVercelAiGateway }) {
|
|
92
|
+
return {
|
|
93
|
+
name: useVercelAiGateway ? 'vercel-ai-gateway/codex' : 'codex',
|
|
94
|
+
displayName: useVercelAiGateway ? 'OpenAI Codex (Vercel AI Gateway)' : 'OpenAI Codex',
|
|
95
|
+
getApiKeyEnvVar() {
|
|
96
|
+
return useVercelAiGateway ? AI_GATEWAY.apiKeyEnvVar : OPENAI_DIRECT.apiKeyEnvVar;
|
|
97
|
+
},
|
|
98
|
+
getDefaultModel() {
|
|
99
|
+
return 'openai/gpt-5.2-codex';
|
|
100
|
+
},
|
|
101
|
+
async run(fixturePath, options) {
|
|
102
|
+
const startTime = Date.now();
|
|
103
|
+
let sandbox = null;
|
|
104
|
+
let agentOutput = '';
|
|
105
|
+
let transcript;
|
|
106
|
+
let aborted = false;
|
|
107
|
+
let sandboxStopped = false;
|
|
108
|
+
// Handle abort signal
|
|
109
|
+
const abortHandler = () => {
|
|
110
|
+
aborted = true;
|
|
111
|
+
if (sandbox && !sandboxStopped) {
|
|
112
|
+
sandboxStopped = true;
|
|
113
|
+
sandbox.stop().catch(() => { });
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
if (options.signal) {
|
|
117
|
+
if (options.signal.aborted) {
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
output: '',
|
|
121
|
+
error: 'Aborted before start',
|
|
122
|
+
duration: 0,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
options.signal.addEventListener('abort', abortHandler);
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
// Collect files from fixture
|
|
129
|
+
const allFiles = await collectLocalFiles(fixturePath);
|
|
130
|
+
const { workspaceFiles, testFiles } = splitTestFiles(allFiles);
|
|
131
|
+
// Check for abort before expensive operations
|
|
132
|
+
if (aborted) {
|
|
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
|
+
return {
|
|
149
|
+
success: false,
|
|
150
|
+
output: '',
|
|
151
|
+
error: 'Aborted',
|
|
152
|
+
duration: Date.now() - startTime,
|
|
153
|
+
sandboxId: sandbox.sandboxId,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// Upload workspace files (excluding tests)
|
|
157
|
+
await sandbox.uploadFiles(workspaceFiles);
|
|
158
|
+
await initGitAndCommit(sandbox);
|
|
159
|
+
// Run setup function if provided
|
|
160
|
+
if (options.setup) {
|
|
161
|
+
await options.setup(sandbox);
|
|
162
|
+
}
|
|
163
|
+
// Install dependencies
|
|
164
|
+
let installResult = await sandbox.runCommand('npm', ['install']);
|
|
165
|
+
if (installResult.exitCode !== 0) {
|
|
166
|
+
installResult = await sandbox.runCommand('npm', ['install']);
|
|
167
|
+
}
|
|
168
|
+
if (installResult.exitCode !== 0) {
|
|
169
|
+
const output = (installResult.stdout + installResult.stderr).trim().split('\n').slice(-10).join('\n');
|
|
170
|
+
throw new Error(`npm install failed (exit code ${installResult.exitCode}):\n${output}`);
|
|
171
|
+
}
|
|
172
|
+
// Install Codex CLI globally
|
|
173
|
+
const cliInstall = await sandbox.runCommand('npm', [
|
|
174
|
+
'install',
|
|
175
|
+
'-g',
|
|
176
|
+
'@openai/codex',
|
|
177
|
+
]);
|
|
178
|
+
if (cliInstall.exitCode !== 0) {
|
|
179
|
+
throw new Error(`Codex CLI install failed: ${cliInstall.stderr}`);
|
|
180
|
+
}
|
|
181
|
+
// Parse model string for query parameters (e.g. "gpt-5.2-codex?reasoningEffort=high")
|
|
182
|
+
const { model: baseModel, reasoningEffort } = parseModelString(options.model);
|
|
183
|
+
// Create Codex config directory and config file
|
|
184
|
+
await sandbox.runShell('mkdir -p ~/.codex');
|
|
185
|
+
const configContent = generateCodexConfig(baseModel, useVercelAiGateway);
|
|
186
|
+
await sandbox.runShell(`cat > ~/.codex/config.toml << 'EOF'
|
|
187
|
+
${configContent}
|
|
188
|
+
EOF`);
|
|
189
|
+
// Verify no test files in sandbox
|
|
190
|
+
await verifyNoTestFiles(sandbox);
|
|
191
|
+
// Build Codex CLI command
|
|
192
|
+
// codex login sets up bearer auth for the CLI; env var provides the key for the model provider
|
|
193
|
+
const envVarToSet = useVercelAiGateway ? AI_GATEWAY.apiKeyEnvVar : OPENAI_DIRECT.apiKeyEnvVar;
|
|
194
|
+
const escapedPrompt = options.prompt.replace(/'/g, "'\\''");
|
|
195
|
+
const reasoningFlag = reasoningEffort ? ` -c model_reasoning_effort="${reasoningEffort}"` : '';
|
|
196
|
+
const codexResult = await sandbox.runShell(`echo '${options.apiKey}' | codex login --with-api-key && codex exec --model ${baseModel} --dangerously-bypass-approvals-and-sandbox --json --skip-git-repo-check${reasoningFlag} '${escapedPrompt}'`, { [envVarToSet]: options.apiKey });
|
|
197
|
+
agentOutput = codexResult.stdout + codexResult.stderr;
|
|
198
|
+
transcript = extractTranscriptFromOutput(agentOutput);
|
|
199
|
+
if (codexResult.exitCode !== 0) {
|
|
200
|
+
// Extract meaningful error from output (last few lines usually contain the error)
|
|
201
|
+
const errorLines = agentOutput.trim().split('\n').slice(-5).join('\n');
|
|
202
|
+
return {
|
|
203
|
+
success: false,
|
|
204
|
+
output: agentOutput,
|
|
205
|
+
transcript,
|
|
206
|
+
error: errorLines || `Codex CLI exited with code ${codexResult.exitCode}`,
|
|
207
|
+
duration: Date.now() - startTime,
|
|
208
|
+
sandboxId: sandbox.sandboxId,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// Upload test files for validation
|
|
212
|
+
await sandbox.uploadFiles(testFiles);
|
|
213
|
+
// Create vitest config for EVAL.ts/tsx
|
|
214
|
+
await createVitestConfig(sandbox);
|
|
215
|
+
// Inject transcript context so EVAL.ts tests can assert on agent behavior
|
|
216
|
+
await injectTranscriptContext(sandbox, transcript, 'codex', options.model);
|
|
217
|
+
// Run validation scripts
|
|
218
|
+
const validationResults = await runValidation(sandbox, options.scripts ?? []);
|
|
219
|
+
// Capture generated files
|
|
220
|
+
const { generatedFiles, deletedFiles } = await captureGeneratedFiles(sandbox);
|
|
221
|
+
return {
|
|
222
|
+
success: validationResults.allPassed,
|
|
223
|
+
output: agentOutput,
|
|
224
|
+
transcript,
|
|
225
|
+
duration: Date.now() - startTime,
|
|
226
|
+
testResult: validationResults.test,
|
|
227
|
+
scriptsResults: validationResults.scripts,
|
|
228
|
+
sandboxId: sandbox.sandboxId,
|
|
229
|
+
generatedFiles,
|
|
230
|
+
deletedFiles,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
// Check if this was an abort
|
|
235
|
+
if (aborted) {
|
|
236
|
+
return {
|
|
237
|
+
success: false,
|
|
238
|
+
output: agentOutput,
|
|
239
|
+
transcript,
|
|
240
|
+
error: 'Aborted',
|
|
241
|
+
duration: Date.now() - startTime,
|
|
242
|
+
sandboxId: sandbox?.sandboxId,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
success: false,
|
|
247
|
+
output: agentOutput,
|
|
248
|
+
transcript,
|
|
249
|
+
error: error instanceof Error ? error.message : String(error),
|
|
250
|
+
duration: Date.now() - startTime,
|
|
251
|
+
sandboxId: sandbox?.sandboxId,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
finally {
|
|
255
|
+
// Clean up abort listener
|
|
256
|
+
if (options.signal) {
|
|
257
|
+
options.signal.removeEventListener('abort', abortHandler);
|
|
258
|
+
}
|
|
259
|
+
if (sandbox && !sandboxStopped) {
|
|
260
|
+
sandboxStopped = true;
|
|
261
|
+
await sandbox.stop();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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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AmB,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;AA6CzE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,KAAK,CA0MzC"}
|