| 22 | import type { AgentEvalResults, EvalDataV2, EvalCommitV2 } from './types' |
| 23 | |
| 24 | function parseAgentId(agent: string): { |
| 25 | agentId: string |
| 26 | externalAgentType?: ExternalAgentType |
| 27 | } { |
| 28 | if (agent.startsWith('external:')) { |
| 29 | const externalType = agent.slice('external:'.length) as ExternalAgentType |
| 30 | if ( |
| 31 | externalType !== 'claude' && |
| 32 | externalType !== 'codex' && |
| 33 | externalType !== 'opencode' |
| 34 | ) { |
| 35 | throw new Error( |
| 36 | `Unknown external agent type: ${externalType}. Supported: claude, codex, opencode`, |
| 37 | ) |
| 38 | } |
| 39 | return { agentId: agent, externalAgentType: externalType } |
| 40 | } |
| 41 | return { agentId: agent } |
| 42 | } |
| 43 | |
| 44 | async function runTask(options: { |
| 45 | client: CodebuffClient |